Skip to content

Include delivery errors in subagent announce give-up logs#84281

Merged
bek91 merged 2 commits into
openclaw:mainfrom
TurboTheTurtle:fix/subagent-announce-delivery-error-log-84272
May 20, 2026
Merged

Include delivery errors in subagent announce give-up logs#84281
bek91 merged 2 commits into
openclaw:mainfrom
TurboTheTurtle:fix/subagent-announce-delivery-error-log-84272

Conversation

@TurboTheTurtle

Copy link
Copy Markdown
Contributor

Summary

Fixes #84272.

  • Include the saved lastAnnounceDeliveryError in subagent announce retry-limit / expiry give-up warnings.
  • Normalize multiline delivery errors onto one gateway log line so gateway.log remains searchable.
  • Log direct completion announce delivery failures through the normal gateway log path instead of stderr-only output.

Root cause

Subagent announce delivery already formatted and persisted the concrete delivery failure on the run entry, but logAnnounceGiveUp() only emitted run, child, requester, retry count, and ended age. On macOS managed gateways where stderr can be discarded, the final gateway.log warning lost the useful delivery cause.

Real behavior proof

Behavior or issue addressed:
Subagent announce retry-limit give-up logs now include the underlying delivery error in the normal gateway log output.

Real environment tested:
Local OpenClaw source checkout on macOS using the production logAnnounceGiveUp() implementation and defaultRuntime.log capture.

Exact steps or command run after this patch:

PATH=/Users/andy/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH node --import tsx --input-type=module --eval 'import { defaultRuntime } from "./src/runtime.ts"; import { logAnnounceGiveUp } from "./src/agents/subagent-registry-helpers.ts"; const originalLog = defaultRuntime.log; const lines = []; defaultRuntime.log = (line) => lines.push(String(line)); const originalNow = Date.now; Date.now = () => 9000; logAnnounceGiveUp({ runId: "run-proof", childSessionKey: "agent:main:subagent:child", requesterSessionKey: "agent:main:main", requesterDisplayKey: "main", task: "finish", cleanup: "keep", createdAt: 1000, startedAt: 2000, endedAt: 4000, announceRetryCount: 3, lastAnnounceDeliveryError: "direct-primary: routed-dispatch-did-not-queue-final\nsteer-fallback: queue_message_failed" }, "retry-limit"); Date.now = originalNow; defaultRuntime.log = originalLog; console.log(JSON.stringify({ loggedLine: lines[0], hasDeliveryError: lines[0]?.includes("deliveryError="), multilineCollapsed: !lines[0]?.includes("\\n") }, null, 2));'

Evidence after fix:

{
  "loggedLine": "[warn] Subagent announce give up (retry-limit) run=run-proof child=agent:main:subagent:child requester=agent:main:main retries=3 endedAgo=5s deliveryError=\"direct-primary: routed-dispatch-did-not-queue-final steer-fallback: queue_message_failed\"",
  "hasDeliveryError": true,
  "multilineCollapsed": true
}

Observed result after fix:
The normal gateway log warning includes deliveryError=..., preserves the concrete delivery failure, and collapses multiline errors onto one log line.

What was not tested:
No live macOS LaunchAgent was started. The proof exercises the production logging helper directly, and focused tests cover the direct completion announce failure path.

Validation

  • node scripts/run-vitest.mjs src/agents/subagent-registry-lifecycle.test.ts
  • node scripts/run-vitest.mjs src/agents/subagent-announce.test.ts src/agents/subagent-announce-dispatch.test.ts
  • git diff --check

Attribution

If maintainers squash or rework this PR, please preserve author attribution or include:

Co-authored-by: Andy Ye <35905412+TurboTheTurtle@users.noreply.github.com>

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S proof: supplied External PR includes structured after-fix real behavior proof. labels May 19, 2026
@TurboTheTurtle TurboTheTurtle marked this pull request as ready for review May 19, 2026 19:38
@clawsweeper

clawsweeper Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The branch adds delivery error text to subagent announce give-up logging, moves direct completion failure logging to the gateway logger, and adds focused tests for both paths.

Reproducibility: yes. at source level: current main persists lastAnnounceDeliveryError during failed announce cleanup but logAnnounceGiveUp omits it from the final warning. I did not execute tests because this review is read-only.

