Skip to content

fix(hook-kit): repair agent-spawn model injection and gate high-tier spawns - #316

Merged
DrumRobot merged 2 commits into
next-featfrom
fix/hook-kit-agent-spawn-gates
Aug 16, 2026
Merged

fix(hook-kit): repair agent-spawn model injection and gate high-tier spawns#316
DrumRobot merged 2 commits into
next-featfrom
fix/hook-kit-agent-spawn-gates

Conversation

@DrumRobot

Copy link
Copy Markdown
Member

Two fixes to block-agent-spawn-without-model.sh, split so the bug fix is cherry-pickable independently of the new policy gate.

Changes

fix(hook-kit) — preserve tool input when injecting the default model

Gate A emitted updatedInput: { model: "sonnet" }, but updatedInput REPLACES the tool input wholesale rather than being merged into it. Every spawn without an explicit model therefore lost description / prompt / subagent_type and died on schema validation with "The required parameter description is missing".

The gate was meant to make model-less spawns cheap, not impossible — it turned them into a hard failure, and the only workaround was to always pass model explicitly, which defeats the default. Now echoes the caller's own tool_input back with just model added.

fix(hook-kit) — gate opus/fable spawns on explicit user approval

Gate A only fires when model is absent, so it said nothing about a spawn that explicitly asks for an expensive tier. Choosing WHAT work to run and approving WHICH TIER runs it are separate axes; collapsing them is what produced an unapproved high-tier spawn after a work item was selected and the selection was read as tier consent.

Gate C blocks opus / fable unless the prompt carries [tier-approved], or an AskUserQuestion tool_use appears in the current turn. The turn window is computed the same way edit-guard.sh does it, and an AskUserQuestion answer arrives as a tool_result rather than a user string, so the ask stays inside the window. sonnet / haiku spawns and the Gate A default path are unaffected.

Test plan

  • Model-less spawn now yields the full input plus model: sonnet (was: schema-validation failure)
  • Explicit model still emits nothing (no injection)
  • Gate B unchanged — missing run_in_background still exits 2
  • Gate C: opus and fable without approval exit 2; [tier-approved] passes; an in-turn ask passes; sonnet unaffected
  • bash -n clean; full pre-push suite green (24 tests) on push

Gate A emitted `updatedInput: { model: "sonnet" }`, but updatedInput REPLACES
the tool input wholesale rather than being merged into it. Every spawn without
an explicit model therefore lost description / prompt / subagent_type and died
on schema validation with "The required parameter `description` is missing".

The gate was meant to make model-less spawns cheap, not impossible — it turned
them into a hard failure, and the only workaround was to always pass `model`
explicitly, which defeats the default.

Echo the caller's own tool_input back with just `model` added.
Gate A only fires when `model` is absent, so it says nothing about a spawn that
explicitly asks for an expensive tier. Choosing WHAT work to run (a next-action
option) and approving WHICH TIER runs it are separate axes; collapsing them is
what produced an unapproved fable spawn after the user merely picked a
"Delegate to Fable" work item and the selection was read as tier consent.

Add Gate C: a spawn with model opus/fable is blocked unless the prompt carries
[tier-approved], or an AskUserQuestion tool_use appears in the current turn
(evidence the user was actually consulted). The turn window is computed the
same way edit-guard.sh does it, and an AskUserQuestion answer arrives as a
tool_result rather than a user string, so the ask stays inside the window.

sonnet/haiku spawns and the Gate A default path are unaffected.
@DrumRobot
DrumRobot marked this pull request as ready for review August 15, 2026 13:51
@DrumRobot
DrumRobot merged commit 8972cd9 into next-feat Aug 16, 2026
2 checks passed
@DrumRobot
DrumRobot deleted the fix/hook-kit-agent-spawn-gates branch August 16, 2026 04:12
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