Skip to content

fix(engine): show the full command in system temp-scope approval asks - #2263

Merged
peppescg merged 1 commit into
mainfrom
fix/system-scope-approval-command
Oct 13, 2026
Merged

peppescg merged 1 commit into
mainfrom
fix/system-scope-approval-command

Conversation

@peppescg

@peppescg peppescg commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A Shell call with temp_scope: "system" needs the independent ShellSystemTemp approval. That approval's args held only temp_scope and a command_summary with the first two whitespace-separated words of the command, so approvers in Studio, the TUI, and ACP clients did not see the full command that would run.

The approval now shows the full command, without host paths:

  • The ask args are {"command", "timeout_ms", "background", "temp_scope"}, re-encoded from the call as Shell decodes it. Duplicate or case-variant keys therefore show the value that runs. timeout_ms and background appear only when set. &, <, and > stay literal.
  • The runner picks temporary directories and environment values when the command runs. They never enter the call, so they never appear in the ask (TestSystemTempApprovalDoesNotLeakPath still checks this).
  • command_summary is removed. No client in the repo reads it.

Related consumers of the ask args:

  • Subagents: isolated-worktree auto-approval no longer clears a system temp-scope ask. Before this change, it never saw a command to approve. A surfaced child ask's preview now ends with [temp_scope: system], and the headless ask reviewer gets a trusted line saying the command requests host-shared temporary storage.
  • TUI: the pretty view of a Shell ask now adds background: true and temp_scope: … lines next to the existing timeout_ms line.
  • ACP and the gRPC contract: both pass the args through unchanged, so no changes were needed.

Tests

  • TestSystemTempApprovalShowsFullCommand: compound command, timeout and background, duplicate key, case-variant keys (exact projected bytes).
  • TestSystemTempApprovalMatchesExecutedCommand: approves the ask and checks the command shown is the one the runner received.
  • TestSystemTempApprovalDoesNotLeakPath: now also requires the full command.
  • TestIsolatedSubagentSystemScopeAskIsNotAutoApproved, TestAskReviewPromptNamesSystemTempScope, TestSurfacedCommandPreviewNamesSystemTempScope, TestPermissionModalShellPrettyAnnotatesScopeAndBackground.

Docs: user-docs/features/sessions/tools.md and engine/CHANGELOG.md.

Screenshot

The mecatui permission request for a Shell call with temp_scope: system, before (main) and after this PR. In both cases the command that runs is git status && echo done.

mecatui approval request, before and after

The argument text comes from mecatui's own askArgsContent, fed the payload each engine version sends. The surrounding frame is drawn to match the TUI.

🤖 Generated with Claude Code

The approval for a Shell call with temp_scope "system" carried only the
first two words of the command as command_summary. It now carries the
command, timeout_ms, background, and temp_scope as Shell decodes them,
so duplicate or case-variant keys show the value that runs. Runner-owned
temporary paths and environment values never enter the call and still
never appear.

Subagent consumers of the ask args follow: isolation auto-approve no
longer clears a system temp-scope ask, a surfaced child ask names the
scope, and the headless ask reviewer is told about host-shared temporary
storage. The TUI pretty view annotates background and temp_scope.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@peppescg
peppescg merged commit 6859db3 into main Oct 13, 2026
62 of 64 checks passed
@peppescg
peppescg deleted the fix/system-scope-approval-command branch October 13, 2026 12:58
peppescg added a commit that referenced this pull request Oct 13, 2026
…e tool executes

Permission evaluation, approval display and tool execution now read a tool
call's arguments through one decode, governance.DecodeToolArgs, which
session.ParseArgs and the policy extractors share.

governance.CheckToolArgs refuses argument objects that repeat a key, have
top-level keys equal under Unicode case folding, or spell a policy-read
argument in another case. Engine.permissionDecision applies it before policy
evaluation, so such calls are rejected with a tool error before any rule,
guardrail, approval, hook or tool sees them. The evaluator and ParseArgs
apply the same check.

The tests that pinned the old case-insensitive, last-key-wins reading now
assert rejection, including the ambiguous cases added by #2263.

Closes #2264

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 13, 2026
2 tasks
peppescg added a commit that referenced this pull request Oct 14, 2026
…e tool executes

Permission evaluation, approval display and tool execution now read a tool
call's arguments through one decode, governance.DecodeToolArgs, which
session.ParseArgs and the policy extractors share.

governance.CheckToolArgs refuses argument objects that repeat a key, have
top-level keys equal under Unicode case folding, or spell a policy-read
argument in another case. Engine.permissionDecision applies it before policy
evaluation, so such calls are rejected with a tool error before any rule,
guardrail, approval, hook or tool sees them. The evaluator and ParseArgs
apply the same check.

The tests that pinned the old case-insensitive, last-key-wins reading now
assert rejection, including the ambiguous cases added by #2263.

Closes #2264

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 15, 2026
…e tool executes

Permission evaluation, approval display and tool execution now read a tool
call's arguments through one decode, governance.DecodeToolArgs, which
session.ParseArgs and the policy extractors share.

governance.CheckToolArgs refuses argument objects that repeat a key, have
top-level keys equal under Unicode case folding, or spell a policy-read
argument in another case. Engine.permissionDecision applies it before policy
evaluation, so such calls are rejected with a tool error before any rule,
guardrail, approval, hook or tool sees them. The evaluator and ParseArgs
apply the same check.

The tests that pinned the old case-insensitive, last-key-wins reading now
assert rejection, including the ambiguous cases added by #2263.

Closes #2264

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 62b3cecf Deployed Oct 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants