Repository navigation
fix(sessions): preserve cross-agent replies after reload - #146799
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues; focused tests passed.
Pull request overview
Prevents detached sessions_send cross-agent announcements from losing replies after a config reload.
Changes:
- Clears inherited runtime-generation scope for detached A2A work.
- Adds regression coverage for generation-scope isolation.
File summaries
| File | Summary |
|---|---|
src/agents/tools/sessions.test.ts |
Verifies detached A2A work does not inherit the caller’s generation. |
src/agents/tools/sessions-send-tool.ts |
Isolates detached announcements from retired runtime generations. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
6629cd1 to
9a456f3
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 8:00 AM ET / 12:00 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR clears inherited caller and model-runtime context from detached cross-agent replies and adds a Gateway regression covering replies completed after configuration reload. Merge readiness✅ Ready for maintainer review The repair remains necessary: current main and the latest release retain the problematic inherited context. No actionable patch defect remains, and the reported production-Gateway regression provides sufficient proof for this bounded reliability fix. Priority: P1 Review scores
Verification
How this fits togetherThe sessions_send tool starts another agent turn and can arrange a later reply to the requesting session. Gateway work admission and model-runtime selection govern whether that follow-up can continue after its caller finishes or configuration changes. flowchart TD
A[Agent sends a message] --> B[Validate session access]
B --> C[Run target agent]
C --> D[Detach follow-up context]
E[Configuration reload] --> F[Select current model runtime]
D --> F
F --> G[Reply to requesting session]
G --> H[Release independent work root]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +7, Tests +435. Total +442 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep detached replies under the existing independent Gateway lifecycle while admitting subsequent turns against the current model runtime. Do we have a high-confidence way to reproduce the issue? Yes: source establishes inherited runtime context on detached replies, and the reported red/green Gateway scenario holds a target turn across reload after its sender finishes. This read-only review did not independently execute that scenario. Is this the best way to solve the issue? Yes: reusing the existing cleanup and generation-scope owners is a narrow repair that preserves explicit stale-generation rejection and avoids adding configuration or another runtime owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 970992db26c8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper re-review The repaired head now includes an after-fix ephemeral-Gateway E2E across a real config reload, verifies the detached requester reply uses model B, and waits for the independent A2A root to settle. The obsolete shard edits and the weaker scope-only regression were removed. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* temp/pr-146799: (70 commits) test: reuse explicit fallback config fixtures (openclaw#146948) fix(computer): return fresh window observations after actions (openclaw#146822) refactor(feishu): remove unreachable requester topic selection (openclaw#146904) improve(gateway): reduce CPU spent listing agent-owned sessions (openclaw#137745) fix(ui): avoid recapturing chat drafts during UI updates (openclaw#146884) fix(ui): show system uptime in the debug overlay (openclaw#146960) fix(retry): honor waits beyond the native timer limit (openclaw#145718) fix(ui): keep chat history idle when run status changes (openclaw#146802) fix(ui): reuse persisted text during chat streaming (openclaw#146831) refactor(qa): share harness drift result construction (openclaw#146903) test(agents): coordinate settings lock contention (openclaw#146949) fix(worker): avoid repeatedly serializing screenshot history (openclaw#146907) fix(secrets): stop buffered upload writes after cancellation (openclaw#146840) perf(doctor): avoid unnecessary state runtime imports (openclaw#146926) improve: reduce compaction request estimation work (openclaw#146961) fix(ci): wait for forwarded avatar imports before assertions (openclaw#146729) perf(workers): skip configured Git author lookups (openclaw#146833) fix: admit borrowed memory writes through the agent database owner (openclaw#146760) fix(discord): prevent voice playback gaps and stale turn controls (openclaw#146798) improve: reduce worktree filesystem stalls and archive syncs (openclaw#146906) ...
|
Merged via squash.
|
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
* temp/pr-145950: (101 commits) refactor(memory-wiki): share freshness result construction (#146935) improve(gateway): use metadata projection for presence (#146817) test(agents): reuse complete Responses model fixtures (#147015) fix(sessions): align the reclamation-memory test with the archive session owner (#147028) refactor(terminal): simplify copy-sensitive token checks (#146934) refactor(media): remove duplicate spaced path fallback (#146933) refactor(cli): reuse command-group names (#146893) improve(plugins): reduce JavaScript generation capture work (#146993) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) ...
* commit '060e856e5f9df245d63c98990fcb47e18108c6b9': (97 commits) refactor(memory-wiki): share freshness result construction (#146935) improve(gateway): use metadata projection for presence (#146817) test(agents): reuse complete Responses model fixtures (#147015) fix(sessions): align the reclamation-memory test with the archive session owner (#147028) refactor(terminal): simplify copy-sensitive token checks (#146934) refactor(media): remove duplicate spaced path fallback (#146933) refactor(cli): reuse command-group names (#146893) improve(plugins): reduce JavaScript generation capture work (#146993) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) ...
* temp/pr-137049: (110 commits) improve: reduce GitHub OAuth maintenance work for large agent rosters (#147021) fix(test): avoid settings lock writer startup timeouts (#147029) fix(update): correct backup guidance and cover incident regressions (#147023) refactor(gateway): share connection lifecycle across transports (#145950) refactor(telegram): share HTML text escaping (#146936) perf(build): reduce disk use in UI performance checks (#146687) refactor(memory-wiki): share freshness result construction (#146935) improve(gateway): use metadata projection for presence (#146817) test(agents): reuse complete Responses model fixtures (#147015) fix(sessions): align the reclamation-memory test with the archive session owner (#147028) refactor(terminal): simplify copy-sensitive token checks (#146934) refactor(media): remove duplicate spaced path fallback (#146933) refactor(cli): reuse command-group names (#146893) improve(plugins): reduce JavaScript generation capture work (#146993) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) ...
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
## What Problem This Solves A waited `sessions_send` to an agent's own visible child starts duplicate reply and announcement work after the child's reply already returned inline. Supersedes #144320 by @ylcn91. Closes #144265, reported by @tonyisblind. ## Why This Change Was Made Use the durable requester key and stored spawn lineage in the existing send owner. Suppress the extra work only when the reply returns inline; keep the continuation when the wait expires. Preserve the reload handling from #146799. ## User Impact The parent receives one inline child reply without re-entering the child. Late results still reach the parent. No configuration, storage, or protocol change is required. ## Evidence Real Discord recordings captured the same registered spawn/send flow: ```text main a2b2391: reply inline, delivery=pending, extra parent calls=1, extra child calls=1 candidate fe90c72: reply inline, delivery=skipped, extra calls=0 wait expiry: accepted/pending, then the held child reply reached the parent ``` The same two-turn QA direct-message Gateway test failed on unfixed main `6f58faf3eb0d` (exit 1): the inline reply had pending delivery and one extra parent reply step. It passed unchanged on the candidate and fresh merge (exit 0), with exact parent lineage, one child send, and no extra reply/announcement calls. Title requests were counted separately. 188 tests passed on merge `f62c21d708b4` with parents `fe90c7249869` and main `6f58faf3eb0d`, including the reload sibling. Commands: ```sh node scripts/run-vitest.mjs src/agents/openclaw-tools.sessions.test.ts src/agents/tools/sessions-send-tool.a2a.test.ts src/agents/tools/openclaw-tools.spawn-session-key.test.ts src/agents/tools/sessions.test.ts OPENCLAW_E2E_USE_PREBUILT_DIST=1 OPENCLAW_PROOF_VISIBLE_CHILD_SEND=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts src/gateway/gateway.sessions-send-hot-reload.e2e.test.ts test/e2e/qa-lab/runtime/sessions-send-visible-child.product-proof.e2e.test.ts ``` Formatting, source lint, assertion/file-size guards, unused-export scans, and architecture checks passed. CI owns typechecking. The delayed recording reached the parent, then logged the existing final-announcement error `Async work scope is closed`, also observed on main. This change does not claim to repair that separate error. ## Consumers The requester-key change also affects session visibility and label lookup, self-send detection, reply addressing, watch ownership, and inter-session provenance. These now use the same durable requester identity as spawn and session lookup. Authenticated caller routing and tool policy retain their existing inputs. The worker send path keeps its exact-session-instance restrictions. Visible and hidden owned-child tests release a held reply after the sending caller returns, then check that the parent receives it and retained work settles. Exact-session-instance tests still forbid detached delivery and durable watches. The existing reload continuation scopes remain intact. The separate final-announcement scope error remains excluded. Late-delivery evidence proves that the parent receives the held reply within the existing continuation window; it does not promise another public channel message or an unlimited wait. Supersedes #144320 by @ylcn91, whose four commits retain their authorship. Thanks to @tonyisblind for #144265. Co-authored-by: Yalçın Doksanbir <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…6799) * fix(sessions): re-admit detached A2A after reload * test(ci): rebalance agent test shards * fix(sessions): complete detached reload isolation --------- Co-authored-by: Vincent Koc <[email protected]>
…law#147394) ## What Problem This Solves A waited `sessions_send` to an agent's own visible child starts duplicate reply and announcement work after the child's reply already returned inline. Supersedes openclaw#144320 by @ylcn91. Closes openclaw#144265, reported by @tonyisblind. ## Why This Change Was Made Use the durable requester key and stored spawn lineage in the existing send owner. Suppress the extra work only when the reply returns inline; keep the continuation when the wait expires. Preserve the reload handling from openclaw#146799. ## User Impact The parent receives one inline child reply without re-entering the child. Late results still reach the parent. No configuration, storage, or protocol change is required. ## Evidence Real Discord recordings captured the same registered spawn/send flow: ```text main a9d0dc3: reply inline, delivery=pending, extra parent calls=1, extra child calls=1 candidate fe90c72: reply inline, delivery=skipped, extra calls=0 wait expiry: accepted/pending, then the held child reply reached the parent ``` The same two-turn QA direct-message Gateway test failed on unfixed main `3eafa82bb6c6` (exit 1): the inline reply had pending delivery and one extra parent reply step. It passed unchanged on the candidate and fresh merge (exit 0), with exact parent lineage, one child send, and no extra reply/announcement calls. Title requests were counted separately. 188 tests passed on merge `f62c21d708b4` with parents `fe90c7249869` and main `3eafa82bb6c6`, including the reload sibling. Commands: ```sh node scripts/run-vitest.mjs src/agents/openclaw-tools.sessions.test.ts src/agents/tools/sessions-send-tool.a2a.test.ts src/agents/tools/openclaw-tools.spawn-session-key.test.ts src/agents/tools/sessions.test.ts OPENCLAW_E2E_USE_PREBUILT_DIST=1 OPENCLAW_PROOF_VISIBLE_CHILD_SEND=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts src/gateway/gateway.sessions-send-hot-reload.e2e.test.ts test/e2e/qa-lab/runtime/sessions-send-visible-child.product-proof.e2e.test.ts ``` Formatting, source lint, assertion/file-size guards, unused-export scans, and architecture checks passed. CI owns typechecking. The delayed recording reached the parent, then logged the existing final-announcement error `Async work scope is closed`, also observed on main. This change does not claim to repair that separate error. ## Consumers The requester-key change also affects session visibility and label lookup, self-send detection, reply addressing, watch ownership, and inter-session provenance. These now use the same durable requester identity as spawn and session lookup. Authenticated caller routing and tool policy retain their existing inputs. The worker send path keeps its exact-session-instance restrictions. Visible and hidden owned-child tests release a held reply after the sending caller returns, then check that the parent receives it and retained work settles. Exact-session-instance tests still forbid detached delivery and durable watches. The existing reload continuation scopes remain intact. The separate final-announcement scope error remains excluded. Late-delivery evidence proves that the parent receives the held reply within the existing continuation window; it does not promise another public channel message or an unlimited wait. Supersedes openclaw#144320 by @ylcn91, whose four commits retain their authorship. Thanks to @tonyisblind for openclaw#144265. Co-authored-by: Yalçın Doksanbir <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #144291
What Problem This Solves
Fixes an issue where a completed cross-agent
sessions_sendreply could disappear after a configuration reload because detached follow-up work retained the completed caller's runtime identity.Why This Change Was Made
The detached A2A flow already owned an independent Gateway work root, but it still captured both the caller's cleanup context and prepared-runtime generation. The repair clears those inherited scopes before creating the independent root, so later reply turns re-admit against the current runtime without weakening explicit stale-generation rejection.
The obsolete test-shard edits from the earlier revision were removed.
User Impact
Cross-agent replies that finish after a configuration reload continue on the newly published model runtime instead of silently failing on the retired caller generation.
Evidence
sessions_sendwithtimeoutSeconds: 0, holds the target turn across aconfig.patchfrom model A to model B, then verifies:session:a2a-sendroot settles before teardown.+35/-28(net+7); tests+435.The provider is mocked, but the Gateway, config reload, agent runs, tool dispatch, detached continuation, model selection, and root-work lifecycle are the real runtime path.