fix: preserve subagent delivery after lock stalls#86540
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 29, 2026, 8:36 AM ET / 12:36 UTC. Summary PR surface: Source +46, Tests +15. Total +61 across 5 files. Reproducibility: yes. at source level: current main still clears completion fallback during suspended-delivery expiry while the recovery path reads that fallback text, and linked reports include repeated live lock/lost-delivery logs. I did not run the timing-sensitive live gateway race in this read-only review. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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: Rebase onto current main, keep the durable fallback preservation if it still fits the current lifecycle code, reconcile the lock-diagnostic overlap, and land only after maintainers accept live proof or explicitly waive it. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main still clears completion fallback during suspended-delivery expiry while the recovery path reads that fallback text, and linked reports include repeated live lock/lost-delivery logs. I did not run the timing-sensitive live gateway race in this read-only review. Is this the best way to solve the issue? Mostly yes: preserving final text in the existing completion fallback is the narrow repair for the durable-loss path. The exact PR is not merge-ready until it is rebased across current lock changes and maintainers accept live proof or waive it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 355c43fe0c9e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +46, Tests +15. Total +61 across 5 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
Review history (1 earlier review cycle)
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
Thanks for the PR. Before this can move forward, please add live proof from the affected surface, not just unit tests, mocked tests, or source inspection. A useful proof update should include:
Please redact secrets, tokens, phone numbers, and private message content from logs or screenshots. |
martingarramon
left a comment
There was a problem hiding this comment.
Verified at f9c6fc7d.
Two distinct changes in this PR:
Lock timeout diagnostics (session-write-lock.ts): formatSessionLockTimeoutOwner assembles pid + liveness + starttime + age into the timeout error. The pinCurrentProcessStartTimeForTest addition in the test is needed to make starttime assertions deterministic. ✓
Durable fallback preservation (subagent-registry.ts): before expiring a suspended delivery, checks frozenResultText ?? fallbackFrozenResultText and persists it into completion.fallbackResultText if present. discardReason distinguishes "expired-after-durable-fallback" from "expired". The type in subagent-registry.types.ts is updated to match. ✓
Three CI failures need resolution before merge:
check-prod-typesandcheck-additional-extension-package-boundary— likely the newfallbackResultText/fallbackCapturedAtfields on thecompletiontype are not exported through the package boundary; verifysrc/agents/subagent-registry.types.tsre-exports reach the extension bundle entry.check-test-types— if a new field is referenced in a test that the type declaration doesn't yet include.
LGTM pending CI.
|
Maintainer prep update for Evidence collected
Review result Current blocker I would not call this fully land-ready while required CI is red. The PR-specific code/test evidence is clean; remaining decision is whether to fix/override the unrelated qa-lab CI blocker and whether the targeted Azure before/after proof is enough versus requiring a live gateway/session replay. |
This comment was marked as spam.
This comment was marked as spam.
|
Cross-posting fresh Feishu production evidence because this thread is related. Context for this thread: Open PR touching subagent delivery after lock stalls; adding production evidence for validation. Additional production evidence from Feishu DM lane (2026-06-26)I'm adding fresh production evidence from a Feishu direct-message session on OpenClaw Environment
SummaryThe Feishu lane repeatedly became unable to reliably receive normal user messages or subagent completion announcements while a long-running/compacting requester session was active. The failures were not isolated to one child run; they formed a cascade:
Counts from today's Feishu-related gateway logsFrom
Some early entries are provider/rate-limit failures, but the afternoon cluster below is specifically session lock / takeover / completion delivery related. Representative timeline excerpt, redactedLock file state observed during the incidentThe active Feishu requester session lock was owned by the live Gateway process, not an orphaned PID: {
"pid": <gateway-pid>,
"createdAt": "2026-06-26T06:52:28.443Z",
"maxHoldMs": 300000,
"starttime": 131306136
}The important mismatch remained: callers were failing after User-visible impactThe workflow was a serial paper-reading chain (
Why this seems relevant hereThis looks like the same family as the session write-lock / long-turn / subagent delivery lane issues, but today's evidence adds two details:
If useful, I can provide a fuller redacted log bundle, but I avoided pasting full paths, Feishu IDs, or local project contents here. |
|
Linking #96975 as related design context for this PR: preserving subagent delivery after lock stalls would be more robust if completion delivery is metadata-only by default rather than carrying large child payloads. |
Summary
Linked context
Which issue does this close?
Closes #86537
Closes #86538
Which issues, PRs, or discussions are related?
Related #86537
Related #86538
Was this requested by a maintainer or owner?
Local bug evidence under
/mnt/c/OpenClaw/bugs/BUG-035-subagent-terminal-reconciliation-times-out-then-discards-deliveryand/mnt/c/OpenClaw/bugs/BUG-036-session-write-lock-timeouts-block-main-and-subagent-lanes.Real behavior proof (required for external PRs)
silver-prawn/cbx_e06ef86ae274; after proof used Azure Crabboxviolet-lobster/cbx_3eda7a42d715.node scripts/run-vitest.mjs src/agents/subagent-registry.test.ts src/agents/session-write-lock.test.ts;git diff --check;.agents/skills/autoreview/scripts/autoreview --mode local; Azure Crabbox before/after focused regression proof.RUN v4.1.7 /home/galini/GitHub/worktrees/bug-035-036-subagent-delivery-locks Test Files 4 passed (4) Tests 144 passed (144) Start at 15:01:23 Duration 16.11s autoreview clean: no accepted/actionable findings reported overall: patch is correct (0.84)Azure Crabbox after-fix evidence log:
discardReason: "expired-after-durable-fallback"pluscompletion.fallbackResultText; the session lock regression observes timeout owner text withpid=,alive=true,starttime=, andcurrentStarttime=. Azure Crabbox after-fix proof passed the focused regression set at headf9c6fc7de291905233e7d5ca65201f6d299e00ab.Redacted original symptom evidence:
Azure Crabbox before-fix evidence log:
Tests and validation
Which commands did you run?
node scripts/run-vitest.mjs src/agents/subagent-registry.test.ts src/agents/session-write-lock.test.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode localsilver-prawn/cbx_e06ef86ae274, basec4bce00727ec5f6a5b9c78e0ad34524f5dc1db54, observedBEFORE_FIX_TEST_EXIT=1andBEFORE_FIX_EXPECTED_REGRESSION=1.violet-lobster/cbx_3eda7a42d715, headf9c6fc7de291905233e7d5ca65201f6d299e00ab, observedAFTER_FIX_TEST_EXIT=0andAFTER_FIX_REGRESSION_PASSED=1.What regression coverage was added or updated?
src/agents/subagent-registry.test.tsnow verifies durable fallback preservation on suspended final-delivery expiry.src/agents/session-write-lock.test.tsnow verifies timeout owner diagnostics include liveness/starttime details.What failed before this fix, if known?
c4bce00727ec5f6a5b9c78e0ad34524f5dc1db54and observed the expected regression failure.If no test was added, why not?
N/A
Risk checklist
Did user-visible behavior change? (
Yes/No)Yes
Did config, environment, or migration behavior change? (
Yes/No)No
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No
What is the highest-risk area?
Subagent final-delivery cleanup state.
How is that risk mitigated?
The delivery payload is still compacted on expiry, but final text is copied into the existing completion fallback field before the payload is removed; pressure-pruned deliveries remain unchanged.
Current review state
What is the next action?
Maintainer review and CI.
What is still waiting on author, maintainer, CI, or external proof?
Live replay of the original private sessions was not run. Required CI is currently blocked by an unrelated type error in
extensions/qa-lab/src/live-transports/whatsapp/whatsapp-live.runtime.ts:872.Which bot or reviewer comments were addressed?
Autoreview reported no accepted/actionable findings. Azure Crabbox before/after focused evidence was added to the PR description.