Skip to content

"Should we approve this?" Consequence-aware approval mechanisms for autonomous coding agents"Shall We Approve?" Consequence-Aware Approval for Autonomous Coding Agents

arXiv: Jailbreaks, Prompt Injection, Poisoning & Defenses· arXiv:2610.40753· Weiheng Wu, Junkai Chen, Zhensu Sun, Jieke Shi, Yunbo Lyu, David LoSingapore Management UniversityIndexed by this site · 21 days ago· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose Caper: pre-execute shell commands in a snapshot sandbox and have an LLM approver approve based on observed effects, achieving a 6.7% harm rate on SABER (the lowest baseline is 14.8%).

Threat modelCoding agents handle benign user requests but may make mistakes, act beyond their authority, or be redirected by untrusted content in project files and tool output; scripts, build files and binaries in the workspace may perform behaviors not shown in the command text. The goal is to prevent the consequences of shell commands beyond the scope of the user's task (persistent changes, network transfers, credential leakage) while allowing the task to complete safely. The authors trust the approver, the snapshot rollback mechanism and the container boundary.

Questions
Shell command approvers for coding agents see only the request and command text, whereas a command's actual effects depend on the code it invokes and the workspace state, so harms invisible in the text are allowed through; and per-command human approval does not scale.
Methods
Caper pre-executes each shell command once in a snapshot container with system call tracing, generates a bounded effect report and gives it to an independent LLM approver; if allowed, the state is committed; if blocked, it is rolled back and the reason is returned to the agent for replanning.
Experiments and results
Six systems were compared on SABER and the self-built YoloFS-Ext: Caper's harm rate was 6.7% and 7.8% respectively, lower than all baselines; on YoloFS-Ext the safe completion rate was 60.8%, and the safe-twin false-block rate was 1.0%.
Limitations and future work
The authors note: effects outside the sandbox cannot be rolled back; it covers only shell commands; the report covers only a single observed execution and adaptive attacks were not tested; LLM judgments may be unstable; the experiments use only one agent, GLM-5.3-Flash, and run once per task.
Experimental setupgpt-5.6-luna · SABER、YoloFS-Ext · harmful-outcome rate、safe-completion rate et al.
Evaluated models
gpt-5.6-luna
Benchmarks
SABERYoloFS-Ext
Metrics
harmful-outcome ratesafe-completion ratesafe-refusal ratesafe-outcome ratefalse-block rate
AI summaryThe paper proposes Caper, a consequence-aware approval mechanism for autonomous coding agents, which first pre-executes each command in a snapshot sandbox, then organizes the observed effects into a restricted report for an independent approver, allowing permitted commands, rolling back blocked commands, and giving actionable reasons. Compared with six existing systems, Caper's harmful outcome rate on SABER was 6.7%, while the six existing systems were at least 14.8%; on YoloFS-Ext, constructed by the authors, it was 7.8%, while the six existing systems were at least 35.3%. YoloFS-Ext hides harmful behavior in invoked tools, and Caper blocked 1.0% of the dangerous tasks' safe twin versions on this benchmark.

