Repository navigation
fix(agents): silently retry unfinished-step turns before surfacing them to the user (ENG-18893) - #188
Conversation
…em to the user (ENG-18893) A turn that ends with a real reply but a recoverable exec-class tool failure (payloads.ts's isNonTerminalWarning) today surfaces "N steps didn't finish" plus a manual Retry button and stops — the user has to click it or type /retry themselves. Reuses /retry's own proven nudge text to silently retry the same turn internally, bounded to 2 attempts (matching booneval's own nudge cap), before ever falling through to the user-visible note.
…try (ENG-18893) Exercises runEmbeddedAgent end-to-end via the existing overflow-compaction harness: confirms a turn tagged nonTerminalToolErrorWarning silently retries with RETRY_NUDGE_TEXT and, once the 2-attempt budget is exhausted, falls through unchanged. Doubles as the local reproduction recipe for this fix — run via: node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.incomplete-turn.test.ts
… (ENG-18893) Code review caught two real gaps in the new silent retry: 1. shouldRetryUnfinishedSteps never checked hadPotentialSideEffects, unlike every sibling retry-safety check in this file and the adjacent compaction-continuation gate. A turn that already sent a message, added a cron job, or spawned a session before a later exec-class call failed non-terminally would still get auto-retried with 'redo it' — risking the model replaying an already-successful mutation with no human in the loop to catch the duplicate the way a manual Retry click would. 2. reasoningOnlyRetryInstruction/emptyResponseRetryInstruction were never reset when a different retry branch fired, unlike compactionContinuationRetryInstruction (and the new unfinishedStepsRetryInstruction) which already reset themselves. A stale instruction from an earlier iteration could get concatenated into a later attempt's prompt alongside an unrelated retry's nudge text. Fixed by resetting all four together at the point where none of the earlier branches fired this iteration. Both closed with new unit + full-loop coverage.
hadPotentialSideEffects is already a strict boolean; the === true comparison tripped oxlint's no-unnecessary-boolean-literal-compare rule.
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
Approving — LGTM ✅
Silent-retry on nonTerminalToolErrorWarning payloads is a clean parallel to the existing reasoning-only / empty-response / compaction-continuation branches, and the shape is right:
Safety guards match every sibling in this file. The three abort conditions plus hadPotentialSideEffects (populated from buildAttemptReplayMetadata — messaging sends, cron adds, session spawns, unsafe/async tool activity) all short-circuit before the retry fires. Re-prompting "redo it" after a mutation already landed is exactly the trap; the guard prevents it and the dedicated test (never auto-retries unfinished steps after a messaging-tool send already landed) exercises the messaging-send arm.
Bound = 2 matches booneval nudge.max: 2, so prod recovery ceiling is now the same as CI regression. Good call to source it from the same proven cap rather than pick a fresh number.
The four-way retry-instruction reset (run.ts:3907–3910) is a real drive-by fix, not just cleanup. Before this change, reasoningOnlyRetryInstruction / emptyResponseRetryInstruction could leak into a later iteration's prompt if a different branch fired next; adding unfinishedStepsRetryInstruction without the reset would have inherited that pre-existing gap. Placing the clear after the three continue branches (so it never clobbers a just-set instruction) and before the new gate is correct — verified by reading the diff in place.
Test coverage is thorough: 4 pure-helper cases (happy path budget-exhaust, no-warning short-circuit, all three abort arms, side-effect arm) + 3 end-to-end (silent retry + eventual success, budget-exhausted fall-through, side-effect no-retry). 118/118 vitest green on the pure helper. The setReplyPayloadMetadata module-reset comment is a useful landmine defused for future editors.
Live-verified against real Anthropic per PR body — the two retrying 1/2 / retrying 2/2 warn lines land before the user-visible note when the budget is genuinely exhausted, matching the log-format sibling in the reasoning-only branch.
Ship it.
…193) Cuts the next boon-fork release. On merge, tag v2026.6.11-boon.36 -> boon-release.yml builds & publishes openclaw-2026.6.11-boon.36.tgz (+ sibling plugin assets) -> the fleet deploy pipeline rolls it. Ships ENG-18893: the embedded run loop now silently retries a turn that ends with a real reply but an unrecovered exec-class tool failure (#188), with the retry guard corrected to key off actual committed mutations rather than the mere presence of an exec-class tool call (#192). Diff is mechanical pnpm release:prep output plus the CHANGELOG.md release section: - Root package.json boon.35 -> boon.36. - Lockstep extension package.json + npm-shrinkwrap.json synced to boon.36. - Regenerated release artifacts: plugin inventory/reference docs, plugin-sdk API baseline, config-baseline sha256. npm pack --dry-run verified end to end (build + changelog extraction + tarball assembly), version 2026.6.11-boon.36, exit 0.
What Problem This Solves
Today, when a Boon Agent turn produces a real reply but a recoverable exec-class tool call didn't cleanly resolve, the turn ends with "N steps didn't finish (... completed): — . The reply may be incomplete — ask me to redo it if something looks off." plus a manual "Retry" button, and just stops. The user has to notice, click Retry (or type
/retry), and wait through another full turn themselves — on live customer calls this reportedly happens at least once per session (Arief, ENG-18893).Why This Change Was Made
The recovery text already exists and is proven:
/retry(src/auto-reply/reply/commands-retry.ts) just re-sends"Please look at what didn't finish in your last reply and redo it."as a new turn, and booneval's own CI regression harness (eval/agent-regression) already auto-sends this exact nudge up to 2 times to get scenarios green — production has no equivalent, so the same self-fixable stall that CI silently recovers from reaches the user instead.This change moves that proven recovery inside the harness itself:
run.ts's existing internal silent-retry loop (the same one already used for empty-response, reasoning-only, and compaction-interrupted turns) now also retries whenpayloads.tsclassifies the turn as a non-terminal tool-error warning (isReplyPayloadNonTerminalToolErrorWarning) — i.e. exactly the condition that produces today's "N steps didn't finish" note. Bounded to 2 attempts, matching booneval's own cap, and skipped for aborted/externally-aborted/timed-out attempts and for any attempt that already had potential side effects (a messaging-tool send, cron add, or session spawn) — re-prompting "redo it" after a real mutation already landed risks the model replaying it, with no human in the loop to catch a duplicate. When the retry succeeds, the user never sees a stall at all; when it doesn't, today's note + Retry button still fires unchanged as the fallback.The decision logic is extracted as a small pure helper (
shouldRetryUnfinishedStepsinrun/incomplete-turn.ts) alongside its siblings, per this directory's own guidance to keep the expensiverun.tsintegration surface thin and push decisions into unit-testable helpers.Fixed during review (self-reviewed with
code-reviewbefore requesting sign-off):hadPotentialSideEffectsguard described above — missed in the first pass despite every sibling retry-safety check in this file enforcing it.reasoningOnlyRetryInstruction/emptyResponseRetryInstructionwere never reset when a different retry branch fired (a pre-existing gap this PR's new branch could also trigger) — now all four retry-instruction variables reset together at the same point.=== trueboolean comparison the linter flagged.User Impact
Applies to every channel (Slack, Teams, webapp, etc.) since the fix lives in the shared core run loop, not a per-channel surface. A turn that hits a self-fixable partial tool failure now silently finishes instead of stopping and waiting for the user to click Retry — no visible change when the retry succeeds; identical behavior to today when the retry budget is exhausted or a mutation already landed.
Evidence
boon-technologies-inc.slack.com/archives/C0B8WQ4B91N/p1788193028181899→ live webapp threadapp.getboon.ai/agent/thread/1361(real exec trace showing an unfinished-steps stall) → root cause partly filed as ENG-19208; this PR addresses ENG-18893 (Gemstone Industrial, "23 of 25 tools succeeded" / "one step didn't finish" reported on every live call).node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo— clean.node scripts/run-oxlint-shards.mjs --threads=8— clean.node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.incomplete-turn.test.ts— 118/118 passed (unit coverage forshouldRetryUnfinishedStepsincluding the side-effect guard, plus full-looprunEmbeddedAgentcoverage), verified pre- and post-rebase onto latestorigin/boon.claude-sonnet-4-6) via a local embedded-agent CLI run: forced a persistent non-terminalexecfailure and observed two silent internal retries (unfinished steps detected: ... retrying 1/2,... retrying 2/2) before falling through to the expected user-visible note once the budget was genuinely exhausted.Supersedes #183, which got stuck in a GitHub-side desync after a force-push (
head.shawouldn't advance past an earlier commit, and re-closing/reopening was rejected with "state cannot be changed... branch was force-pushed or recreated") — no code was lost, all commits carried over to this PR from the same branch.Linear: https://linear.app/getboon/issue/ENG-18893/gemstone-industrial-proposal-generation-generic-one-step-didnt-finish
Summary by cubic
Silently retries turns that end with a real reply but a recoverable tool failure, so users no longer see the "N steps didn't finish" message and have to click Retry manually. Addresses ENG-18893 by adding automatic retry for transient failures.
/retry's existing nudge text to re-run the turn internally, bounded to 2 attempts to match booneval's regression harness.Written for commit a42da08. Summary will update on new commits.