Skip to content

fix(runtime): deny the whole family of tools that promise a second turn (#2468) - #2472

Closed
dolho wants to merge 1 commit into
devfrom
fix/2468-headless-tool-audit
Closed

dolho wants to merge 1 commit into
devfrom
fix/2468-headless-tool-audit

Conversation

@dolho

@dolho dolho commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What

#2454 removed ScheduleWakeup. It was one member of a family, and the rest make the same false promise: a Trinity execution is one claude --print process that exits when the model stops writing, so any tool result asserting a later event is a lie the model plans around and then reports success for.

Fixes 1 and 5 of the issue already shipped in #2458 (ScheduleWakeup denied at both spawn sites via merged_disallowed_tools, operator guardrails preserved). This PR is fixes 2 (the audit) and 3 (the prompt counterweight).

The audit (AC 4)

Every tool offered on the headless path was read out of a live run by its own description (ToolSearch select:..., claude 2.1.220) rather than judged by name — and the names mislead in both directions.

Denied, each with the verbatim fragment that decided it, recorded beside the entry in _runtime_config.py:

Tool Its own words
Workflow "returns immediately with a task ID, and a <task-notification> arrives when the workflow completes"
Monitor "a background monitor … notifications arrive in the chat"
TaskOutput "DEPRECATED: … you receive a <task-notification> with the same path when the task completes"
CronCreate "Schedule a prompt to be enqueued at a future time"
CronList "jobs scheduled via CronCreate in this session" — a store that is always empty here
CronDelete goes with the pair above
SendMessage "Send a message to another agent … Teammate by name" — no peers exist in a container
PushNotification "sends a desktop notification in the user's terminal" — no terminal, nobody attached
RemoteTrigger "Call the claude.ai remote-trigger API … the OAuth token is added automatically" — work on an external control plane, outliving the turn, invisible to Trinity

Kept, recorded with reasons, because half an audit's value is the decisions that produce no diff:

  • TaskCreate / TaskGet / TaskList / TaskUpdate — these read like the background-task registry and are in fact the in-turn task list ("create a structured task list for your current coding session"). Denying them would have removed ordinary bookkeeping for nothing.
  • TaskStop — acts only within the turn, and is the one way to stop a runaway background command the model itself started.
  • Bash — cannot be denied; it is why fix 3 exists.
  • DesignSync — noted, not swept up: it reaches an external control plane like RemoteTrigger, but makes no future-work promise, so it is outside this issue's frame. Flagged rather than silently included.

Stated rather than hidden: with Monitor gone, in-turn waiting is foreground-only inside the execution timeout. That is the intended behaviour for a one-shot run and is what the prompt now says — but if a future change makes in-turn waiting necessary, revisit Monitor rather than working around it.

The counterweight (fix 3)

The one promise Trinity cannot delete is Bash's own — backgrounding answers "You will be notified when it completes" (verbatim, both the run_in_background and timeout-promotion variants), and no tool description can correct a different tool's description.

So PLATFORM_INSTRUCTIONS gains "Nothing survives the end of your turn": the work is killed, not merely unwatched; run in the foreground to completion; never end a turn with work outstanding or report success for something you only started; if it cannot fit, do a bounded piece, persist it, and arm set_reminder, which fires a real execution. Always-tier — it corrects another tool's text, so there is no description to fall back to.

Backend-side, so it reaches the fleet with no image rebuild. The deny half needs one.

Verified live, not asserted

A real headless invocation in an agent container:

init tool count: 19          (was 29 before #2454, 28 after)
denied tools still offered:  NONE
core still offered:          Bash, Edit, Read, Skill, Task, TaskCreate, TaskList, ToolSearch, Write
result: success

A correction to AC 2

(a --disallowedTools denial surfaces as a visible tool error in the transcript, which satisfies this)

Measured: it does not. --disallowedTools removes the tool from the advertised set rather than denying the call. Asked to call ScheduleWakeup under the deny, the model answers "No tool named ScheduleWakeup exists" — so a deny leaves an absence in the transcript, not a refusal.

That is stronger than the AC hoped for — the false belief is never formed at all — but it is not what the AC described, so a reviewer should not go looking for an error line. Version measured: claude 2.1.220 (the issue measured 2.1.235).

Guards

tests/unit/test_2468_headless_tool_audit.py (17 tests) pins the discipline, not the membership:

  • every denied tool must carry its reason in the source, so the list cannot grow on suspicion;
  • the audit must still quote the tools' own words;
  • the kept tools must stay named;
  • a parametrized guard fails if any core tool is ever added — over-denying is how this change breaks an agent, and it breaks it silently at spawn.

Five mutations confirmed red then reverted: deny Bash · add a name with no recorded reason · shrink back to ScheduleWakeup alone · drop the quoted promise from the counterweight · make the counterweight tier-droppable.

593 tests pass across the prompt / runtime-config / guardrails / codex suites.

Learnings entry added: audit a hosted runtime's built-ins by their descriptions, since the name lies in both directions.

Fixes #2468

#2454 removed `ScheduleWakeup`. It was one member of a family, and the
remaining members make the same false promise: a Trinity execution is one
`claude --print` process that exits when the model stops writing, so any tool
result asserting a later event is a lie the model then plans around and reports
success for.

Every tool offered on the headless path was read out of a LIVE run by its own
description (`ToolSearch select:...`, claude 2.1.220) rather than judged by
name — and the names mislead in both directions. Denied, with the verbatim
fragment that decided it recorded beside each entry:

  Workflow      "returns immediately with a task ID, and a <task-notification>
                arrives when the workflow completes"
  Monitor       "a background monitor ... notifications arrive in the chat"
  TaskOutput    "DEPRECATED: ... you receive a <task-notification> with the
                same path when the task completes"
  CronCreate    "Schedule a prompt to be enqueued at a future time" (+ CronList
                "scheduled via CronCreate in this session", + CronDelete)
  SendMessage   "Send a message to another agent ... Teammate by name"
  PushNotification  "sends a desktop notification in the user's terminal"
  RemoteTrigger "Call the claude.ai remote-trigger API ... the OAuth token is
                added automatically" — work on an external control plane,
                outliving the turn, invisible to Trinity

KEPT, recorded with reasons because half an audit's value is the decisions that
produce no diff: `TaskCreate`/`TaskGet`/`TaskList`/`TaskUpdate` read like the
background-task registry and are in fact the in-turn TASK LIST; `TaskStop` acts
only within the turn and is the one way to stop a runaway background command;
`Bash` cannot be denied. `DesignSync` is NOTED, not swept up — it reaches an
external control plane like RemoteTrigger but makes no future-work promise, so
it is outside this issue's frame.

The promise Trinity cannot delete is `Bash`'s own: backgrounding answers "You
will be notified when it completes" (verbatim, both the `run_in_background` and
timeout-promotion variants), and no tool description can correct a DIFFERENT
tool's description. So `PLATFORM_INSTRUCTIONS` gains "Nothing survives the end
of your turn" — the work is KILLED, not merely unwatched; run in the foreground
to completion; never end a turn with work outstanding; if it cannot fit, do a
bounded piece, persist it, and arm `set_reminder`, which fires a real
execution. Always-tier, since it corrects another tool's text and so has no
description to fall back to. Backend-side, so it reaches the fleet with no
image rebuild — the deny half needs one.

Verified live in a real headless invocation rather than asserted: the init tool
list goes 29 -> 19, none of the ten denied tools is offered, every core tool
(Bash/Read/Write/Edit/Task/TaskCreate/TaskList/Skill/ToolSearch) is still
there, and the run succeeds.

One correction to the issue's AC 2, worth stating because it shapes what a
reviewer should expect: `--disallowedTools` REMOVES the tool from the
advertised set rather than denying the call. Measured — asked to call
ScheduleWakeup, the model answers "No tool named ScheduleWakeup exists". So a
deny leaves an ABSENCE in the transcript, not a visible tool error. That is
stronger than the AC hoped for (the false belief is never formed) but it is not
what the AC described.

tests/unit/test_2468_headless_tool_audit.py pins the discipline rather than the
membership: every denied tool must carry its reason in the source (so the list
cannot grow on suspicion), the audit must still quote the tools' own words, the
kept tools must stay named, and a parametrized guard fails if any core tool is
ever added — over-denying is how this change breaks an agent, and it would
break it silently at spawn. Five mutations confirmed red then reverted: deny
`Bash`; add a name with no reason; shrink back to `ScheduleWakeup` alone; drop
the quoted promise from the counterweight; make the counterweight
tier-droppable.

Fixes #2468
@dolho dolho closed this Sep 1, 2026
vybe pushed a commit that referenced this pull request Sep 2, 2026
…red on the fleet CLI (#2468) (#2476)

ScheduleWakeup (#2454) was one member of a family: in a one-shot
`claude --print` execution, any tool result asserting a later event — a
wakeup, cron fire, workflow notification, peer message, desktop
notification — is a false fact the model plans around and then reports
success for (#2467 is the measured incident shape).

Fixes 2+3 of the issue (fixes 1+5 shipped in #2458), redone from closed
reference PR #2472 with the audit re-measured on claude 2.1.235 — the
CLI the fleet image actually ships. The re-measurement changed one
membership (ListAgents added; #2472 left it unclassified) and rewrote
two rationales (SendMessage: 2.1.235 gained a working in-turn
subagent-continuation facet, so the deny now stands on the unaudited
cross-execution channel between concurrent turns sharing one container
HOME; Monitor: its own text routes single waits to Bash-until anyway).

- PLATFORM_DENIED_TOOLS 1 → 11, every entry with its deciding
  description fragment quoted verbatim beside it (2.1.235-verified)
- KEPT becomes data: PLATFORM_KEPT_TOOLS (19, reasons in prose) +
  AUDIT_CLI_VERSION; DENIED ∪ KEPT exactly covers the measured init
  list (test-pinned), and scripts/dev/audit_headless_tools.py is the
  one-command re-audit for the next CLI bump (a deny of an unknown
  name is a silent no-op, and no PR workflow builds the base image)
- Always-tier prompt section "Nothing survives the end of your turn":
  counterweight for Bash's own un-deniable "You will be notified when
  it completes"; truth-scoped (subagents are waited; resumable
  surfaces get later turns) and names the working wait idiom, since
  Bash blocks long sleeps and routes polling to the denied Monitor
- Family paragraph phrased as capability fact, true on both sides of
  the image cut (the prompt reaches the fleet before the image does)
- 34 tests incl. exact-cover snapshot, reverse vocabulary guard, CORE
  never-denied; 4 mutations confirmed red; live-verified end to end
  (probe CLEAN: 19 built-ins offered; AC-2 absence semantics; the
  E2E incident shape now REFUSED by the model, clean turn_integrity)

Agent-side deny needs base-image rebuild + fleet cold recreate; the
prompt half reaches the fleet on backend deploy alone.

Fixes #2468

Co-authored-by: Claude Fable 5 <[email protected]>
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.

1 participant