Repository navigation
fix(errors): intermediate status for non-terminal tool failures, not "⚠️ … failed" (ENG-15627 G4) - #52
Closed
monac24 wants to merge 1 commit into
Closed
fix(errors): intermediate status for non-terminal tool failures, not "⚠️ … failed" (ENG-15627 G4)#52monac24 wants to merge 1 commit into
monac24 wants to merge 1 commit into
Conversation
…s, not "⚠️ … failed" (ENG-15627 G4) When a tool errored but the turn kept going — the assistant already produced a reply and prior tools completed — buildEmbeddedRunPayloads still emitted a terminal "⚠️ ✉️ Message failed" banner, even though core marked it nonTerminalToolErrorWarning=true. That is the over-eager lie: it reads as a hard failure while work actually continued (the "message failed while the agent is still working" report). Reframe the non-terminal case as a progress step that names what completed: "↻ ✉️ Message didn't complete — continued (2 steps completed)". No⚠️ , no "failed". The non-terminal decision is computed once and drives both the visible text and the payload metadata (previously the metadata said non-terminal while the text said failed). Terminal failures (no reply, or non-middleware mutating failures) keep the existing "⚠️ <tool> failed" banner unchanged. Reports the operation outcome as an intermediate status instead of a false terminal error — the G4 half of the ENG-15627 error-conveying guardrails. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
I'll analyze this and get back to you. |
There was a problem hiding this comment.
cubic analysis
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/agents/embedded-agent-runner/run/payloads.ts">
<violation number="1" location="src/agents/embedded-agent-runner/run/payloads.ts:593">
P2: The status can claim async work is “completed” even when it is still running, because this counts every tool meta. Count only completed entries (exclude `asyncStarted`) so the progress copy matches the actual tool state.</violation>
</file>
Linked issue analysis
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Compute the non-terminal decision once and use it for both the visible banner text and the payload metadata (nonTerminalToolErrorWarning). | The diff introduces an isNonTerminalWarning variable computed from hasUserFacingAssistantReply + shouldMarkNonTerminalToolErrorWarning and uses it to set both warningText and nonTerminalToolErrorWarning in the reply item. |
| ✅ | For non-terminal tool failures, render an intermediate status (e.g. "↻ didn't complete — continued (N steps completed)") and do not show the terminal ' |
A new helper buildNonTerminalToolStatusText produces the intermediate copy and the tests assert the warning text does not contain 'failed' or ' |
| ✅ | Terminal failures remain unchanged (still render ' |
The code preserves the previous terminal branch that builds the ' |
| ✅ | Unit tests updated to reflect the new intermediate-status copy and CI shards are green. | Tests in payloads.errors.test.ts and payloads.test.ts were updated to assert the new copy and metadata; the PR description reports full shard green runs and updated tests transitioning from RED→GREEN for the non-terminal case. |
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| const warningText = isNonTerminalWarning | ||
| ? buildNonTerminalToolStatusText({ | ||
| toolSummary, | ||
| completedToolCount: params.toolMetas.length, |
There was a problem hiding this comment.
P2: The status can claim async work is “completed” even when it is still running, because this counts every tool meta. Count only completed entries (exclude asyncStarted) so the progress copy matches the actual tool state.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/agents/embedded-agent-runner/run/payloads.ts, line 593:
<comment>The status can claim async work is “completed” even when it is still running, because this counts every tool meta. Count only completed entries (exclude `asyncStarted`) so the progress copy matches the actual tool state.</comment>
<file context>
@@ -555,11 +578,21 @@ export function buildEmbeddedRunPayloads(params: {
+ const warningText = isNonTerminalWarning
+ ? buildNonTerminalToolStatusText({
+ toolSummary,
+ completedToolCount: params.toolMetas.length,
+ })
+ : `⚠️ ${toolSummary} failed${errorSuffix}`;
</file context>
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.

Related: ENG-15627 (G4 — operation-outcome vs session-state, intermediate status)
What Problem This Solves
Fixes an issue where a user sees "⚠️ ✉️ Message failed" (or "⚠️ 🛠️ Exec failed") while the agent is actually still working and the turn succeeded. When a tool errors after the assistant has already produced a reply and prior tools completed, core correctly classifies it as non-terminal — but the visible banner still read as a hard, terminal failure. This is the "message failed while the agent is still working in the background" report: the runtime announced a mechanical outcome with no knowledge that work continued.
Why This Change Was Made
buildEmbeddedRunPayloadssetnonTerminalToolErrorWarning: trueon the payload metadata (so downstream consumers already treated it as non-failed) yet still rendered⚠️ <tool> failedas the text. The metadata and the copy disagreed.hasUserFacingAssistantReply && middlewareError) and use it to drive both the visible text and the metadata flag.↻ ✉️ Message didn't complete — continued (2 steps completed)(step count from the completedtoolMetas; omitted when zero). No⚠️ <tool> failedbanner.User Impact
A transient tool hiccup during a turn that otherwise succeeds now reads as a progress step ("continued (N steps completed)") instead of a false "failed". Genuine, terminal tool failures still surface clearly. Group/channel and verbose behavior are otherwise unchanged.
Evidence
⚠️ ✉️ Message failed) → GREEN.Exec failed).agents-embedded-agentshard green (1536),cronshard green (1174, thenonTerminalToolErrorWarningconsumer), payloads suites green (91). oxlint clean.🤖 Generated with Claude Code
Summary by cubic
Stop showing a terminal "⚠️ … failed" banner when a tool error is non-terminal and the assistant already replied. Instead, show an intermediate status that work continued, aligning with ENG-15627 (G4).
Written for commit 263b115. Summary will update on new commits.