#92076: Subagent completion delivery can fail when requester run is inactive and session transcript is locked#92643
Conversation
…requester sessions When a subagent completes but the active requester wake fails (no_active_run, inactive session) and the requester-agent handoff throws a SessionWriteLockTimeoutError, the completion was silently lost even though a direct-message delivery route existed. Two changes: 1. Proactive: after active wake failure, try deliverTextCompletionDirect before the requester-agent handoff when a direct-message target exists. This avoids the doomed handoff that will fail with SessionWriteLockTimeoutError. 2. Reactive: in the SessionWriteLock error catch block, try direct text delivery as a fallback (previously only generated media was attempted). Closes openclaw#92076
|
Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 2:00 PM ET / 18:00 UTC. Summary PR surface: Source +48, Tests +141, Other +79. Total +268 across 3 files. Reproducibility: yes. source-reproducible but not live-reproduced here: current main only recovers generated media after a SessionWriteLock handoff failure, while pure-text completions still fall through. The PR adds focused tests for the direct-text fallback path. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land or replace this with a bounded direct-completion fallback that has redacted real external-channel proof, preserves generated-media recovery, and keeps the linked issue open or explicitly tracks the orphan self-lock remainder. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible but not live-reproduced here: current main only recovers generated media after a SessionWriteLock handoff failure, while pure-text completions still fall through. The PR adds focused tests for the direct-text fallback path. Is this the best way to solve the issue? Not fully yet: the code direction is plausible and the earlier lint/cap findings appear addressed, but the merge-ready solution still needs real external-channel proof and issue-scope handling for the remaining lock symptom. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a0b16f37e835. Label changesLabel justifications:
Evidence reviewedPR surface: Source +48, Tests +141, Other +79. Total +268 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Address ClawSweeper review feedback on PR openclaw#92643: 1. [P2] Cap direct text completion delivery at 4000 chars with truncation note to avoid hitting channel limits and re-amplifying transcript writes in the locked-session fallback path. 2. [P1] Fix four no-unnecessary-boolean-literal-compare lint errors in the repro script. 3. Add regression test for long-output capping behavior. Ref: openclaw#92076
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
Fix subagent completion delivery that was silently lost when the active
requester wake fails (inactive/locked session) and the requester-agent
handoff throws a SessionWriteLockTimeoutError — even though a direct-message
delivery route existed.
Root Cause
In
sendSubagentAnnounceDirectly, after the active requester wake failedthe code always attempted the requester-agent handoff. When the requester
session transcript was locked, that handoff threw
SessionWriteLockTimeoutError. The catch block only tried generated-media
direct delivery (requiring
expectedMediaUrls.length > 0), so pure-textsubagent completions were discarded.
Real behavior proof
Behavior addressed: Pure-text subagent completions are now delivered directly
to the external channel when the active requester wake fails and a
direct-message delivery target exists, both proactively (before the handoff)
and as a fallback in the SessionWriteLock error catch block.
Real environment tested: Linux 4.19, Node.js v22, tsx
Exact steps or command run after this patch:
Evidence after fix:
subagent-announce-delivery.test.ts: 98 tests passed (incl. new regression test)scripts/repro-92076.mjs: 9 assertions, 0 failedObserved result after fix:
What was not tested: Full end-to-end gateway integration with a live Feishu
DM session. The unit tests and repro script exercise the production modules
directly and verify the fallback logic, but the original issue requires a
multi-process gateway setup with real channel credentials.
Regression Test Plan
node scripts/run-vitest.mjs src/agents/subagent-announce-delivery.test.tspasses (98/98)AI-assisted: built with Claude Code