zeroclaw/src
Argenis 22cdb5e2e2
fix(whatsapp): remove duplicate variable declaration causing unused warning (#4066)
* feat(config): add google workspace operation allowlists

* docs(superpowers): link google workspace operation inventory sources

* docs(superpowers): verify starter operation examples

* fix(google_workspace): remove duplicate credential/audit blocks, fix trim in allowlist check, add duplicate-methods test

- Remove the duplicated credentials_path, default_account, and audit_log
  blocks that were copy-pasted into execute() — they were idempotent but
  misleading and would double-append --account args on every call.
- Trim stored service/resource/method values in is_operation_allowed() to
  match the trim applied during Config::validate(), preventing a mismatch
  where a config entry with surrounding whitespace would pass validation but
  never match at runtime.
- Add google_workspace_allowed_operations_reject_duplicate_methods_within_entry
  test to cover the duplicate-method validation path that was implemented but
  untested.

* fix(google_workspace): close sub_resource bypass, trim allowed_services at runtime, mark spec implemented

- HIGH: extract and validate sub_resource before the allowlist check;
  is_operation_allowed() now accepts Option<&str> for sub_resource and
  returns false (fail-closed) when allowed_operations is non-empty and
  a sub_resource is present — prevents nested gws calls such as
  `drive/files/permissions/list` from slipping past a 3-segment policy
- MEDIUM: runtime allowed_services check now uses s.trim() == service,
  matching the trim() applied during config validation
- LOW: spec status updated to Implemented; stale "does not currently
  support method-level allowlists" line removed
- Added test: operation_allowlist_rejects_sub_resource_when_operations_configured

* docs(google_workspace): document sub_resource limitation and add config-reference entries

Spec updates (superpowers/specs):
- Semantics section: note that sub_resource calls are denied fail-closed when
  allowed_operations is configured
- Mental model: show both 3-segment and 4-segment gws command shapes; explain
  that 4-segment commands are unsupported with allowed_operations in this version
- Runtime enforcement: correct the validation order to match the implementation
  (sub_resource extracted before allowlist check, budget charged last)
- New section: Sub-Resource Limitation — documents impact, operator workaround,
  and confirms the deny is intentional for this slice
- Follow-On Work: add sub_resource config model extension as item 1

Config reference updates (all three locales):
- Add [google_workspace] section with top-level keys, [[allowed_operations]]
  sub-table, sub-resource limitation note, and TOML example

* fix(docs): add classroom and events to allowed_services list in all config-reference locales

* feat(google_workspace): extend allowed_operations to support sub_resource for 4-segment gws commands

All Gmail operations use gws gmail users <sub_resource> <method>, not the flat
3-segment shape. Without sub_resource support in allowed_operations, Gmail could
not be scoped at all, making the email-assistant use case impossible.

Config model:
- Add optional sub_resource field to GoogleWorkspaceAllowedOperation
- An entry without sub_resource matches 3-segment calls (Drive, Calendar, etc.)
- An entry with sub_resource matches only calls with that exact sub_resource value
- Duplicate detection updated to (service, resource, sub_resource) key

Runtime:
- Remove blanket sub_resource deny; is_operation_allowed now matches on all four
  dimensions including the optional sub_resource

Tests:
- Add operation_allowlist_matches_gmail_sub_resource_shape
- Add operation_allowlist_matches_drive_3_segment_shape
- Add rejects_operation_with_unlisted_sub_resource
- Add google_workspace_allowed_operations_allow_same_resource_different_sub_resource
- Add google_workspace_allowed_operations_reject_invalid_sub_resource_characters
- Add google_workspace_allowed_operations_deserialize_without_sub_resource
- Update all existing tests to use correct gws command shapes

Docs:
- Spec: correct Gmail examples throughout; remove Sub-Resource Limitation section;
  update data model, validation rules, example use case, and follow-on work
- Config-reference (en, vi, zh-CN): add sub_resource field to allowed_operations
  table; update Gmail examples to correct 4-segment shapes

Platform:
- email-assistant SKILL.md: update allowed_operations paths to gmail/users/* shape

* fix(google_workspace): add classroom and events to service parameter schema description

* fix(google_workspace): cross-validate allowed_operations service against allowed_services

When allowed_services is explicitly configured, each allowed_operations entry's
service must appear in that list. An entry that can never match at runtime is a
misconfigured policy: it looks valid but silently produces a narrower scope than
the operator intended. Validation now rejects it with a clear error message.

Scope: only applies when allowed_services is non-empty. When it is empty, the tool
uses a built-in default list defined in the tool layer; the validator cannot
enumerate that list without duplicating the constant, so the cross-check is skipped.

Also:
- Update allowed_operations field doc-comment from 3-part (service, resource, method)
  to 4-part (service, resource, sub_resource, method) model
- Soften Gmail sub_resource "required" language in config-reference (en, vi, zh-CN)
  from a validation requirement to a runtime matching requirement — the validator
  does not and should not hardcode API shape knowledge for individual services
- Add tests: rejects operation service not in allowed_services; skips cross-check
  when allowed_services is empty

* fix(google_workspace): cross-validate allowed_operations.service against effective service set

When allowed_services is empty the validator was silently skipping the
service cross-check, allowing impossible configs like an unlisted service
in allowed_operations to pass validation and only fail at runtime.

Move DEFAULT_GWS_SERVICES from the tool layer (google_workspace.rs) into
schema.rs so the validator can use it unconditionally. When allowed_services
is explicitly set, validate against that set; when empty, fall back to
DEFAULT_GWS_SERVICES. Remove the now-incorrect "skips cross-check when empty"
test and add two replacement tests: one confirming a valid default service
passes, one confirming an unknown service is rejected even with empty
allowed_services.

* fix(google_workspace): update test assertion for new error message wording

* docs(google_workspace): fix stale 3-segment gmail example in TDD plan

* fix(google_workspace): address adversarial review round 4 findings

- Error message for denied operations now includes sub_resource when
  present, so gmail/users/messages/send and gmail/users/drafts/send
  produce distinct, debuggable errors.
- Audit log now records sub_resource, completing the trail for 4-segment
  Gmail operations.
- Normalize (trim) allowed_services and allowed_operations fields at
  construction time in new(). Runtime comparisons now use plain equality
  instead of .trim() on every call, removing the latent defect where a
  future code path could forget to trim and silently fail to match.
- Unify runtime character validation with schema validation: sub_resource
  and service/resource/method checks now both require lowercase alphanumeric
  plus underscore and hyphen, matching the validator's character set.
- Add positional_cmd_args() test helper and tests verifying 3-segment
  (Drive) and 4-segment (Gmail) argument ordering.
- Add test confirming page_limit without page_all passes validation.
- Add test confirming whitespace in config values is normalized at
  construction, not deferred to comparison time.
- Fix spec Runtime Enforcement section to reflect actual code order.

* fix(google_workspace): wire production helpers to close test coverage gaps

- Remove #[cfg(test)] from positional_cmd_args; execute() now calls the
  same function the arg-ordering tests exercise, so a drift in the real
  command-building path is caught by the existing tests.
- Extract build_pagination_args(page_all, page_limit) as a production
  method used by execute(). Replace the brittle page_limit_without_page_all
  test (which relied on environment-specific execution failure wording)
  with four direct assertions on build_pagination_args covering all
  page_all/page_limit combinations.

* fix(whatsapp): remove duplicate variable declaration causing unused warning

Remove duplicate `let transcription_config = self.transcription.clone()`
(line 626 shadowed by identical line 628). The duplicate caused a
compiler warning during --features whatsapp-web builds.

Note: the reported "hang" at 526/528 crates is expected behavior for
release builds with lto="fat" + codegen-units=1 — the final link step
is slow but does complete.

Closes #4034

---------

Co-authored-by: Nim G <theredspoon@users.noreply.github.com>
2026-03-20 12:07:55 -04:00
..
agent fix(agent): force sequential execution when tool_search is in batch (#4054) 2026-03-20 11:24:07 -04:00
approval fix(channels): allow low-risk shell in non-interactive mode (#3771) 2026-03-17 13:39:37 -04:00
auth feat: stabilize codex oauth and add provider model connectivity workflow 2026-02-24 16:03:01 +08:00
channels fix(whatsapp): remove duplicate variable declaration causing unused warning (#4066) 2026-03-20 12:07:55 -04:00
commands fix(cli): align self-test and update commands with implementation plan 2026-03-17 17:24:59 -04:00
config feat(tool): google_workspace operation-level allowlist (#4010) 2026-03-20 11:46:22 -04:00
cost fix(agent): parse MiniMax tool call formats for execution 2026-02-21 12:36:28 +08:00
cron fix(cron): persist allowed_tools for agent jobs (#3993) 2026-03-19 14:37:55 -04:00
daemon merge: resolve conflicts with master after #3891 merge 2026-03-19 18:29:36 -04:00
doctor feat(delegate): make sub-agent timeouts configurable via config.toml (#3909) 2026-03-18 17:07:03 -04:00
gateway fix(api): respect job_type and delivery in POST /api/cron (#4063) (#4065) 2026-03-20 12:03:46 -04:00
hands feat(hands): add autonomous knowledge-accumulating agent packages (#3603) 2026-03-15 16:06:14 -04:00
hardware Addressed clippy lint issues 2026-03-10 01:48:19 -04:00
health refactor(sync): migrate remaining std mutex usage to parking_lot 2026-02-18 00:45:26 +08:00
heartbeat feat(heartbeat): add health metrics, adaptive intervals, and task history 2026-03-16 12:08:32 -04:00
hooks feat(hooks): add webhook-audit builtin hook (#3212) 2026-03-11 23:34:17 -04:00
integrations fix(channels): respect ack_reactions config for Telegram channel (#3834) (#3913) 2026-03-18 15:40:31 -04:00
memory feat(heartbeat): default interval 30→5min + prune heartbeat from auto-save (#3938) 2026-03-19 08:17:08 -04:00
nodes feat(nodes): add secure HMAC-SHA256 node transport layer (#3654) 2026-03-16 01:53:47 -04:00
observability fix(observability): handle missing OtelObserver match arms and add all-features CI check (#3981) 2026-03-19 17:48:35 -04:00
onboard feat(tools): add text browser tool for headless environments (#4031) 2026-03-20 01:59:43 -04:00
peripherals feat(knowledge): add knowledge graph for expertise capture and reuse (#3596) 2026-03-17 01:11:29 -04:00
plugins fix(plugins): integrate WASM tools into registry, add gateway routes and tests 2026-03-17 18:10:24 -04:00
providers fix(provider): complete Anthropic OAuth setup-token authentication (#4053) 2026-03-20 11:24:10 -04:00
rag chore(lint): extend low-risk clippy cleanup batch 2026-02-17 16:40:58 +08:00
runtime feat(tools): add Windows support for shell tool_call execution (#3442) 2026-03-13 17:12:16 -04:00
security feat(security): inject security policy summary into LLM system prompt (#4002) 2026-03-19 17:54:12 -04:00
service fix(packaging): ensure Homebrew var directory exists on first start (#3524) 2026-03-19 22:32:13 -04:00
skillforge chore: Remove blocking read strings 2026-02-19 14:52:29 +08:00
skills fix(skills): preserve TOML [[tools]] in Compact prompt injection mode (#4032) 2026-03-20 01:55:34 -04:00
sop fix(web): call doctor endpoint with authenticated POST 2026-02-24 16:02:59 +08:00
tools feat(tool): google_workspace operation-level allowlist (#4010) 2026-03-20 11:46:22 -04:00
tunnel feat(tunnel): add OpenVPN tunnel provider (#3648) 2026-03-16 00:34:34 -04:00
i18n.rs feat(i18n): externalize tool descriptions for translation (#3912) 2026-03-18 17:01:39 -04:00
identity.rs test: cover deterministic HashMap ordering paths 2026-02-18 21:55:40 +08:00
lib.rs fix(cron): persist allowed_tools for agent jobs (#3993) 2026-03-19 14:37:55 -04:00
main.rs feat(i18n): externalize tool descriptions for translation (#3912) 2026-03-18 17:01:39 -04:00
migration.rs readd tests, remove markdown files 2026-02-18 14:42:39 +08:00
multimodal.rs fix(agent): strip vision markers from history for non-vision providers (#3734) 2026-03-16 16:25:45 -04:00
util.rs fix(ci): restore containerized validation on main (#1096) 2026-02-20 07:48:58 -05:00