Repository navigation
fix(agents): silently retry unfinished-step turns before surfacing them to the user (ENG-18893) - #183
Closed
convyusboy wants to merge 3 commits into
Conversation
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
Approved.
- ENG-18893 acceptance criteria all met: real-reply turns with a non-terminal exec-class tool failure now silently retry (bounded to 2, matches booneval's own
nudge.max: 2); aborted / external-abort / timed-out attempts are correctly excluded; when the budget is exhausted, today's "N steps didn't finish" note + Retry button still fire unchanged as the fallback. - Decision helper
shouldRetryUnfinishedStepsis properly extracted torun/incomplete-turn.tsalongside its siblings, per that directory's guidance to keeprun.tsthin. - Integration point in
run.tssits cleanly after the compaction-continuation guard and before the reasoning-only-exhausted branch;payloadsWithToolMedia,aborted,externalAbort,timedOutare all in scope; per-turn counter is loop-local so it resets on each new user turn; instruction is nulled after success and joined into the next attempt's prompt additions alongside the other three retry nudges. - Reuses the existing
RETRY_NUDGE_TEXTfromcommands-retry.tsand the existingisReplyPayloadNonTerminalToolErrorWarningclassifier fromreply-payload.ts— no duplicated logic, no new secrets, no migrations, no API contract changes. - Tests: 3 new focused unit tests (bound, no-warning short-circuit, aborted/external/timed-out short-circuit) + full suite passes locally on rebase (114/114 in
run.incomplete-turn.test.ts).tsgo -p tsconfig.core.jsonclean.
Ship it.
…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.
convyusboy
force-pushed
the
ridho/eng-18893-gemstone-industrial-proposal-generation-generic-one-step
branch
from
September 3, 2026 11:07
85089be to
21557e6
Compare
There was a problem hiding this comment.
Re-approved on 21557e6.
Second pass targets the two safety gaps I missed first time — both real.
hadPotentialSideEffectsgate:shouldRetryUnfinishedStepsnow short-circuits when the same-turn attempt already committed a mutation, in lockstep with siblingshouldRetryMissingAssistantTurn(run.ts:3876) andshouldRetrySilentErrorAssistantTurn(run.ts:3892). ReadsaccumulatedReplayState.hadPotentialSideEffectsafterobserveReplayMetadatafolds the just-completed attempt in (2402), so the flag is fresh for this iteration. Prevents theredo itnudge from replaying a Slack send / cron.add / sessions_spawn that already succeeded before a later exec failure.- Reset-all-four-together:
reasoningOnlyRetryInstruction+emptyResponseRetryInstructionare now nulled at run.ts:3909-3912 alongsidecompactionContinuationRetryInstructionand the newunfinishedStepsRetryInstruction, at the point where none of the earlier retry branchescontinued. Removes the stale-instruction concat path where a no-longer-applicable nudge could ride into a later iteration's prompt additions (buildRunLoopIterationPrompt joins the four).
Tests:
never retries unfinished steps once the attempt had potential side effects— direct helper test.never auto-retries unfinished steps after a messaging-tool send already landed— full-loop test withdidSendViaMessagingTool: truefixture, asserts exactly 1 attempt and nounfinished steps detectedwarn.- Existing bound / no-warning / aborted-externalAbort-timedOut / silent-retry-then-succeed / budget-exhausted cases all preserved.
Mechanics:
- No new logic, no new secrets, no API contract changes.
MAX_UNFINISHED_STEPS_RETRY_ATTEMPTS = 2still matches boonevalnudge.max: 2.- Reset block only clears when both reasoning-only + empty-response branches skipped their
continuethis iteration, so live instructions aren't clobbered.
CI status: check-lint in progress, build-artifacts / check-test-types / check-shrinkwrap / check-dependencies / Security-High CodeQL all green; remaining shards queued. check-additional-extension-package-boundary running. No red.
Ship it.
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. 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.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.
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-vitest.mjs src/agents/embedded-agent-runner/run.incomplete-turn.test.ts— 114/114 passed (includes 3 new tests forshouldRetryUnfinishedSteps), both pre- and post-rebase onto latestorigin/boon.Linear: https://linear.app/getboon/issue/ENG-18893/gemstone-industrial-proposal-generation-generic-one-step-didnt-finish
Summary by cubic
Fixes Boon Agent turns that end with a recoverable tool-call failure by silently retrying them internally instead of stopping with the “N steps didn’t finish” note and manual Retry button (ENG-18893).
/retry's proven nudge text, bounded to 2 attempts to match booneval's own cap.Written for commit 21557e6. Summary will update on new commits.