PR rating
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Summary: Good focused PR with sufficient terminal proof, narrow implementation, and no blocking findings.

Rank-up moves:

  • none
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

PR egg
✨ Hatched: 🥚 common Clockwork Patch Peep

       /\  .---.  /\         
      /  \/     \/  \        
     /   ( -   - )   \       
    |       ._.       |      
    |   /|  ===  |\   |      
     \  \|______/|/  /       
      '._  `--'  _.'         
         '-.__.-'            
       _/|_|  |_|\_          
      /__|      |__\         
       .-----------.         
      '-------------'        

Rarity: 🥚 common.
Trait: guards the happy path.
Image traits: location release reef; accessory tiny test log scroll; palette plum, gold, and soft gray; mood proud; pose leaning over a miniature review desk; shell starlit enamel shell; lighting tiny status-light glow; background miniature CI buoys.
How to hatch it: once this PR reaches status: 👀 ready for maintainer look or status: 🚀 automerge armed, the PR author or a maintainer can comment @clawsweeper hatch to turn this ASCII egg into its generated creature image.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Clockwork Patch Peep in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchable usually means sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

Real behavior proof
Sufficient (terminal): The PR body supplies after-fix terminal output from a local source checkout showing the production helper logs deliveryError and collapses multiline text.

Risk before merge
Why this matters: - No live macOS LaunchAgent run was attached; the supplied proof exercises the production helper and focused tests cover the affected logging paths.

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused observability fix after normal CI and maintainer review, preserving the existing retry policy, delivery ordering, and cleanup semantics.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
No ClawSweeper repair job is needed; the remaining action is ordinary maintainer review and CI gating, with the linked issue left open until this PR lands.

Security
Cleared: The diff only changes local diagnostic logging and focused tests; it does not touch dependencies, workflows, permissions, credentials, or external code execution paths.

Review details

Best possible solution:

Land the focused observability fix after normal CI and maintainer review, preserving the existing retry policy, delivery ordering, and cleanup semantics.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current main persists lastAnnounceDeliveryError during failed announce cleanup but logAnnounceGiveUp omits it from the final warning. I did not execute tests because this review is read-only.

Is this the best way to solve the issue?

Yes: the PR uses the existing persisted error field and normal gateway log path, which is the narrow maintainable fix for this observability-only bug.

Label justifications:

  • P2: The PR addresses a concrete agents observability bug with limited blast radius and focused tests/proof.

What I checked:

Likely related people:

  • Ayaan Zaidi: git blame and git log -S point the current subagent announce lifecycle files, logAnnounceGiveUp helper, direct completion failure logging, and lastAnnounceDeliveryError field to commit 1f794d2. (role: introduced current behavior; confidence: medium; commits: 1f794d2816d1; files: src/agents/subagent-announce.ts, src/agents/subagent-registry-helpers.ts, src/agents/subagent-registry-lifecycle.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 5c9a8f33b312.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels May 19, 2026
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

Pushed a fix for the failed check-test-types job. The failing test intentionally mocked an announce delivery error response, but the test spy's inferred return type only allowed { runId, status }; I widened that local test response type to include error.

Local validation:

  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
  • node scripts/run-vitest.mjs src/agents/subagent-announce.test.ts src/agents/subagent-registry-helpers.test.ts (26 tests passed)
  • ./node_modules/.bin/oxfmt --check --threads=1 src/agents/subagent-announce.test.ts src/agents/subagent-announce.ts src/agents/subagent-registry-helpers.ts src/agents/subagent-registry-helpers.test.ts
  • git diff --check

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 19, 2026
@bek91 bek91 self-requested a review May 20, 2026 03:17
@bek91

bek91 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Thanks @TurboTheTurtle! I inspected the PR diff, changed files, issue/PR discussion, surrounding delivery/lifecycle code, and current PR checks. Implementation is narrow and does not change delivery behavior, just where the warning is written. Resolves #84272

@bek91 bek91 merged commit 9108ae0 into openclaw:main May 20, 2026
110 checks passed
@TurboTheTurtle TurboTheTurtle deleted the fix/subagent-announce-delivery-error-log-84272 branch May 20, 2026 03:39
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…4281)

* Include delivery error in subagent announce give-up logs

* test(agents): type announce delivery error response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subagent completion announce retry-limit logs hide the underlying delivery error

2 participants