Repository navigation
fix(agents): derive legacy tool counts from surfaced failures - #208
Conversation
|
I'll analyze this and get back to you. |
There was a problem hiding this comment.
cubic analysis
No issues found across 3 files
Linked issue analysis
Linked issue: ENG-19407: [openclaw] countCompletedTools fabricates "one step didn't finish" on a fully clean turn
| Status | Acceptance criteria | Notes |
|---|---|---|
| Enumerate which producers reach countCompletedTools without setting errored on any meta | The PR identifies embedded-runner and Codex producers as explicit-outcome producers and describes remaining compatibility-boundary shapes, but it does not clearly enumerate the specific outcome-less producers. | |
| A turn with zero recorded failures never yields a step-note claiming a step didn't finish | The PR explicitly claims that turns with no surfaced failures produce no digest or step note, but the shown diff does not add a direct zero-failure step-note regression test. | |
| ✅ | tool-failure-digest.test.ts covers the no-errored producer path explicitly | The added test supplies three tool metadata records without errored flags and verifies counts derived from two surfaced failures; a second test covers empty metadata. |
|
@cubic-dev-ai Re review feedback (#5138311514, addressed in 1cbe4b1): the PR now enumerates each current producer and the remaining outcome-less compatibility paths. Added a direct payload-boundary regression proving outcome-less metadata with zero recorded failures emits no step note; focused coverage is now 90 passing tests. |
There was a problem hiding this comment.
Approved — clean fix.
Bug: legacy toolMetas.length - 1 fallback fabricated one failure whenever a producer omitted per-call outcomes, so a turn with 2 surfaced failures across 3 records reported "1 step didn't finish · 2 of 3 completed" — wrong on both counts.
Fix derives from the surfaced-failure list already owned by the digest: totalToolCount = max(toolMetas.length, surfacedFailureCount), completedToolCount = total − surfaced. Explicit errored/status: blocked outcomes take the same branch as before.
Regression check:
- Public
ToolFailureDigestshape unchanged → AnyChat and other channel renderers get consistent counts without a paired change. - Only in-tree consumer is
buildNonTerminalToolStatusText, which is arithmetic over the pair — internally consistent. didNotFinishCount = max(1, …)floor is preserved, so the note still names at least one step for empty-metadata legacy callers.- Verified locally:
node scripts/run-vitest.mjs run src/agents/tool-failure-digest.test.ts src/agents/embedded-agent-runner/run/payloads.errors.test.ts— 90 passed. - CI green across all required shards.
Ship it.
…211) ## Release 2026.6.11-boon.39 Surfaces a swallowed before_tool_call hook failure to Sentry + the durable audit trace so the ENG-19492 incident class is diagnosable after the fact. ### Contents (merged onto `boon` since boon.38) - **#209 (ENG-19492)** — emit a `before_tool_call_hook_failed` observability hook (genuine handler exception only, never a policy veto), paged by sentry-monitor, and thread the real error text into boon-core's audit_trace as an optional `detail` field. Requires boon-core companion getboon/boon#14629 (merged + live) which accepts the new field. Non-hook pipeline failures are classified separately. - **#208** — derive legacy tool counts from surfaced failures. ### Release prep - Root version boon.38 -> boon.39; lockstep regenerated (211 files: 135 plugin package.json + 70 npm-shrinkwrap.json + SDK/config baselines). All release-preflight --check steps pass. - CHANGELOG.md `## 2026.6.11-boon.39` section added. ### After merge Tag `v2026.6.11-boon.39` -> `boon-release.yml`. Fleet is pinned to boon.36, so a roll also picks up boon.37 (#194-#198) and boon.38 (#201, #202, #205). Claude-Session: https://claude.ai/code/session_01AMjtZJAWLVBwa5Dtc4oNog Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

What Problem This Solves
The tool-failure digest assumed exactly one failure whenever a producer supplied tool metadata without per-call outcome flags. With two surfaced failures across three such records, the user-facing note incorrectly said one step did not finish and that 2 of 3 steps completed.
Current producer inventory:
src/agents/embedded-agent-subscribe.handlers.tools.tsrecordserroredandstatus: "blocked"for embedded-runner calls;run/normalize-tool-metas.tspreserves both fields before payload construction.extensions/codex/src/app-server/event-projector.tsrecords terminalerroredand blocked outcomes for Codex app-server calls.src/agents/cli-runner.tscalls the shared payload builder with emptytoolMetasand no failure record for source-reply mirroring, so that path cannot create a failure digest.buildEmbeddedRunPayloadscallers that supply legacylastToolError/toolFailures, and normalized attempt records received from older or custom sources that omitted outcome flags.Why This Change Was Made
The digest already owns the filtered list of failures that are safe and appropriate to surface. For outcome-less metadata, it now derives the failed count from that evidence, infers a total large enough to represent missing metadata, and computes completed steps from those values. Explicit errored and blocked-call behavior is unchanged.
The public ToolFailureDigest shape is unchanged, so channel renderers such as AnyChat receive internally consistent counts without a paired compatibility change.
User Impact
A legacy turn with two recorded failures and three tool records now reports two unfinished steps and 1 of 3 completed. A turn with no surfaced failures still produces no digest or step note.
Evidence
TDD RED before the implementation:
Fresh verification:
Linear: https://linear.app/getboon/issue/ENG-19407/openclaw-countcompletedtools-fabricates-one-step-didnt-finish-on-a
Summary by cubic
Fixes the tool-failure digest so legacy producer metadata without per-call outcome flags no longer fabricates a completion count. Previously the digest assumed exactly one failure (
length - 1) whenever noerroredflag was present, which could label a fully clean turn as having one unfinished step; it now derives the failed count from the surfaced failure list and computes completed steps from that.Behavior
erroredorblockedoutcomes keep their existing behavior.ToolFailureDigestshape is unchanged, so channel renderers get consistent counts without a paired compatibility change.Addresses ENG-19407.
Written for commit 1cbe4b1. Summary will update on new commits.