Repository navigation
fix(gateway): route detached announce by instance - #125946
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 8:04 PM ET / August 19, 2026, 00:04 UTC. ClawSweeper reviewWhat this changesThe PR routes detached subagent completion announcements through the Gateway instance resolver and adds an isolated QA Lab worker-reload scenario. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still routes detached announces through the process-global lifecycle dispatcher, while this branch selects the existing resolver-aware dispatcher; no blocking correctness finding was found. The PR is maintainer-owned/labelled and has incomplete exact-head checks, so it needs normal maintainer handling rather than automated closure. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherDetached subagent completion occurs after the original Gateway request can end, so its reply dispatch must retain the admitting Gateway instance. The added QA scenario drives a paired worker through plugin-generation reloads and verifies the resulting reply lifecycle. flowchart LR
A[Gateway request] --> B[Subagent completion]
B --> C[Stored instance resolver]
C --> D[In-process Gateway dispatch]
D --> E[Reply delivery and task settlement]
F[Plugin generation reload] --> G[Worker inference]
G --> E
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +838, Other +32. Total +870 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the explicit resolver as the sole detached-dispatch owner, then merge after exact-head validation confirms visible completion delivery and exact-once settlement. Do we have a high-confidence way to reproduce the issue? Yes. Current main forwards an instance resolver but the barrel at src/agents/subagents/announce/subagent-announce.runtime.ts:8 exports a dispatcher that ignores it; the focused test exercises that detached path with only the explicit resolver. Is this the best way to solve the issue? Yes. Reusing the existing resolver-aware in-process dispatcher fixes the owner boundary without restoring a process-global fallback or adding a parallel dispatch path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 10610d9f639e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
bcf8eb8 to
7c7bade
Compare
7c7bade to
5fd36be
Compare
7eaf984 to
07ab482
Compare
|
Land-ready proof for
Validation:
No UI/visual proof applies. A local generated-metadata check previously hit this host’s 30-second formatter cap during severe filesystem pressure; the exact-head |
|
Land-ready proof for exact head
Production LOC is +1/-1 (net 0); tests/QA support is +892/-22. READY FOR |
|
Merged via squash.
|
The vi.mock of resolveGatewayModelSupportsImages in server.chat.gateway-server-chat.test.ts was added by #123847 as an isolation workaround while the gateway shard's chat failures were unexplained. The producers are fixed on main (#126183 for the root-work drain race; #126062/#125946/#126113 for detached completion binding), and the exact #126030 shard invocation is green with the mask removed (5/5 on 95ac5b2, 2/2 on this head), so the mask now only hides the real capability-resolution path from the suite.
* test(gateway): drop the chat image-capability mask The vi.mock of resolveGatewayModelSupportsImages in server.chat.gateway-server-chat.test.ts was added by #123847 as an isolation workaround while the gateway shard's chat failures were unexplained. The producers are fixed on main (#126183 for the root-work drain race; #126062/#125946/#126113 for detached completion binding), and the exact #126030 shard invocation is green with the mask removed (5/5 on 95ac5b2, 2/2 on this head), so the mask now only hides the real capability-resolution path from the suite. * test(gateway): assert inline-image dispatch after mask removal ClawSweeper P2 on #126217: the two image sends only asserted RPC success and drain, so a silent false from the real capability resolver would offload the images and the suite would stay green without proving the discovered model's image capability. Capture the dispatch args and assert both runs deliver exactly one inline image. Teeth check: with the discovered model narrowed to text-only input, the assertion fails with images undefined (offloaded).
* test(qa): cover worker generation reload * test(qa): anchor worker generation fixture * test(qa): strengthen worker generation proof * test(qa): stabilize terminal reply smoke waits * test(qa): widen terminal reply CI budget * test(qa): drop superseded timeout workaround * fix(gateway): route detached announce by instance
* test(gateway): drop the chat image-capability mask The vi.mock of resolveGatewayModelSupportsImages in server.chat.gateway-server-chat.test.ts was added by openclaw#123847 as an isolation workaround while the gateway shard's chat failures were unexplained. The producers are fixed on main (openclaw#126183 for the root-work drain race; openclaw#126062/openclaw#125946/openclaw#126113 for detached completion binding), and the exact openclaw#126030 shard invocation is green with the mask removed (5/5 on 534f1cb, 2/2 on this head), so the mask now only hides the real capability-resolution path from the suite. * test(gateway): assert inline-image dispatch after mask removal ClawSweeper P2 on openclaw#126217: the two image sends only asserted RPC success and drain, so a silent false from the real capability resolver would offload the images and the suite would stay green without proving the discovered model's image capability. Capture the dispatch args and assert both runs deliver exactly one inline image. Teeth check: with the discovered model narrowed to text-only input, the assertion fails with images undefined (offloaded).
Related: #125761, #125821, #126062
What Problem This Solves
Completes the instance-bound subagent delivery repair from #126062. That fix carried the originating Gateway resolver to detached completion delivery, but the announce runtime still re-exported the process-global lifecycle dispatcher. The resolver was therefore rejected by typechecks and ignored at runtime, leaving current
mainred and detached completion QA unable to settle.This PR also adds the requested real QA Lab coverage for the worker inference generation repair in #125761.
Why This Change Was Made
The direct announce runtime now uses the narrow resolver-aware in-process dispatcher. Its focused test dispatches after request scope using only the explicit Gateway instance resolver.
The worker QA scenario uses a real paired-node worker and mock-openai transport. A generation A baseline establishes placement lifecycle; generation B pauses after model/auth preparation while generation C hot-publishes, proving factory, policy, wrapper, execution, wire credential, and exact-once reply ownership remain on the admitted generation.
User Impact
Background subagent completions can use the Gateway instance that admitted them instead of getting stuck after the parent request scope ends. Maintainers also gain product-boundary regression coverage for worker inference generation ownership.
Release-note context: fixes detached subagent completion replies failing after the instance-bound Gateway runtime refactor.
Production LOC: +1/-1 (net 0). Tests and QA support: +892/-22 (net +870).
Evidence
Exact accepted head:
7beedfebb18db76b0f36164dea64b366c8203047.node scripts/run-vitest.mjs src/agents/subagents/announce/subagent-announce-delivery.runtime.test.ts— 1 test passed.pnpm tsgo:core && pnpm tsgo:core:test— passed.pnpm test:extensions:package-boundary:compile— passed for all 122 plugins.node scripts/run-vitest.mjs extensions/qa-lab/src/scenario-catalog.inference.test.ts— 4 tests passed.pnpm openclaw qa suite --scenario worker-inference-generation-reload --provider-mode mock-openai --output-dir .artifacts/qa-e2e/worker-inference-generation-reload-7beedf— passed in 22.2s on the exact head; runtime credential generations were exactly A/B/C, all four provider stages stayed on their admitted generation, and each exact assistant reply persisted once.pnpm openclaw qa suite --scenario subagent-completion-direct-fallback --provider-mode mock-openai --output-dir .artifacts/qa-e2e/subagent-completion-direct-fallback-7beedf— passed on the exact head with the original three 60000ms durable waits unchanged. This PR has no diff inqa/scenarios/agents/subagent-completion-direct-fallback.yaml.node scripts/check-changed.mjs -- <seven changed files>— passed all selected guards, formatting, full typecheck, lint, dead-export, boundary, and import-cycle lanes.git diff --check origin/main...HEAD— passed.openclaw/ci-gatesucceeded;node scripts/watch-pr-ci.mjs 125946 7beedfebb18db76b0f36164dea64b366c8203047returnedGREEN.origin/mainwas inspected.