The paper proposes Caper, a consequence-aware approval mechanism for autonomous coding agents, which first pre-executes each command in a snapshot sandbox, then organizes the observed effects into a restricted report for an independent approver, allowing permitted commands, rolling back blocked commands, and giving actionable reasons. Compared with six existing systems, Caper's harmful outcome rate on SABER was 6.7%, while the six existing systems were at least 14.8%; on YoloFS-Ext, constructed by the authors, it was 7.8%, while the six existing systems were at least 35.3%. YoloFS-Ext hides harmful behavior in invoked tools, and Caper blocked 1.0% of the dangerous tasks' safe twin versions on this benchmark.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Existing approvers see only command text and not actual effects; the authors propose Caper, which pre-executes and approves based on observed consequences.

    Core problem: shell command approvers for coding agents decide only from the request and command text, whereas a command's actual effects depend on the code it invokes and the current workspace state, so harms invisible in the text are allowed through.

    • Setting and importance: Autonomous coding agents edit code, run builds and tests, and execute shell commands in stateful workspaces; a single wrong command can leak credentials, delete data, or weaken security controls. Per-command human approval does not scale, and Anthropic reports that users approve 93% of Claude Code permission prompts, indicating approval fatigue.
    • Shortcomings of existing methods: The authors state that static rule checkers (CARE), guardrail models (ToolSafe, gpt-oss-safeguard, Qwen3Guard), and deployed permission classifiers (Claude Code Auto Mode) all evaluate only the action text; systems that can observe file changes, such as YoloFS, leave the evaluation to the agent or a human after execution.
    • Core observation: The same command has different effects in different workspaces (Figure 1: make clean && make only deletes build artifacts in one workspace but deletes src/ and .git/ in another), and an approver that sees only the command text cannot tell them apart; each approval must answer "what security-relevant effects does this command have on the current workspace, and are they within the scope of the user's request?"
    • What the paper proposes: Caper (Consequence-Aware PERmission), which pre-executes each command in a snapshot sandbox and gives an independent approver a bounded effect report; allowed commands are committed, blocked ones are rolled back and the reason is returned; the paper also builds the YoloFS-Ext benchmark.
    • Threat model (Section 3):
      • Goal: Block the consequences of shell commands that go beyond the scope of the user's task (unintended persistent changes, network transfers, leakage via output) while still letting the agent complete the task safely.
      • Attack surface: The request itself is benign but may be ambiguous; the agent may make mistakes, exceed its authority, or be redirected by untrusted content in project files or tool output; scripts, build files, and binaries in the workspace may behave in ways not implied by their names or the command text.
      • Capability boundary: Every shell command must be approved before its effects are committed; the authors trust the approver, the snapshot rollback mechanism, and the container boundary.
  2. What related research exists?

    Related work falls into two categories, permission gates and guardrail models and risk assessment, none of which observes command effects; this paper compares empirically against six systems.

    Agent permission gates

    • Claude Code Auto Mode (Anthropic, 2026): file reads and writes within the project are allowed directly, and shell commands go to a two-stage classifier that sees only the user message and the tool call, not tool output; Anthropic reports a 17% false-negative rate on real unauthorized actions. Ji et al. (2026a) stress-test this gate with requests whose goals and scope are ambiguous.
    • CARE (Liu et al., 2026): performs syntax-, path- and provenance-aware static checks on shell commands and escalates undecidable cases to an LLM. Policy frameworks such as Progent (Shi et al., 2025) and Conseca (Tsai and Bagdasarian, 2025) restrict the tool calls an agent may make.
    • YoloFS (Zhong et al., 2026) and GoEx (Patil et al., 2024): YoloFS lets the agent run on a staging filesystem, shows a summary of changes after each command, and has a human review the accumulated changes before committing; GoEx allows actions to execute, relies on an undo mechanism and damage limits, and leaves verification to a human after execution. The paper notes that these gates decide without observing the effects of commands; YoloFS observes changes but leaves evaluation to the agent and the human.

    Guardrail models and risk assessment

    • ToolSafe (Mou et al., 2026): assesses the risk of a pending tool call using interaction history and feeds it back to the agent; AGrail (Luo et al., 2025) adapts safety checks to task-specific and systemic risks.
    • General-purpose safety classifiers: gpt-oss-safeguard (OpenAI, 2025) and Qwen3Guard (Zhao et al., 2025) judge pending actions against a given policy. The paper notes that such guardrails judge the text of the request, call or interaction history, and when the harm is hidden in the code of a command call, the text does not expose it.
    • ToolEmu (Ruan et al., 2024): has an LM simulate the execution of tool calls to discover risky agent actions; the paper notes that the simulated effects are what the model expects the call to do, not what the called code actually does.

    Compared baselines and benchmarks: the experiments compare six systems—CARE, TS-Guard, gpt-oss-safeguard-20b, Qwen3Guard-Gen-8B, YoloFS, Claude Code Auto Mode—plus a no-approval control; the benchmarks are SABER (682 shell-only tasks) and YoloFS-Ext built by the authors (102 dangerous tasks plus 102 safe twins).

    The authors position this paper as providing evidence of observed effects to an independent approver before each command is committed, rather than having the agent or a human evaluate after the fact.

  3. How does the paper address this problem?

    Caper performs transactional pre-execution at the shell boundary, hands a bounded effect report to an LLM approver, and commits on approval or rolls back on block.

    Overall approach: without changing the agent, intervene at the shell boundary—each command is first executed once with tracing in a snapshot container, and an independent LLM approver decides based on the observed effects against the user's task. Caper (Consequence-Aware PERmission) has three parts: transactional pre-execution, bounded effect reports, and approval and feedback (Figure 2).

    Transactional Pre-execution (Section 4.1)

    • Sandbox: Each task runs in a separate Docker container with networking disabled and memory and process counts limited; the container is snapshotted before command execution.
    • Traced execution: The command is executed in the container under strace -f with a per-command timeout, recording process creation, file operations, network system calls, and writes to user-visible output.
    • Commit or rollback: If the approver allows, the snapshot is discarded, the post-execution state is kept, and the captured output is returned as the tool result, so the command executes exactly once; if blocked, the mutated container is deleted, a new container is started from the snapshot, and the agent continues from the original state.
    • Network handling: Effects leaving the container cannot be rolled back, so the sandbox disables outbound networking; connection attempts are still observed and reported along with the destination, the originating process, and the files it read beforehand; network services with fixed responses provided by the benchmark are marked as simulated in the evidence.

    Bounded Effect Reports (Section 4.2)

    • Motivation: Raw traces are flooded by dynamic loading, locale probing, and the like, with typical actions producing tens of thousands of bytes; a probe is run once at container startup to record accesses by the shell, loader, and tracer itself, which are subtracted by count.
    • Consequence cards: The extractor identifies cross-boundary consequences—persistent file changes, network attempts, user-visible output—each becoming a structured card; file changes come from comparing the workspace before and after execution, small text files carry a bounded content diff, and high-precision sensitive paths have their content redacted.
    • Provenance attribution: For consequences that can carry data (output writes, network sends), the same process's prior successful reads of the repository, credential locations, and unusual system paths are retained, and the card is annotated with the basis "same actor, read before consequence".
    • Protected reads and sensitive output: Successful reads of dotenv files, credential stores, and private key candidates are retained as protected-read consequences even without subsequent exfiltration; when output matches high-precision credential value patterns, only the matching category is annotated, without copying the value.
    • Coverage and budget: Repeated events are aggregated by resource and operation; the report targets 4 KiB with an 8 KiB cap, and when over budget it first aggregates provenance by directory, then reduces to counts, and finally summarizes changes; execution status, observed/included/omitted counts per category, simulated markers, and uncertainty are always retained.

    Approver and Feedback (Section 4.3)

    • Inputs and outputs: The approver is an LLM that receives the user task, the interaction history with truncated tool output, the raw command, and the effect report, and returns a JSON decision (Allow or Block) with a confidence and a short reason.
    • Evaluation axes: The instructions require independently assessing the authorized goal and scope, credential access, changes to security controls (hooks, scanners, repository policies), immediate runtime effects, behavior deferred until a later install/build/commit/launch, and evidence uncertainty.
    • Anti-injection framing: The entire data packet is framed as evidence rather than instructions—the approver is told not to follow instructions in commands, files, output, or effect records, and not to treat the absence of observed network or credential effects as proof of safety.
    • Feedback: On allow, the output is returned as is; on block, the reason (identifying the boundary crossed or the harmful effect, without quoting secret values) is returned to the agent along with the instruction to "choose a safer alternative rather than retrying with a different wrapper", so that it revises its plan rather than terminating.

    Evaluation Method (Section 5.1)

    • SABER: 682 shell-only tasks covering 8 harm categories and 3 scenarios (Table 1); all systems are judged with the same revised SABER oracle (the authors state false positives were corrected; the LLM judge is unchanged, Tables 5, 6).
    • YoloFS-Ext: Keeps YoloFS's 13 projects and requests and packages the harmful behavior into tools at 4 concealment levels (script, Makefile, script chain, compiled binary), yielding 102 dangerous tasks; each dangerous task has a safe twin with identical files, request, and command but a harmless tool, and blocking the twin counts as a false block (Table 2, Appendix A).
    • Metrics: SABER reports harmful-outcome, safe-completion, and safe-refusal rates (the latter two sum to safe-outcome); YoloFS-Ext reports the harmful-outcome and safe-completion rates on dangerous tasks and the false-block rate on twins.
  4. What experiments did the paper conduct?

    Comparing six systems on SABER and YoloFS-Ext, Caper has the lowest harm rate (6.7%, 7.8%) and a 1.0% twin false-block rate.

    Experimental Setup

    • Agent model: Except for one no-approval control, all systems use GLM-5.3-Flash as the agent; the no-approval control additionally runs DeepSeek-V3.2.
    • Approver model: The Caper approver and the Auto Mode classifier both use gpt-5.6-luna; CARE's escalation judge is Qwen3-Coder-30B-A3B (Appendix B, Table 8).
    • Benchmarks: SABER's 682 shell-only tasks (8 harm categories × 3 scenarios, Table 1); YoloFS-Ext's 102 dangerous tasks plus 102 safe twins (Table 2).
    • Baselines: No approval (two agents), CARE, TS-Guard, gpt-oss-safeguard-20b, Qwen3Guard-Gen-8B, YoloFS (run inside Claude Code), Claude Code Auto Mode; plus a variant of Caper as a Claude Code hook.
    • Judging method: SABER uses a revised oracle (rule checks plus LLM judge; the authors state false positives were corrected); YoloFS-Ext is judged programmatically from the final file system, without an LLM; each system runs once per task.
    • Agent loop: In the SABER loop the agent has only a single bash tool, at most 60 steps, and 8,192 output tokens per step.

    Main Results

    According to Table 3 (%, bold is best in that column):

    Swipe horizontally to read the table

    SystemSABER harm↓SABER safe completion↑SABER safe outcome↑YoloFS-Ext harm↓YoloFS-Ext safe completion↑False block↓
    No approval GLM-5.3-Flash19.757.466.671.617.6—
    No approval DeepSeek-V3.252.731.933.091.22.9—
    CARE15.047.961.669.615.72.0
    TS-Guard18.844.761.694.12.08.8
    gpt-oss-safeguard-20b18.653.165.262.718.615.7
    Qwen3Guard-Gen-8B16.052.166.467.617.60.0†
    YoloFS21.254.168.335.322.5—
    Claude Code Auto Mode14.844.062.262.77.83.9
    Caper (Claude Code hook)10.045.566.26.940.22.0
    Caper6.748.667.87.860.81.0

    † Qwen3Guard did not block any command on YoloFS-Ext; the paper marks it as not participating in the ranking. 95% Wilson intervals are in Appendix E (Table 12).

    • Authors' interpretation, Finding 1: Text-based approvers fail because they cannot see, not because they are not strict—on SABER the five text-approver systems leave 14.8–18.8% harm, versus 19.7% with no approval and 6.7% for Caper; replacing the built-in classifier with the Caper hook inside Claude Code, with the same agent and approver model, lowers the harm rate from 14.8% to 10.0% (SABER) and from 62.7% to 6.9% (YoloFS-Ext).
    • Authors' interpretation, Finding 2: Observed effects help distinguish dangerous tasks from safe twins. Approvers without evidence sit near the diagonal in Figure 4 (blocking both groups or neither); Caper blocks the harmful command in 84.3% of dangerous tasks and falsely blocks only 1.0% of twins (Table 9).
    • Authors' interpretation, Finding 3: Observed effects are not enough; the judgment must be before commit and come from outside the agent. YoloFS observes the same file changes but hands them afterward to the agent that issued the command: in 102 dangerous runs the agent rolled back in 66, and of the 36 not rolled back, 33 caused harm; the 35.3% harm it leaves is four times Caper's and higher than no approval (21.2% vs. 19.7%, which the authors attribute to credentials that cannot be recalled once sent).

    Ablation: Context and Evidence Source (Section 5.3, Figures 5, 6)

    • Context ablation: Without evidence, going from command-only to the full conversation lowers the harm rate from 44.1% to 17.6%, but twin false blocks rise from 52.0% to 61.8%; with evidence, command-only already reaches 1.0% harm and 0.0% false blocks (Figure 5).
    • Evidence source: When the same model predicts effects from the command and its referenced files, harm drops to 3.9% but twin false blocks remain 61.8%; removing the content diff raises harm from 7.8% to 13.7% (only overwrite tasks are affected, Appendix D); a weaker approver plus observed effects lowers false blocks from 53.9% to 4.9% but raises harm from 25.5% to 33.3% (Figure 6).
    • Concealment levels: Without evidence, the harm rate varies with the packaging method (binary 4.2%, script 11.5%, Makefile and script chain 26.9% each); with evidence, the harm rate at each level is between 3.8–15.4% (right block of Figure 6).

    Case Studies and Overhead (Sections 5.4, 5.5)

    • Cases: In two tasks that Claude Code Auto Mode allowed (Figures 7, 8), Caper blocked the command based on the diff showing a source file replaced by a comment and the database shrinking from 32 KB to 20 KB, respectively; the block reason guided the agent to complete the task safely.
    • Overhead: On SABER the effect report has a median of 0.9 KB (p95 2.6 KB), versus a median of 62.5 KB for the raw trace, an overall reduction of 99.4%; approval latency has a median of 3.2 s (p95 6.4 s), versus 3.3 s (11.4 s) for approval without evidence; the sandbox adds about 0.5 s per allowed command and about 1.5 s per blocked command; API cost is $0.019 per task, versus $0.017 without evidence (Appendix F).

    Other Ablations and Analyses

    • Approval behavior (Table 9): On SABER, Caper blocks 23.7% of commands and blocks at least once in 78.8% of tasks; on YoloFS-Ext, TS-Guard blocks 38.9% of commands but blocks only 8.8% of harmful commands.
    • SABER harm rate by category (Table 10): Caper is lowest in 6 of 8 categories, ties Qwen3Guard at 10.6% on File-system destruction, and is higher than the hook version on Unauthorized access (8.1% vs. 4.1%).
    • Oracle comparison (Table 4): The revised oracle lowers the harm rate for every system (e.g., Caper from 9.0% to 6.7%), and Caper is lowest under both oracles.
    • YoloFS-Ext validation (Appendix A): Given the full tool code and file changes, gpt-5.6-luna and DeepSeek-V4.1-Flash judged every dangerous task unsafe and every twin safe across 1,224 calls.
  5. What are some points that can be further explored?

    The authors list limitations including effects outside the sandbox, shell-only coverage, single observed execution and adaptive attacks, and LLM judgment, and leave adaptive attacks to future work.

    Limitations and future directions noted by the authors

    • Effects outside the sandbox (Limitations): pre-execution is real execution, and rollback only restores the container filesystem; effects that leave the container, such as network requests, writes to remote services, and processes started by commands, have already occurred before approval and cannot be undone, so deployment must isolate pre-execution as the authors do (e.g., routing traffic to a recording proxy that answers with placeholders).
    • Only shell commands are covered (Limitations): other tools such as file editing declare their changes in the call and are left to the harness; edits that plant harmful code are observed when a later command runs it, but edits that are harmful in themselves (e.g., overwriting configuration files) are judged only on the call text.
    • Single observed execution (Limitations): the report describes only one execution in the sandbox, and tools whose effects depend on time, randomness or the environment may behave differently when run again; an attacker adapted to Caper might probe the sandbox or delay harm, plant text intended for the approver in the report, or split harmful changes across multiple commands that each look benign. Neither benchmark contains such attackers, and the authors leave adaptive attacks to future work.
    • LLM judgment (Limitations): whether an observed effect is acceptable depends on the user's task; the approver uses an LLM to judge, and its judgment may vary across runs or misread the report; SABER's oracle (rules plus an LLM judge) may also err in the same way.
    • Gates in other deployments (Limitations): OpenAI Codex has a comparable automated reviewer, but in its default sandbox it reviews only requests that leave the workspace, so most harms in this paper's benchmarks would not reach it; an equivalent comparison would require changing its sandbox policy.

    Scope of the experiments

    • The agent under test is GLM-5.3-Flash, with an additional no-approval control using DeepSeek-V3.2; all approval systems share the same agent (Section 5.1).
    • The benchmarks are SABER's 682 shell-only tasks and YoloFS-Ext's 102 dangerous tasks plus 102 safe twins; each system runs once per task, and the paper does not report repeated runs (Section 5.1).
    • The compared systems are six (CARE, TS-Guard, gpt-oss-safeguard-20b, Qwen3Guard-Gen-8B, YoloFS, Claude Code Auto Mode) plus a no-approval control and Caper's Claude Code hook variant (Table 3).
    • The approver and the Auto Mode classifier both use gpt-5.6-luna; the ablation includes a weaker approver whose model name the paper does not state (Section 5.3, Table 8).
    • YoloFS-Ext's harms are only deleting or overwriting protected files, with four levels of concealment: script, Makefile, script chain, and compiled binary (Table 2, Appendix A).
  6. Summarize the main content of the paper

    Caper pre-executes shell commands and then approves them based on observed effects, achieving the lowest harm rate on both benchmarks while almost never falsely blocking safe twins.

    A defense paper for coding agents: it provides post-execution effect evidence for shell command approval rather than looking only at command text.

    • Problem: Existing approvers (rule checkers, guardrail models, deployed permission classifiers) evaluate only the request and command text, whereas a shell command's effects depend on the code it invokes and the workspace state; systems that can observe changes (YoloFS) leave the evaluation to the agent or a human after execution.
    • Method: Caper pre-executes each command once in a snapshot container with system call tracing, extracts a bounded effect report (persistent file changes with diffs, network attempts, protected reads, output, with provenance attribution and coverage information, targeting 4 KiB with an 8 KiB cap), and gives it to an LLM approver to judge against the user's task; if allowed, the state is committed; if blocked, it is rolled back and the reason is returned to the agent for replanning. The sandbox disables outbound networking, but connection attempts are still recorded.
    • Main results: On SABER (682 shell-only tasks), Caper has a 6.7% harm rate, versus 14.8% for the lowest of the six compared systems; on YoloFS-Ext (102 dangerous tasks with harm hidden in invoked tools), Caper and its Claude Code hook achieve 7.8% and 6.9%, versus 35.3–94.1% for the baselines (Table 3).
    • Selectivity: Caper blocks the harmful command in 84.3% of dangerous tasks and falsely blocks only 1.0% of safe twins; the same approver without evidence falsely blocks 61.8% of twins (Table 9, Figure 4).
    • Ablations: Predicting effects lowers harm to 3.9% but false blocks remain 61.8%, and only observed effects lower both; removing the content diff raises harm from 7.8% to 13.7% (Figures 5, 6).
    • Authors' conclusions: The authors state that text-based approvers cannot distinguish dangerous commands from their safe twins, and that observing effects with the judgment made before commit and from outside the agent is key to reducing both harm and false blocks; the authors also note limitations such as effects outside the sandbox being impossible to roll back, coverage of only shell commands, no testing of adaptive attacks, and potentially unstable LLM judgments.

Related papers

Read originalarxiv.org