Repository navigation
feat(tools): explain terminal access restrictions - #157014
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 24, 2026, 3:27 AM ET / 07:27 UTC (Revision 5). ClawSweeper reviewWhat this changesAdds terminal-access explanations to the exec-policy CLI and Agent Tools panel, with Gateway policy diagnostics, protocol metadata, docs, and tests. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: current main and v2026.9.6 lack the requested explanation. The latest head addresses both prior CLI findings, and this review found no new actionable defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw filters an agent’s tools using configuration and session policy, then exposes a saved-session preview through the Gateway. The CLI and Control UI display that preview separately from command approval settings. flowchart LR
A[Global and agent settings] --> B[Tool policy resolver]
B --> C[Effective tool inventory]
C --> D[Gateway session preview]
D --> E[Terminal report]
D --> F[Agent Tools panel]
G[Command approvals] --> E
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1057, Tests +837, Docs +86, Other +26. Total +2006 across 39 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep policy decisions in the existing resolver and present checked exclusions beside separate command approvals, with full approval detail available on demand. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature PR. The linked issue and PR provide a concrete messaging-profile configuration and real-Gateway observations of the operator confusion. Is this the best way to solve the issue? Yes. The branch obtains exclusion reasons from the policy and inventory owners, keeps command approvals distinct, and avoids changing permissions during inspection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1590205e5861. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
9c85283 to
a0ad838
Compare
|
* feat(tools): explain terminal access restrictions * test(agents): support source-aware roster fixtures * fix(cli): inspect remote agents and retain approval summaries
Closes #155914
What Problem This Solves
Operators troubleshooting missing terminal access can see command approval settings that permit execution while an agent profile still hides
execandprocess.User Impact
openclaw exec-policy shownow explains local tool restrictions offline;--agentselects an agent and--sessionexplicitly fetches a saved-session tool preview from the Gateway. The agent Tools panel shows exclusion reasons, configuration sources, and the global-to-agent profile hierarchy. Inspection preserves permissions and command approvals, and failed or stale previews stay distinct from policy denials. Preview inclusion does not guarantee execution access.Why This Change Was Made
This is a diagnostics and usability enhancement for intentional policy enforcement. The CLI and UI consume explanations from the existing policy and effective-inventory owners. An additive
alsoAllowsuggestion appears only when it addresses the known blockers without discarding inherited grants; Doctor does not broaden permissions. No configuration migration is required.CLI product decision and compatibility
The maintainer approved a compact default report with deeper policy detail behind
--verbose. Preserve that presentation: a selected agent gets its approval summary; an untargeted multi-agent report gets one concise line for every local approval scope alongside the selection hint. The complete requested/host/effective tables remain available through--verbose, and--jsonretains every existing approval field and scope. Moving the full human-readable tables behind--verboseis an intentional, accepted presentation change.Session inspection delegates agent ownership to the target Gateway. Agents need not exist in the CLI machine's roster; local tool policy is explicitly unavailable when no local match exists. Offline agent selection and explicit agent/session mismatch checks remain enforced.
The protocol schema changes add optional diagnostic response metadata and relocate the existing
ToolsEffective*definitions. They add no database fields, writes, schema version, or persistence migration. The CLI/UI tolerate older Gateway responses withouttoolAccess; generated Swift decodes it as optional. The automated stored-data warning does not describe this change.Evidence
55f7c2168d0: The pre-fix CLI rejectedagent:remote:proofas an unknown local agent before contacting the Gateway. The repaired supported CLI inspected a persisted session for a Gateway-only agent with JSON and human output: both terminal tools were excluded byagents.entries.remote.tools.profile, local tool policy was explicitly unavailable, and the report used saved-session preview wording. CLI and Gateway used separate agent configurations with the fixture’s existing device identity; fresh-client authentication setup is outside this proof. The multi-agent default report retained all local approval scopes. Configuration bytes remained unchanged, and the isolated loopback Gateway stopped cleanly. No model or channel turn was needed.pnpm test src/cli/exec-policy-cli.test.ts --maxWorkers=1, 66.19 s wall). The added remote-selection and untargeted-summary cases first failed against the prior production code for the intended reasons. Preserving the local branch line-cap gate also required moving tool mock registration into the existing compaction test support module; no tests or assertions were added for that extraction. All 208 existing cases across three compaction files passed (413.42 s wall, cold cache). The native changed-file gate passed (core production types, five affected test type graphs, formatting, lint, and repository guards), as did the docs MDX check and fresh independent review; no actionable P0–P2 findings remained.2858614c63d): The first CI run exposed missinglistAgentEntriesWithSourcemocks in BTW and compaction (107 failing cases across four jobs). Five added lines in three test files supply that reader while preserving existinglistAgentEntriescallers; durable compaction restores both real readers. All 319 existing cases across eight affected/sibling files passed withpnpm test <eight files> --maxWorkers=1(308.00 s wall). The changedcompact.delegate.test.tsalso passed independently: 10 cases, 56.69 s wall withpnpm test src/agents/embedded-agent-runner/compact.delegate.test.ts --maxWorkers=1. Its unchanged integration coverage exercises real SQLite transcript identity, cancellation, and post-commit accounting. No tests were added or assertions weakened. Native changed-file checks, final affected test type graphs, and independent review passed. Hosted CI reported 9.543 s of summed test execution for the 10 delegate cases (the containing 25-file / 619-case Vitest shard took 164.75 s).2858614c63d: The new CI run completed successfully. All four previously failing mock-related jobs pass. The previously timed-out UI job also passed on this run; this does not establish a fix for that unrelated timeout. That head finished with no failing or pending checks.3fb84b0522092a363ec7efb4bbf9d269a477e767. The overlap with main’s tool-preview correction is resolved: preview absence does not imply denied access, while explicit exclusions retain their explanations. Published candidate:55f7c2168d05ff4d6f87e1e38851876f1d8347d3(includes the CI fixture repair and ClawSweeper follow-up).9c85283a36fb92cc7724b839f22dabed5504b07f). Generated Swift consistency and UI translation verification also passed. After resolving the overlap, 31 CLI cases and 35 browser cases passed, plus 2 lazy-registration and 50 catalog/verifier tests. All four new CLI preview regressions first failed against the prior renderer for the intended status errors. Keyless i18n verification, UI typechecking, and the two-doc MDX check passed. The native changed-file gate passed: core production types, all 25 core test type graphs, UI types, changed-file lint, formatting, and repository guards.57f912b5f7011bae0cc5f36a4ba7f56556ed4127: the messaging profile hid terminal tools while the approval report did not explain why.9c85283a36fb92cc7724b839f22dabed5504b07f(inventory and reload logic unchanged by the final rebase): created an isolated persisted session throughsessions.createwithout a model turn. Bothtools.effectiveandexec-policy show --session … --jsonreportedexec/processexcluded by the agent messaging profile. An explicit fixture update retainedbrowser,web_fetch, andweb_searchand appendedexec/process; hot reload included both tools in the next inventory and CLI inspection. This proves the session preview and reload behavior, not command execution. Read-only inspections left configuration bytes unchanged, and the complete effective approval policy was identical before/after the intentional update. The owned Gateway shut down cleanly. No model or Telegram turn was used for this proof.Remote-only agent review item resolved: Session inspection now asks the target Gateway to resolve the agent, permits agents absent from the local roster, and labels local tool policy unavailable when it cannot be computed. Offline unknown-agent rejection and explicit target-mismatch protection remain. Untargeted reports retain compact approval facts for every local scope; detailed tables remain behind
--verboseby the maintainer-approved product decision above.Known baseline limitation: pinned SwiftLint 0.65.1 reports cyclomatic complexity 21 > 20 in
apps/macos/Sources/OpenClaw/GatewayProcessManager.swift:1160. The exact file and lint configuration are unchanged across the original base, updated main, and this candidate; the same exact-file failure was reproduced on the first refresh, and the file remains byte-identical on the final base. The full macOS suite was not repeated for this rebase; 1,234 macOS tests passed during the earlier implementation validation.CLI before and after
Both examples use an isolated configuration with global
full, agentmessaging, and existingalsoAllowentries forbrowser,web_fetch, andweb_search. Paths are redacted where shown.Before — previous default approval report (excerpt). This is a fresh capture from the unchanged legacy renderer now available under
--verbose; that renderer is byte-identical to the one on the updated main branch.After — ordinary offline diagnostics (
openclaw exec-policy show), captured ona0ad838dc308cd47491f8ae94f2b2c87722885d9; renderer unchanged by the CI fixture repair.Review repair: untargeted CLI before and after
These are supported CLI captures using the same two-agent fixture. The repair restores concise approval facts while preserving the approved compact presentation.
Before —
2858614c63d:After —
55f7c2168d0:Tools panel before and after
Before — original reproduction base (
57f912b5f70): availability has no explanation of the agent override.After: the reason and source hierarchy are visible, and the active profile is marked.
After: phone layout
Focused test commands and measured cost
The rows show the latest relevant local runs through the repository test wrapper with
--maxWorkers=1. Core inventory/protocol/cache and agent-page proof is reused from9c85283; CLI ran on the review-repair source; the two browser files ran on the prior resolved source, with UI code unchanged by the repair. Wall time includes runner startup and cold transform preparation; these are local measurements, not CI durations.packages/gateway-protocol/src/schema/agents-models-skills.test.tssrc/agents/tools-effective-inventory.cold-provider.test.tssrc/agents/tools-effective-inventory.policy.test.tssrc/agents/tools-effective-inventory.test.tssrc/cli/exec-policy-cli.test.tssrc/gateway/server-methods/tools-effective.cache.test.tsui/src/pages/agents/agents-page.test.tsui/src/pages/agents/panels-tools-skills.browser.test.tsui/src/pages/agents/tool-access-diagnostics.browser.test.tsThe browser files share one invocation; extracting the three diagnostic cases preserves the existing assertions and keeps the original suite within its line limit.
CI timing will be available from the attached run when its jobs finish.