Repository navigation
feat(agents): tell a channel why a turn stopped and when a completion attempt is its last - #251
Conversation
A channel plugin that owns a sub-agent completion gets a retryable failure retried up to the announce retry limit, then the completion is given up or suspended. The owner never knew which attempt was the last, so a plugin that hit a turn budget on the final attempt stayed silent and the user saw nothing. SubagentCompletionRequest gains an optional `finalAttempt`, computed from the same cleanup decision the lifecycle applies after a failure, so a plugin can post a visible halt on the attempt that will not be retried. Additive: owners that ignore it behave as before. ENG-20495 Claude-Session: https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG
When every model candidate fails, the runner already classifies the failure
into a GatewayFailureCode, then keeps only the copy text. A channel plugin
saw `isError: true` and could not tell a transient provider outage
(retrying helps) from billing or context overflow (it does not) without
matching the text.
Attach the resolved code, including the will_auto_retry downgrade, to the
final failure payload's metadata and expose it through the plugin SDK as
`getReplyPayloadGatewayFailure(payload) -> { code, retryAffordance }`,
beside getReplyPayloadToolFailureDigest. Additive: no wire or text change.
ENG-20495
Claude-Session: https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG
…yFailure The new reply-payload getter adds one public callable export and three public exports (the getter plus the GatewayFailureCode and RetryAffordance types). ENG-20495 Claude-Session: https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG
|
@gandalf Please review and, if satisfied, approve #251 on exact current head Summary: Additive OpenClaw SDK/runtime support for final sub-agent completion attempts and gateway failure reply code/retry affordance. Please review this exact head and provide a human APPROVED review if satisfied; check final-attempt completion behavior and gateway failure payload compatibility. This is a request only, not an approval; all required checks and Gandalf's exact-head approval are required before merge. |
augusteo
left a comment
There was a problem hiding this comment.
Approved.
Verified at head 3a729dd:
- Strictly additive SDK surface: SubagentCompletionRequest.finalAttempt, ReplyPayloadMetadata.gatewayFailureCode, getReplyPayloadGatewayFailure + the two exported types; budgets bumped (+3 exports/+1 fn) and the baseline sha regenerated. Nothing removed or narrowed.
- finalAttempt uses ONE retry policy (resolveCleanupDecision) for both the pre-call flag and the post-failure decision, so the two can't drift; the pre-call prediction race (late expiry / new pending descendants) is documented on the field. Tests pin attemptCount 2 -> final, 0 -> not, and the keep/ok final attempt suspends instead of failing.
- resolveTerminalGatewayFailureCode downgrades will_auto_retry codes once, and the same code drives both the copy and the payload metadata, so a channel never sees a code/copy mismatch. setReplyPayloadMetadata merges (...previous), so the isError marking survives.
- Plugin-side consumption (anychat-boon-web#149) feature-detects the getter, so merge order is genuinely free.
- All check lanes green.
No findings.
Local-stack test screenshotThis used a gateway built from this branch, with |
…+ fast-uri 3.1.7) (#252) * chore(release): bump version 2026.6.11-boon.47 -> 2026.6.11-boon.48 Root version, 135 plugin manifests synced via scripts/sync-plugin-versions.ts (pnpm plugins:sync), root + 68 extension npm-shrinkwrap.json version fields and openclaw peerDependency ranges bumped, CHANGELOG section for boon.48. Shipping: #251 (SubagentCompletionRequest.finalAttempt tells a completion owner its attempt will not be retried; getReplyPayloadGatewayFailure on the plugin SDK exposes the terminal GatewayFailureCode + retry affordance of an all-models-failed reply; plugin SDK surface budget raised for the new getter and types). Base = 2026.6.11-boon.47. Gateway plus @openclaw/slack, @openclaw/msteams and @openclaw/diagnostics-prometheus bumped in lockstep; no separately published plugin source changed in this train, so a gateway roll delivers all of it. Claude-Session: https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG * fix(deps): bump the fast-uri override 3.1.6 -> 3.1.7 for GHSA-qw65-cvwx-89v3 / GHSA-58mr-gqgx-xq4g Two HIGH advisories published after boon.47 cover fast-uri 3.1.6 (authority injection via an unvalidated port in serialize; host confusion via an unclosed bracket in the URI authority). Move the workspace override to the patched 3.1.7 and refresh the lockfile plus the three shrinkwraps that resolve it (root, acpx, lobster). pnpm-audit-prod now reports no high advisories. Claude-Session: https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG * docs(changelog): note the fast-uri security bump in boon.48 Claude-Session: https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG * docs(changelog): describe the fast-uri fix without advisory IDs Address review: public release notes carry no GHSA identifiers or internal audit/lockfile detail. Keep a concise user-facing security note. Claude-Session: https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG

What Problem This Solves
Resolves a problem where a Boon Agent chat user is left with no explanation when a turn stops early. Two cases:
Why This Change Was Made
Both are additive facts the channel needs, so openclaw now passes them along instead of discarding them:
SubagentCompletionRequest.finalAttempt?: booleanresolveCleanupDecision).GatewayFailureCodethe runner already resolved, including thewill_auto_retry→agent_failed_transient_after_retriesdowngrade.getReplyPayloadGatewayFailure(payload) → { code, retryAffordance }fromopenclaw/plugin-sdk/reply-payload, besidegetReplyPayloadToolFailureDigest.Non-goals:
llm.completebehavior is unchanged. A version that threw on provider errors was dropped, because the bundled clickclack plugin doesn't catch it.User Impact
None on its own. Owners that ignore the new fields behave exactly as before. It unblocks anychat-boon-web posting a visible "Paused" row with progress on the final sub-agent result attempt, and a
model_unavailablerow instead of generic text.Evidence
node scripts/run-vitest.mjs src/agents/subagent-announce.test.ts src/agents/subagent-registry-lifecycle.test.ts src/agents/subagent-registry-cleanup.test.ts src/agents/subagent-completion-owner.test.ts→ 65 passed.agent-runner-execution/gateway-failure-code/wired-hooks-reply-payload-sending/reply-utils→ 324 passed.finalAttempt: expected undefined to deeply equal trueandTypeError: getReplyPayloadGatewayFailure is not a function.node scripts/run-tsgo.mjs -p tsconfig.core.jsonand-p test/tsconfig/tsconfig.core.test.json→ exit 0.check-import-cycles→ 0 cycles.pnpm plugin-sdk:api:gen). It addsgetReplyPayloadGatewayFailure,GatewayFailureCodeandRetryAffordance.Subagent announce give up (owner_terminal) ... retries=3 deliveryError="turn_budget_exceeded".https://claude.ai/code/session_01FSeHegCidN6qEU1sTf2KzG
Summary by cubic
Adds two additive signals so channels can explain early turn stops instead of leaving the user with silence or a generic error.
SubagentCompletionRequest.finalAttempttells a completion owner when retries have been exhausted, so it can post a visible halt on the final sub-agent result attempt rather than staying quiet.GatewayFailureCode(withRetryAffordance) to the payload, reachable viagetReplyPayloadGatewayFailure()fromopenclaw/plugin-sdk/reply-payload. Channels can now tell billing/context overflow from transient provider outages without matching text.Owners that ignore the new fields behave exactly as before. Unblocks anychat-boon-web showing a "Paused" row on the last sub-agent attempt and a
model_unavailablerow instead of generic failure text. Addresses ENG-20495.Written for commit 3a729dd. Summary will update on new commits.