Repository navigation
fix(agent): suppress stale tool-error surface on sessions_yield handoff (ENG-19495) - #203
Conversation
…off (ENG-19495) A turn that ends via sessions_yield to a spawned subagent produces no reply this dispatch (the subagent answers later). buildEmbeddedRunPayloads' tool-failure fallback treated that as 'no reply -> surface the last tool error', turning an incidental earlier failure into a false 'couldn't complete a step' message on a working turn. Gate the fallback on yieldDetected && hasAcceptedSessionSpawn — narrow: a plain yield-to-wait or a genuine dead-end still surfaces its error unchanged. Part 1 of 3; all channels. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
I'll analyze this and get back to you. |
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Accepted tradeoff (R2) — reviewer-flagged, owner-signed-offOn a yield-with-spawn turn (both This is deliberate and narrow:
Observability is preserved — the drop is only customer-facing, not engineering-facing. This PR does not touch the telemetry path: failed tool calls are still captured by the fleet The durable fix for the rare genuine case (if a frequency query later shows it matters) is defer-and-re-surface via the continuation, not un-gating — tracked as future work; not in Part 1 scope. |
…/eng-19495-stale-tool-error-on-sessions-yield
- resolveToolErrorWarningPolicy: 'These two' overrides -> 'These' (yieldHandoff makes it three). - AC1 test: make the runAborted=false comment precise (yield forces false + strips its synthetic aborted turn) so it can't misread as 'yields are never aborted'. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…/eng-19495-stale-tool-error-on-sessions-yield
There was a problem hiding this comment.
Approved. Narrow gate (yieldDetected && hasAcceptedSessionSpawn) at the right layer — resolveToolErrorWarningPolicy turn-wide override, so the digest builder inherits it via showWarning=false (no divergence risk). Fails open on === true. AC1 repro + both narrow-gate guards (yield-without-spawn, spawn-without-yield) landed and stay RED without the fix. Ran the test file locally: 154/154 green. run.ts funnel = all channels; errorText path untouched. Comment/copy nits from cubic addressed in 11bcebb. Ship it. 🧙

What
A turn that ends via
sessions_yieldto a spawned subagent produces no reply this dispatch (the subagent answers later).buildEmbeddedRunPayloads' tool-failure fallback treated that as "no reply → surface the last tool error", turning an incidental earlier failure into a false "I couldn't complete one of the steps for this turn" + Retry message.Live incident: Bass Concrete, thread 2445 — the agent had actually succeeded and delivered a correct concrete-scope PDF diff ~4 min later; the customer saw a hard failure + Retry buttons during the wait and retried twice. (ENG-19495, P1)
Fix
Gate the tool-failure fallback (via
resolveToolErrorWarningPolicy's existing turn-wide suppression) onyieldHandoff = yieldDetected && hasAcceptedSessionSpawn(...), wired from the singlerun.tscall site.=== trueon both flags — an absent/unknown flag surfaces the error (never hides a real failure).run.tsis the single funnel. TheerrorText(provider/timeout/402) path and every other caller are untouched.Scope
Part 1 of a 3-part design (full spec on the ticket). Part 1 is the reliability fix — it removes the false "couldn't complete a step" message. On Boon Web a milder, non-wedging
no_visible_payloadrow remains; Parts 2 & 3 (true silence) are deferred.Tests
payloads.errors.test.ts: AC1 reproduction (yield+spawn+stale error → no payload; RED→GREEN) + two AC2 narrow-gate guards (yield-without-spawn and spawn-without-yield both still surface). AC3 (provider/timeout error path) covered by pre-existing tests. Deterministic green (154/154 ×3);tsgo+oxlintclean.🤖 Generated with Claude Code
Summary by cubic
Stops
buildEmbeddedRunPayloadsfrom surfacing a stale tool error on turns that end viasessions_yieldto a spawned subagent (ENG-19495). Previously the tool-failure fallback turned an incidental earlier failure into a false "couldn't complete one of the steps" message, even though the subagent delivered the real answer minutes later (Bass Concrete thread 2445).Bug Fixes
yieldDetected && hasAcceptedSessionSpawn, so only a yield with a spawned continuation suppresses the error.run.tsis the single funnel; the provider/timeout/402 error path is untouched.Written for commit b4c8484. Summary will update on new commits.