Skip to content

fix(sessions): preserve cross-agent replies after reload - #146799

Merged
vincentkoc merged 6 commits into
openclaw:mainfrom
zachisfine:fix/144291-detached-a2a-generation
Sep 13, 2026
Merged

vincentkoc merged 6 commits into
openclaw:mainfrom
zachisfine:fix/144291-detached-a2a-generation

Conversation

@zachisfine

@zachisfine zachisfine commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144291

What Problem This Solves

Fixes an issue where a completed cross-agent sessions_send reply 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

  • Added an end-to-end runtime regression using an ephemeral production Gateway and a mock OpenAI-compatible provider. It dispatches sessions_send with timeoutSeconds: 0, holds the target turn across a config.patch from model A to model B, then verifies:
    • the target reply remains visible;
    • the detached requester reply runs on model B;
    • the independent session:a2a-send root settles before teardown.
  • Red/green proof: the E2E failed on pre-fix current-main production code because no model-B detached reply occurred, then passed with this repair.
  • Final E2E: 1/1 passed.
  • Focused sibling proof: 129/129 sessions/A2A tests and 17/17 local request-context tests passed.
  • Full changed-file gate passed, including production/test type checks, formatting, lint, architecture guards, dead-export scan, and import-cycle checks.
  • Independent P0-P2 autoreview: scoped clean.
  • Final diff against current main: production +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.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Sep 13, 2026
@zachisfine
zachisfine marked this pull request as ready for review September 13, 2026 06:29
Copilot AI lite review requested due to automatic review settings September 13, 2026 06:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@zachisfine
zachisfine force-pushed the fix/144291-detached-a2a-generation branch from 6629cd1 to 9a456f3 Compare September 13, 2026 06:50
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 8:00 AM ET / 12:00 UTC (Revision 6).

ClawSweeper review

What this changes

The 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
Reviewed head: 11d706c69736e2331608e0a8808f502c469d9775

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful production-boundary regression proof and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The reported red/green ephemeral-Gateway run exercises real dispatch, HTTP transport, configuration reload, and detached continuation: model-A target work finishes, one requester reply uses model B, and the independent root settles. A MEMBER corroborates the result, and the tested files are unchanged since that review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The reported red/green ephemeral-Gateway run exercises real dispatch, HTTP transport, configuration reload, and detached continuation: model-A target work finishes, one requester reply uses model B, and the independent root settles. A MEMBER corroborates the result, and the tested files are unchanged since that review.
Evidence reviewed 8 items Introduced repair: The pinned merge-base-to-head diff adds existing cleanup and generation-scope helpers around the detached continuation. Target selection, initial access checks, scoped-grant exclusions, and reply parameters remain unchanged.
Current main and release still need the repair: Inspected fetched main and v2026.9.4: both start the independent continuation without clearing caller identity or prepared generation. No supplied merged related PR establishes that this detached sessions_send defect is already fixed.
Cleanup preserves routing and restrictions: The existing cleanup helper preserves the Gateway resolver; operator cleanup preserves actor and scopes. Existing authorization tests reject foreign-session operations after cleanup and reject retired Gateway bindings. The sessions_send boundary also excludes exact-incarnation grants from detached work.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +7, Tests +435. Total +442 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 35 28 +7
Tests 2 435 0 +435
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 470 28 +442

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +7 lines; tests +435 lines The small production increase reuses existing lifecycle helpers; the larger test addition exercises the real reload and detached-reply boundary.

Technical review

Best 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.

Labels

Label justifications:

  • P1: Configuration reload can suppress an expected cross-agent reply in an established agent workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The reported red/green ephemeral-Gateway run exercises real dispatch, HTTP transport, configuration reload, and detached continuation: model-A target work finishes, one requester reply uses model B, and the independent root settles. A MEMBER corroborates the result, and the tested files are unchanged since that review.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported red/green ephemeral-Gateway run exercises real dispatch, HTTP transport, configuration reload, and detached continuation: model-A target work finishes, one requester reply uses model B, and the independent root settles. A MEMBER corroborates the result, and the tested files are unchanged since that review.

Evidence

What I checked:

  • Introduced repair: The pinned merge-base-to-head diff adds existing cleanup and generation-scope helpers around the detached continuation. Target selection, initial access checks, scoped-grant exclusions, and reply parameters remain unchanged. (src/agents/tools/sessions-send-tool.ts:1075, 11d706c69736)
  • Current main and release still need the repair: Inspected fetched main and v2026.9.4: both start the independent continuation without clearing caller identity or prepared generation. No supplied merged related PR establishes that this detached sessions_send defect is already fixed. (src/agents/tools/sessions-send-tool.ts:1072, 970992db26c8)
  • Cleanup preserves routing and restrictions: The existing cleanup helper preserves the Gateway resolver; operator cleanup preserves actor and scopes. Existing authorization tests reject foreign-session operations after cleanup and reject retired Gateway bindings. The sessions_send boundary also excludes exact-incarnation grants from detached work. (src/agents/tools/in-process-gateway.ts:105, 11d706c69736)
  • After-fix production-path proof: The captured PR body reports a failing pre-fix run and passing after-fix run; vincentkoc corroborates the ephemeral-Gateway proof at fix(sessions): preserve cross-agent replies after reload #146799 (comment). The inspected test uses a real Gateway client and HTTP provider transport, holds model-A target execution across config.patch, observes the visible target result and exactly one model-B requester reply, and waits for root settlement. The provider responses are scripted; Gateway reload, dispatch, execution, and lifecycle owners are real. This review did not execute tests. (src/gateway/gateway.sessions-send-hot-reload.e2e.test.ts:234, 11d706c69736)
  • Re-review continuity: All three currently introduced files are unchanged from the previous reviewed head. The prior completed review had no findings; the current introduced diff contains no test-shard configuration edits. (11d706c69736)
  • Existing behavior and implementation boundary: Session-tool documentation defines nonblocking sends and the subsequent reply-back loop. The generation-scope helper belongs to OpenClaw's runtime; the changed path and proof do not depend on the Codex harness or protocol. Public docs: docs/concepts/session-tool.md. (docs/concepts/session-tool.md:136, 11d706c69736)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-13T06:54:48.178Z sha 9a456f3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-13T07:36:02.980Z sha 42beeac :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-13T08:00:23.904Z sha ed0181a :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-13T08:20:53.000Z sha 7e07f03 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-13T09:57:17.642Z sha f58425f :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: L and removed size: S labels Sep 13, 2026
@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@vincentkoc vincentkoc changed the title fix: prevent cross-agent reply loss after config reload fix(sessions): preserve cross-agent replies after reload Sep 13, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@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.

@clawsweeper

clawsweeper Bot commented Sep 13, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 13, 2026
* 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)
  ...
@vincentkoc
vincentkoc merged commit 2a9daef into openclaw:main Sep 13, 2026
215 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* 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)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* 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)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* 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)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* 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)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* 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)
  ...
obviyus added a commit that referenced this pull request Sep 13, 2026
## 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]>
@zachisfine
zachisfine deleted the fix/144291-detached-a2a-generation branch September 14, 2026 00:44
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

3 participants