Repository navigation
fix(errors): reframe recovered exec/process/tmux failures as non-terminal status (ENG-16330) - #64
Conversation
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 2 files
Linked issue analysis
Linked issue: ENG-16330: Intelligent Messaging — outcome-aware status (improve on error guardrails)
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Recovered non-terminal sub-failures on a successful turn do not render a terminal ' |
PR widens the non-terminal predicate to include recovered exec/bash/process/tmux errors when there is a user-facing reply, and tests assert the warning payload contains no |
| ✅ | Genuinely failed turns still surface an honest, coded failure (no regression of prior guardrails) | The reframing is gated on presence of a user-facing assistant reply; when there is no reply the tests assert the terminal badge is still emitted. Existing model-facing error semantics are preserved. |
| ✅ | Confabulated successes (agent claims done while tool never ran/errored) remain flagged (no over-suppression) | The code keeps write/edit/message strict and only treats command-exec-class tools as recoverable; reframing only applies when there's a user-facing reply. That preserves the confabulation checks. Tests exercise related guards and the PR description documents this explicitly. |
| ✅ | No internal job/session names or raw filesystem/tool error strings leak into customer-facing messages | Tests explicitly assert the reframed warning text does not contain raw session names or raw error text, and the PR reuses the existing G4 continuation copy instead of the raw error lines. |
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…inal status (ENG-16330) The user-facing "⚠️ 🧰 Process: <session> failed" badge is built at buildEmbeddedRunPayloads (payloads.ts) from ctx.state.lastToolError, NOT by emitToolResultOutput. A backgrounded exec/process/tmux session that exits non-zero but which the agent recovers from — the turn still produces a real reply — rendered a terminal "failed" badge, giving the user the wrong intuition ("the agent broke"). Widen shouldMarkNonTerminalToolErrorWarning from middlewareError-only to also treat a recovered exec/bash/process/tmux error as non-terminal. The caller already gates this on hasUserFacingAssistantReply, so the reframe only fires when the turn actually produced a reply; on a reply-less genuine failure the honest "⚠️ … failed" badge still surfaces (no #53/#47/#48/#50 regression). write/edit/message stay strict — a failed write with a "done" reply is still flagged as confabulation. Reuses the shipped ENG-15627 G4 continuation note ("↻ A step didn't complete, but I kept going"); no new copy, no raw generated session names. Supersedes the buffer approach in PR #62, which intercepted emitToolResultOutput (live streamed output) — a different sink from the badge, so the badge was never reached. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…cubic P2) tmux is neither in MUTATING_TOOL_NAMES nor exec-like, so resolveToolErrorWarningPolicy already sets showWarning=false (no badge at all) once a reply exists — it never reached shouldMarkNonTerminalToolErrorWarning. Listing it was dead code implying a path that never fires. Remove it and document why it's intentionally absent. Recovered exec/bash/process reframe unchanged; 60/60 tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… reframe (ENG-16330) #62 (merged) buffered the emitToolResultOutput call and added a turn-close '🔧 Recovered…' path-trail note — but that is a DIFFERENT sink from the actual badge. The '⚠️ 🧰 Process: <session> failed' badge is built in buildEmbeddedRunPayloads (payloads.ts) from ctx.state.lastToolError, which handleToolExecutionEnd still sets unconditionally regardless of the buffer. So on boon today the badge STILL fires alongside #62's new note — the user gets both, and the headline symptom is unfixed. This PR's payloads.ts reframe fixes the real sink. Keeping #62's machinery on top would emit two redundant recovery notes (🔧 + ↻) and leaves two overlapping paths for one behavior. Per one-canonical-path policy, unwind #62: - delete src/agents/intelligent-messaging.ts + its test - restore the 3 handler files (messages/tools/types) to pre-#62 state Net result: one seam — shouldMarkNonTerminalToolErrorWarning reframes recovered exec/bash/process errors on a successful turn into the shipped G4 note; reply-less genuine failures keep the honest badge; write/edit/message stay strict. 60/60 payloads.errors + 69/69 handlers.tools green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
aa986e9 to
652e6ee
Compare
|
Heads-up @monac24 — this PR now unwinds the buffer/path-trail machinery from #62 and keeps a single seam. Wanted to flag it directly since it touches your just-merged code. Why: #62's buffer wraps the
So the salty-shore badge still fires on What this PR does instead: widen Net: 5 files changed, +9 / −404. 60/60 |
There was a problem hiding this comment.
Approved — verified live, not from memory.
What I checked
- Traced the real seam:
processis inMUTATING_TOOL_NAMES, so a non-zero bg-process exit on a turn with a reply hits the mutating branch ofresolveToolErrorWarningPolicy(showWarning=true) and previously rendered the terminal⚠️ 🧰 Process: <session> failedbadge. WideningshouldMarkNonTerminalToolErrorWarningto the recoverable exec class reframes it into the shipped G4↻ … kept goingnote. Thesalty-shoresymptom is genuinely fixed at the correct sink (not theemitToolResultOutputsink #62 wrongly targeted). - Gate is correct:
isNonTerminalWarning = hasUserFacingAssistantReply && shouldMark…, so reply-less genuine failures keep the honest badge (confirmed by the new regression-guard test). Model-facingisToolResultErroruntouched. tmuxcorrectly dropped — not exec-like and not mutating, soresolveToolErrorWarningPolicyalready returnsshowWarning=falseonce a reply exists; listing it was dead.- #62 unwind is clean (intelligent-messaging + its test deleted, handlers reverted to single-path). No duplicate
🔧/↻notes. - Ran the suite locally on this branch (non-verbose defaults, i.e. real customer path):
node scripts/run-vitest.mjs …/payloads.errors.test.ts→ 60/60 passed.
One non-blocking observation (follow-up, not a blocker)
shouldMarkNonTerminalToolErrorWarning keys on toolName === "process" only — it does not consult lastToolError.mutatingAction. I verified with a probe that a mutating process action (kill/remove/write/send_keys/paste/submit/clear) that errors on a turn with a reply is now also reframed to ↻ A step didn't complete, but I kept going instead of ⚠️ … failed. That slightly contradicts the PR's own stated principle ("a failed write with a 'done' reply is confabulation → stay strict"): a failed process kill with a "cleaned up the job" reply is the same confabulation shape. exec/bash don't have this issue (exec-like → showWarning=false in non-verbose, so the reframe isn't reached). Consider gating on !mutatingAction for process. Minor — the model still sees the true error and this only affects channel wording on a turn that produced a real reply, so it doesn't block the approval.
Nice, focused fix. Ship it.
Bump gateway + @openclaw/slack + @openclaw/msteams to 2026.6.11-boon.7 in lockstep (package.json + npm-shrinkwrap.json roots) and add the CHANGELOG entry. Ships the boon.7 train: #70 (ENG-16418 concise + A/B/C overlay for Claude), #68 (ENG-16200 progress nudges runtime, gated off by default), #69 (security dep bumps), #64 (ENG-16330 non-terminal recovered-tool-error badge). Base = 2026.6.11-boon.6. Only slack + msteams carry the -boon.N suffix; other extensions stay at plain 2026.6.11 (fork release does not run a blanket plugins:sync). Formatting proof: oxfmt --check clean on CHANGELOG.md; the six JSON files are oxfmt-excluded lockfile-class and byte-shape-identical to the boon.6 release commit. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
… correct answer (ENG-16318) (#75) * fix(errors): stop surfacing benign housekeeping exec failures after a correct answer (ENG-16318) A correct MS Teams triage answer was followed by a "⚠️ 🛠️ … failed" card whose failing step was a trailing model-authored `find /` that hit permission-denied noise — bookkeeping, not the task failing. Building on #64 (ENG-16330, which reframed the hard badge into a "↻ kept going" note), this removes the residual tangential markers: - payloads: when a turn delivered a real answer and the recovered exec command was ENTIRELY benign housekeeping (scratch setup + inspection, e.g. `mkdir … && ls … && find / -name "<uuid>*"`), append nothing — not even the "↻" note. Mutating recovered tails and no-reply turns still surface the honest terminal failure. Keyed off a new whole-command classifier, not a last-stage guess (which breaks on `python build.py || find /`). - streaming: drop benign housekeeping exec chains from the progress card across all channels (shared buildChannelProgressDraftLine seam). - system-prompt: nudge the agent to scope filesystem searches to the workspace (not `find /`) and treat benign housekeeping failures as non-fatal. New display-only classifier isBenignHousekeepingShellCommand lives in tool-display-exec-shell.ts; intentionally separate from tool-mutation.ts's security-sensitive READ_ONLY_SHELL_COMMANDS (which must exclude mutating scaffolding like mkdir). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(errors): reject side-effecting find forms from benign housekeeping (ENG-16318) Cubic P1: the binary-only benign-housekeeping check classified destructive `find` forms (`find . -delete`, `find . -exec rm …`, -execdir/-ok/-okdir/ -fprint*) as benign, so real work could disappear from the progress card and its failure note be suppressed — the opposite of the ticket intent. Guard `find` in isBenignHousekeepingStage: any -delete/-exec/-execdir/-ok/ -okdir/-fprint/-fprintf/-fls predicate makes the stage non-benign (fail closed → surface it and its failure). Pure traversal (`find / -name "x*"`) stays benign. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(deps): bump brace-expansion + postcss off high advisories (security-fast) security-fast / pnpm-audit-prod flagged two production advisories on the boon baseline: - brace-expansion <=5.0.7 — DoS via unbounded expansion (GHSA-mh99-v99m-4gvg) - postcss <=8.5.17 — path traversal in source-map auto-load (GHSA-r28c-9q8g-f849) Bump the pinned overrides: brace-expansion 5.0.7 -> 5.0.8, add postcss 8.5.22 (both patched, no major bump). 5.0.8 is the only patched 5.x release and is newer than the 2-day minimumReleaseAge window, so it is added to minimumReleaseAgeExclude with an advisory reference. postcss 8.5.22 is the newest patched release that clears the maturity window (8.5.23 too fresh). Regenerated pnpm-lock.yaml and root npm-shrinkwrap.json. pnpm-audit-prod now reports no high/critical advisories; shrinkwrap --all --check is current. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(errors): fail closed on shell control the housekeeping classifier can't model (ENG-16318) gandalfboon (blocking): isBenignHousekeepingShellCommand decided "benign" from each stage's first word, but splitTopLevelStages only breaks on ;/&&/|| and splitShellWords treats a newline as whitespace. So a multi-line, &-separated, redirected, or subshell command collapsed to one stage whose benign first word hid real work — e.g. `mkdir -p build\nnpm run build`, `ls & rm -rf dist`, `printf 'x' > ~/.zshrc`, `echo $(rm -rf dist)` all classified benign. That dropped the progress bullet for real work and silenced its genuine failure — the inverse of the ticket intent. The 48-word cap in splitShellWords also let a long `find … -delete` predicate list fail open, regressing the cubic P1 guard. Fix (mirrors tool-mutation.ts): fail CLOSED — a stage containing a newline, `&`, `<`, `>`, backtick, backslash, or `$(` is treated as real work, since this simple splitter cannot model it and a benign chain never needs those. Remove the word cap on the find predicate scan. Added the 7 adversarial cases as regression tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
What Problem This Solves
Since the error-guardrails work shipped (#53 / ENG-15627 §5b/G4, #47/#48, #50), the agent over-reports: a backgrounded
exec/bash/process/tmuxsession that exits non-zero but which the agent recovers from — the turn still produces a real final reply — renders a terminal⚠️ 🧰 Process: <session> failedbadge to the customer. The user sees "failed" and infers the agent broke, when the task actually completed (e.g. gandalfsalty-shore, power-solutions triagefind … failed;salty-*are auto-generated bg-exec session names).Why This Change Was Made
The scary badge is built at
buildEmbeddedRunPayloads(payloads.ts) fromctx.state.lastToolError, not byemitToolResultOutput(which only streams live tool output text and returns early on error). So the correct seam isshouldMarkNonTerminalToolErrorWarning, which already drives the shipped G4 continuation-note reframe.This widens that predicate from
middlewareError-only to also treat a recoveredexec/bash/process/tmuxerror as non-terminal. The caller already gates onhasUserFacingAssistantReply, so the reframe fires only when the turn produced a real reply:↻ A step didn't complete, but I kept going (N steps completed)— no⚠️, nofailed, no raw session name.⚠️ … failedbadge still surfaces (no fix(errors): report true operation outcome, not false terminal failure — kill/remove + non-terminal tool errors (ENG-15627 §5b/G4) #53/fix(errors): stop leaking raw provider errors to users — allocation_exhausted + unclassified passthrough (ENG-15627 G1+G2) #47/feat(errors): add MessageOrigin gateway-failure code schema (ENG-15627 G5) #48/feat(errors): contextual, deterministic error messages instead of generic "message failed" (ENG-15739) #50 regression).write/edit/messagestay strict — a failed write with a "done" reply is still flagged as confabulation.Reuses the shipped ENG-15627 G4 copy — no new user-facing strings, no raw generated session names.
User Impact
Customers no longer see a false terminal
⚠️ … failedbadge when the agent hit a recoverable sub-step error and completed the task anyway. Genuinely failed turns and confabulated successes are still flagged exactly as before.Evidence
src/agents/embedded-agent-runner/run/payloads.errors.test.ts: 60/60 green, including new guards for thesalty-shorebg-process case, exec non-zero exit, exec timeout reframe, and the reply-less regression guard (asserts⚠️/failed/🧰/raw session name are all absent on the recovered case, present on the reply-less failure).node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/payloads.errors.test.ts→60 passed.isToolResultErrorsemantics untouched — the model still sees the true non-zero exit.Supersedes the buffer approach in #62, which intercepted
emitToolResultOutput(live streamed output) — a different sink from the badge, so the badge was never reached. #62 left open pending decision.🤖 Generated with Claude Code
Summary by cubic
Prevents false "⚠️ … failed" badges when a recovered
exec/bash/processerror occurs but the turn still completes by reframing it as a continuation note. Simplifies to a single seam inpayloads.ts; genuine failures and confabulation checks remain unchanged. Addresses Linear ENG-16330.shouldMarkNonTerminalToolErrorWarningto mark recoveredexec/bash/processerrors as non-terminal when a user-facing reply exists; intentionally excludedtmux(already suppressed once a reply exists).buildEmbeddedRunPayloads; removed the buffering/path-trail code and reverted handler wiring (intelligent-messaging.*deleted).isToolResultErrorsemantics; no relabeling of real non-zero exits.Written for commit 652e6ee. Summary will update on new commits.