Skip to content

fix(gateway): session lifecycle plugin hooks skip deferred cleanup after the request closes - #148089

Merged
Patrick-Erichsen merged 8 commits into
openclaw:mainfrom
xialonglee:fix/gap-session-hook-detached-continuation
Oct 2, 2026
Merged

Patrick-Erichsen merged 8 commits into
openclaw:mainfrom
xialonglee:fix/gap-session-hook-detached-continuation

Conversation

@xialonglee

@xialonglee xialonglee commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #146349, already addressed by #146350; no new closing claim.

What Problem This Solves

Deferred plugin session_end and session_start work can fail after the request that reset, deleted, or rolled over the session closes. The callback retains a Gateway reservation but inherits a closed async work scope, so tracked cleanup never completes.

User Impact

Deferred lifecycle work, such as a plugin memory flush, can finish after requester closure. Gateway shutdown continues to account for it and releases the reservation on completion or failure. Hook payloads, invocation permissions, configuration, public SDK contracts and persisted data do not change.

Why This Change Was Made

Use the existing detached continuation at all four Gateway/reply lifecycle emitters. It creates a fresh async work scope while preserving the existing admission fences and drain ownership. Reply start/end dispatch now lives together in the session-hook owner; browser cleanup and directly awaited shutdown keep their distinct lifetime contracts.

The test support exposes the existing prepared-config comparator and moves the pure empty metadata factory to type-only support, removing an import cycle across all eight consumers. Two receipt expectations now follow the already-landed routing owner: same-model retries remain ordinary selections, while real fallback preserves its recorded stage and reason. Counts, targets, skipped-candidate absence, test order and timeouts remain intact.

Evidence

The retained before/after probe uses real lifecycle emitters, production hook dispatch, disk-loaded callbacks, async scopes and file effects, with the request fully closed before releasing the callback:

Scenario Before After
Gateway/reply cleanup after requester closure Closed-scope error; file effect absent Effect completes; Gateway roots drain 1 → 0
No-parent lifecycle callback Completes Completes with drain accounting
Delayed callback failure Cleanup is never reached Effect runs, failure remains visible, roots drain

The real reply initialization/SQLite regression also covers start and end together. Registry initialization is direct: this proves the lifecycle owner boundary, not public plugin loading or deployed provider/channel transport. Retained lifecycle and fixture evidence.

The paired receipt proof reproduces the exact CI failure in original 27-case order: 2 failed/25 passed →27/27 passed. Nine selected fallback controls and four receipt-authority controls also pass (40 distinct cases; 125 unrelated sibling cases intentionally unselected). Vitest times are 27.82s before and 21.64s after; build-inclusive commands are 436.963s and 423.570s. The scoped canonical gate passed in 128.260s and fresh canonical autoreview found no findings. These are cost observations, not a speedup claim.

Final Integration and Validation

Final candidate: 71799815480d3d13454c270c0d5b27214df0d02b. The merge preserves current main's compatibility inventory in all six former support files; none remains in the final diff. Both compatibility conflicts are resolved without restoring retired entries or changing deadlines. Current-main fallback provenance remains unchanged.

On this exact integration, 71/71 existing isolated-completion consumer cases passed in 30.192s wall; the selected agents-root type graph, composed-file formatting, whitespace, runtime AST equivalence and source/process audits passed. The 15 feature paths match the previously qualified CI projection, apart from a runtime-identical mock type annotation. Package/workspace/lock inputs match that local proof; this is not a claim about subsequent main dependency updates. All invoked processes joined.

Earlier 186-case fixture proof and the 421.598s full gate remain linked historical evidence. The original 141-case lifecycle suite is not claimed to be an unchanged current rerun: main refactored one automatic-reset sibling test. Fresh exact-head hosted CI and the required aggregate gate passed. CI checked merge 1b60abc3562f01bdb8bdb0d698b32a747f090774 on main 81f65e98ad4ec5270c864d641950eb2067f84802, preserving all 15 PR paths. That newer main uses dotenv18.0.3; the retained local proof uses18.0.1. Source/dependency continuity through native baseline 7fc0cfb379f4ba6f3eefd75a1e342f56dc859415 was reviewed separately. Native prepare/merge are the final operations.

ClawSweeper revision 9 reviews this exact head, reports no code/security finding and sufficient behavior proof, and explicitly resolves the prior integration blocker. Before merge: None; no current rank-up moves.

Scope and Review Notes

Final 15-file delta: production +19/-10 (net +9); tests/support +241/-79; docs 0. Production growth consolidates reply-start dispatch into the existing lifecycle owner and documents its non-obvious lifetime invariant while shrinking the oversized initializer. No new config, schema, protocol, dependency, fallback or persistence behavior.

The distinct before_reset fire-and-forget lifetime remains a named follow-up audit because its precommit contract differs; no additional failure is claimed here. Original contributor: @xialonglee. Preserve existing assignee @fuller-stack-dev.

@clawsweeper

clawsweeper Bot commented Sep 14, 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 gateway Gateway runtime size: M labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 11:11 PM ET / October 2, 2026, 03:11 UTC (Revision 9).

ClawSweeper review

What this changes

The branch lets deferred session-start and session-end plugin work finish after requester closure, strengthens lifecycle regressions, and repairs shared test fixtures.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary on current main. The latest integration resolves the prior conflict blocker, preserves reviewed behavior, and introduces no actionable correctness or security finding.

Priority: P2
Reviewed head: 71799815480d3d13454c270c0d5b27214df0d02b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with strong retained behavior proof, meaningful regressions, and verified resolution of the prior integration concern.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Retained paired production-boundary logs exercise Gateway/reply lifecycle emitters with disk-loaded callbacks and real async scopes: after requester closure, candidate file effects complete and reservations drain, including failure recovery. Integration preserves the reviewed dispatch owners; public plugin loading and deployed transports are outside this proof. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): Retained paired production-boundary logs exercise Gateway/reply lifecycle emitters with disk-loaded callbacks and real async scopes: after requester closure, candidate file effects complete and reservations drain, including failure recovery. Integration preserves the reviewed dispatch owners; public plugin loading and deployed transports are outside this proof. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduced change: The complete pinned base-to-head diff changes four lifecycle dispatch sites to the existing detached continuation. Payload construction and plugin dispatch remain with their existing owners; other changes repair tests and test support.
Current main still needs the repair: Fetched main still dispatches Gateway lifecycle callbacks through the independent continuation, which retains the request's async scope. Reply lifecycle dispatch has the same remaining mechanism. The merged automatic-reset repair addresses a separate emitter.
Existing lifetime owner: The detached continuation shares the independent continuation's admission decision, creates a fresh async work scope, and retains a Gateway reservation through tracked cleanup. This repairs work ownership without adding method authority or changing plugin permissions.
Findings None None.
Security None None.

How this fits together

Gateway session operations and reply initialization emit lifecycle events to plugins. The work-admission owner tracks those callbacks so deferred effects can complete while shutdown accounts for outstanding work.

flowchart TD
  A[Gateway session operation] --> C[Session lifecycle emitter]
  B[Reply initialization] --> C
  C --> D[Existing admission checks]
  D --> E[Detached work scope]
  E --> F[Plugin callback and deferred effects]
  F --> G[Release Gateway drain reservation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +9, Tests +162. Total +171 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 3 19 10 +9
Tests 12 241 79 +162
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 260 89 +171

Review metrics

Metric Value Why it matters
Production versus test growth Production net +9 lines; tests/support net +162 lines The small production increase consolidates reply-start dispatch in its existing owner; most growth supplies lifetime regressions and fixture repairs.

Technical review

Best possible solution:

Use the existing detached-work owner consistently for deferred lifecycle callbacks while preserving bounded transcript access and Gateway drain accounting.

Do we have a high-confidence way to reproduce the issue?

Yes. Hold a lifecycle callback, close its originating request scope, then release it into tracked work; current main retains the closed scope, and the captured paired proof records the failure.

Is this the best way to solve the issue?

Yes. Reusing the existing detached continuation repairs the lifetime mismatch without introducing another admission owner or changing public contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against acfd767f1502.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs deferred plugin lifecycle work with a limited blast radius and no demonstrated core outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): Retained paired production-boundary logs exercise Gateway/reply lifecycle emitters with disk-loaded callbacks and real async scopes: after requester closure, candidate file effects complete and reservations drain, including failure recovery. Integration preserves the reviewed dispatch owners; public plugin loading and deployed transports are outside this proof. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Retained paired production-boundary logs exercise Gateway/reply lifecycle emitters with disk-loaded callbacks and real async scopes: after requester closure, candidate file effects complete and reservations drain, including failure recovery. Integration preserves the reviewed dispatch owners; public plugin loading and deployed transports are outside this proof. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Erick Kinnee: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: 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 (8 earlier review cycles)
  • reviewed 2026-09-14T08:32:05.745Z sha d1ea42c4260859c514ef3bd315b1c960a31e2b1e :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-14T16:21:00.826Z sha d1ea42c4260859c514ef3bd315b1c960a31e2b1e :: needs maintainer review before merge. :: none
  • reviewed September 24, 2026, 2:32 AM ET / 06:32 UTC (Revision 3) sha unknown :: needs maintainer review before merge. :: none
  • reviewed 2026-10-01T21:19:21.961Z sha 46f5d3b :: needs changes before merge. :: none
  • reviewed 2026-10-01T22:41:29.793Z sha f80d957 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-01T23:47:13.053Z sha 8426874 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T02:01:38.301Z sha e5bd0d4 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T02:57:01.840Z sha 1addcb2 :: blocked before merge. :: none

@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 14, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 14, 2026
@Patrick-Erichsen
Patrick-Erichsen force-pushed the fix/gap-session-hook-detached-continuation branch from d1ea42c to 46f5d3b Compare October 1, 2026 21:10
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Published repair: 46f5d3be3da0499181b1c3ecf4b14c51b595a3ec.

Refreshed the patch for the current Gateway hook owner and covered the same closed-request bug in reply rollover end/start hooks.

Fresh before/after production-owner proof reproduces missing deferred effects and Async work scope is closed before the fix. All five candidate scenarios complete their effects afterward and release Gateway root reservations; the deliberate handler failure remains observable. The PR description contains the boundary details and limits.

141 focused tests passed, followed by 26 affected tests after the final owner extraction. Core/test types, lint, formatting, and file-size ratchets passed. Full canonical changed checks also passed, including all 28 core test graphs. Fresh canonical autoreview over the complete five-file candidate passed at its default P0 threshold with no findings. Exact-head hosted CI and native landing gates remain to be completed.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Apply the existing upstream readiness synchronization from dd2a7ba (openclaw#162869). Preserve the expected enabled state and existing deadline.
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Oct 1, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Current head: f80d957e36dd75128b0dcbf2c1b81d0097bd4156.

The shared effort-picker failure is covered by the existing upstream repair in PR 162869, merged as dd2a7baba6c0701d7a77dc4ef471015cd8b8d61b. The fixture asserted enablement immediately after visibility, although the composer deliberately renders the effort <summary> while chat hydration can still disable it (chat-pane-session-controls.ts:263, chat-model-controls.ts:579-601, chat-effort-picker.ts:208-224). Model-trigger readiness was already awaited separately.

The adopted upstream hunk waits for the same aria-disabled="false" state using the existing polling deadline, then retains the click and slider-enabled checks. It changes no production code, timeout, expected result, or Gateway retry behavior; production delta 0, test delta +1/-1, no added cases.

Proof: the upstream hosted real-Gateway job explicitly passed this scenario in 9.74s after the correction (14.75s including fixture). The byte-identical hunk also passed both routes locally against freshly built PR 148089 head 46f5d3be3da0499181b1c3ecf4b14c51b595a3ec: test 14.53s, file 25.41s, wrapper 54.14s. Command: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/model-catalog-partial-refresh.real-gateway.e2e.test.ts --maxWorkers=1.

The local run used the supported serial config because the prebuilt CI config requires a clean committed tree; no freshness gate was bypassed. The original local head also passed, so that replay alone was not used to claim a fix. Original failing CI logs and merge identities were retained. Exact-head CI for each adopted PR remains separate from this upstream/local proof.

Measured test cost from the retained final 26-test extraction run: src/gateway/session-lifecycle-plugin-hooks.test.ts — 4/4 passing, 54.41s file wall time (93% transformation; test bodies 33ms combined); src/auto-reply/reply/session-hooks-context.test.ts — 22/22 passing, 19.57s file wall time. The repository wrapper completed both shards in 83.68s. These are measured local file/runner times, not added CI cost. The preceding repeated run measured 32.91s / 57.37s (98.87s wrapper), demonstrating compiler/cache and concurrent-host variation. No sleeps, polling loops, network calls, or per-case Gateway starts were added to those tests.

Available hosted timing: CI run 36926894979 on head 46f5d3be3da0499181b1c3ecf4b14c51b595a3ec took 1,243s from workflow start to update; build-artifacts took 333s. This historical run failed the separate partial-refresh UI and OAuth reply-entry jobs, so its timing is not presented as a green run. Fresh exact-head CI follows the upstream UI readiness correction; no CI-seconds savings claim is made.

The separate OAuth reply-entry CI failure was replayed with freshly built exact source: all9 cases passed unmodified. Fresh hosted CI remains required; that local replay alone is not called a repair.

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Oct 1, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Final candidate: 842687485412397b969ab00907f6586d529a6efb.

CI integration repair: the main reply-path thinking change (2fe17061547884d7d8cd22edd0433e1e6e459b6c) now reads the real prepared-config comparator before a provider attempt. The shared fast E2E fixture omitted that export, so Vitest threw before the six non-OpenAI provider attempts. The reply layer returned its generic error, obscuring the missing fixture contract behind the later attempt-count assertion.

The repair exposes the existing owner’s preparedModelRuntimeConfigsMatch in that partial mock, matching the convention already used by the upstream overflow-compaction harness. Production delta is zero; test support adds two lines. The original assertions, provider behavior, and database-drain cleanup are preserved.

Before/after validation: the published head passed all nine cases; adding the exact CI cleanup helper still passed all nine. Adding the exact CI reply-thinking modules reproduced the hosted result (six failed, three passed) in the original case order. A focused catch/rethrow diagnostic captured the exact missing-export exception and call chain. The corrected original-order run passed all nine cases (188.478 seconds, exit 0). Exact CI production/helper source hashes match the failed run. Every source overlay was restored and all runners joined.

Scope: sanitized macOS Node 24.19 run through the canonical Vitest wrapper; existing provider-attempt fakes with real reply dispatch/state owners. This is a source-overlay reproduction of the CI integration difference, not a full Linux checkout rerun or a live provider login. Exact candidate hosted CI remains required.

Fresh bounded Codex autoreview (P0) is scoped-clean with no findings for the two-line helper repair. Original PR production review remains separate.

Keep metadata-only mock factories independent of the prepared runtime owner
to avoid re-entering the pending current-plugin-metadata-snapshot mock.
Move the unchanged fixture and migrate all callers without a re-export.
Integrate the SDK retirement facts already present in CI merge 5195ee48
to preserve the unchanged compatibility support patch. The resulting tree
is byte-identical to that tested CI tree plus the reviewed fixture move.
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Final local repair and integration proof for e5bd0d4b72ea1fcbdfc911a7b06263b4e1e965d9: 186 focused cases passed; full canonical changed gate passed in 421.598 seconds. Fresh hosted CI and native landing gates remain required.

The original lifecycle repair remains unchanged: Gateway/reply session hooks use the existing detached work owner so deferred effects survive requester closure while Gateway roots drain on completion or failure. Retained paired proof uses real emitters, the global hook runner, disk-loaded callbacks, real scope ownership, and file effects. The closed-request baseline loses those effects; the candidate completes them and drains roots 1 → 0. Original coverage was 141 cases across ten files, with 26 final affected cases rerun. This initializes the typed registry directly and does not claim public plugin loading or deployed provider/channel transport.

The remaining CI blocker was a test import cycle, not an OAuth product failure. The earlier real-comparator mock repair in 842687 passed OAuth but made the probe metadata mock re-enter itself through the broad runner fixture and prepared-runtime activation graph. The failing CI job stalled before any probe case and reached its normal 300-second watchdog. The same local graph reproduced that stall; moving the unchanged empty metadata factory into type-only owner test support made it pass 17/17. All eight consumers now import that fixture directly; the old export is deleted. No production, assertion, ordering, or timeout change.

Final source/lock qualification passed the original nine OAuth cases plus 177 cases across all seven fixture-caller files. OAuth with normal runtime preparation took 622.087 seconds; the caller shards took 53.890 seconds. The initial paired graph used matched donor dependencies; the final 186 used the exact CI lock and private physical dependencies after canonical preparation rejected external compiler symlinks. No guard was bypassed.

The normal merge with pinned main 8f9b234c21c6bd208efab57cfc8746c492978bfa was conflict-free and its full tree equals the failed CI tree plus the proved fixture extraction. This base carries the actual SDK retirement facts needed for the exact compatibility patch from support PR #163127. All six support blobs and its binary patch equal source 144f278; deadlines, guards, and APIs are unchanged. Original hook owners/tests stay byte-identical. Main's session predicate extraction preserves its function body, and the integrated UI readiness fixture matches main.

node scripts/check-changed.mjs \
  --base 8f9b234c21c6bd208efab57cfc8746c492978bfa \
  --head e5bd0d4b72ea1fcbdfc911a7b06263b4e1e965d9

Result: exit 0, 421.598 seconds, all selected stages for 20 changed paths, no skip flags, clean Git status. Log SHA256: 4c930439f3b96e743ad9b32c0dd6a78a7a5221d14719c43bfbefee8d1e0bffa9. A fresh bounded Codex P0 review of the fixture extraction found no findings. All owned processes joined and the final workspace process audit was empty. Local environment: sanitized macOS Node 24.19.0; fresh Linux hosted CI is still required.

Fixture extraction: production 0, test/support +56/-55. Final delta against pinned main: hook production +19/-10; shared compatibility metadata +22/-14; tests/support +274/-77; docs +8/-3. The body retains the original before/after table, measured lifecycle test costs, proof limits, source continuity, and ClawSweeper timing response.

Checkpoint ancestry: 842687 → fixture 346cc89 → normal main merge fa30706 → support child e5bd0d4. Original contributor @xialonglee and existing assignee @fuller-stack-dev are preserved.

@clawsweeper re-review

The six support files already match landed PR #163127 byte-for-byte. Their historical three-dot diff can remain visible because that support was independently squashed; integration adds no new compatibility content.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation and removed app: web-ui App: web-ui labels Oct 2, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Final fixture repair for 1addcb2a1b279685e3319b8e2b187ab373946a5b: 27/27 original-order cases, 9/9 upstream fallback controls, 4/4 receipt authority controls, and the canonical one-file changed gate passed.

The latest fixture repair is commit 1addcb2a1b279685e3319b8e2b187ab373946a5b, a direct child of e5bd0d4b72ea1fcbdfc911a7b06263b4e1e965d9. It changes only src/agents/model-fallback.run-embedded.e2e.test.ts (+4/-7 test lines, production 0); every other parent tree entry is unchanged. The original contributor commits and all earlier hook/fixture/support repairs remain intact.

Hosted CI 36953180176 on the published parent failed two exact receipt arrays: same-model retries were still expected to have switched routes. The actual CI source is c08c4a929a5c4ff65a358f6d838a35edb740e0d6, with main parent 715300989b5be926c1791177869adbde2198c4e0. The already-landed owner repair in PR #163032 correctly keeps retry diagnostics separate from model-routing provenance. Its unchanged receipt producer treats recorded outer fallback stage/reason as authoritative. The test repair expects all four primary selections to remain model_route_selected; exact counts and targets, the later Groq overloaded receipt, outer [initial, fallback] provenance, and the no-receipt skipped-candidate control are preserved. No production, mock, retry, timeout, or assertion-cardinality changes.

Paired proof uses the original full 27-case order on the exact CI source and frozen lock (e2dc3b497ee7798b7e8d99efd0bf455b28db9d552f244f753e49e196461af1c5). All 51,386 archive files were checked; the private baseline index reproduces the actual CI tree cd6da5d0929fc58cb1bf0b88af1c16ae70cf8e35. Before: 2 failed / 25 passed, the same two failures as hosted CI. After: 27/27 passed. Upstream's nine same-model, explicit-fallback, absent-reason, cross-provider same-identifier, and restricted-delegation controls: 9/9 passed, with 125 unrelated sibling cases intentionally unselected. Existing receipt authority/closure controls: 4/4 passed. These are 40 distinct cases: 27 full-file, nine selected sibling, and four receipt-owner cases.

Measured one-worker cost: baseline Vitest 27.82s, repaired Vitest 21.64s; full commands 436.963s / 423.570s, including canonical runtime preparation. The corrected command requested fresh runtime preparation after creation of its isolated Git validation identity; no cache/freshness guard was bypassed. The upstream nine controls took 26.582s command wall; receipt-owner controls 13.150s. Historical Linux CI reports 17.16s Vitest / 28.34s wrapper for the failing file. This patch adds no test case or new CI work; these measurements are not a performance-savings claim.

The canonical changed gate for the single additional file passed exit 0 in 128.260s, including the selected agents-root core-test type graph, scoped typed lint, formatting and all normal guards. The retained earlier full 20-path gate remains a separate 421.598s pass. Fresh canonical Codex gpt-5.6-sol/high/P0 autoreview of the exact one-file repair with complete owner context was scoped-clean, no findings. All invoked test/build/check/review wrappers joined, and the final task-root process audit was empty.

Tests/checks used macOS Node 24.19.0, matching the failing CI Node version; frozen dependency installation used Node 24.21.0 and pnpm 12.5.1, with package/workspace/lock inputs unchanged. Task HOME/TMP/store were isolated and secretless. The final branch child preserves the parent's older dependency state; local paired proof intentionally pins the actual CI merge composition and its different lock. This is host receipt/policy proof with the existing synthetic provider attempt seams, not live external provider or Codex API evidence. No external contract changed.

The body preserves original hook before/after observations, previous 186-case fixture proof and 421.598s full gate, exact source continuity, limitations, supporting merged PRs, test cost, and contributor credit. This mechanical fixture correction does not modify those production owners. Fresh exact-head hosted CI and native landing qualification remain separate.

Preserve the qualified lifecycle and fixture repairs while retaining the
already-landed compatibility inventory corrections from main.
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Integration qualification for 71799815480d3d13454c270c0d5b27214df0d02b: 71/71 existing fixture-consumer cases pass, selected agents-root types and composed-file formatting pass; all processes joined.

Candidate 71799815480d3d13454c270c0d5b27214df0d02b is the normal two-parent merge of qualified 1addcb2a1b279685e3319b8e2b187ab373946a5b and immutable main db25147c8a953f26e346464dd824176b52ea257b. The verified merge base is 8f9b234c21c6bd208efab57cfc8746c492978bfa. The only conflicts were src/plugins/compat/deprecation-marking.ts and src/plugins/compat/registry.test.ts; both resolve to exact current-main blobs. All six historical support files, including both auto-merged docs, now match main byte-for-byte and disappear from the final 15-file PR diff. The landed #163158 inventory corrections, original deadlines and remaining migration blockers are preserved.

All 15 feature paths preserve their qualified content: 14 are byte-identical to the exact CI projection used for the latest receipt proof, including auto-merged session.ts; the remaining isolated-completion fixture adds only main's explicit vi.fn return type while retaining the metadata-only import. Node 24.19 type erasure plus Acorn comparison confirms its runtime AST is identical. The four production fallback owners remain byte-identical on main; the corrected receipt test remains byte-identical from1add to717. Together these five source files preserve the qualified routing contract. The routing producers and owner behavior remain current-main; repaired receipt expectations are the qualified candidate assertions. No producer repair is reverted.

Fresh exact-717 integration checks: 71/71 existing cases across three isolated-completion consumer files, two canonical one-worker shards, 30.192s command wall (19.97s and 7.39s Vitest). The selected agents-root type graph passed in 5.253s; formatting of both composed files and diff whitespace passed. Package/workspace/lock and test/check entry points match the prior exact-CI proof; frozen installation took 8.444s and did not change those inputs. Runtime/check Node is 24.19.0; install Node was 24.21.0. All processes joined; raw tracked-source and task-process audits are clean.

The retained original-order receipt proof remains 2 failed/25 passed before →27/27 after, with nine selected upstream controls and four receipt-authority controls (40 distinct cases; 125 unrelated sibling cases intentionally unselected). The 128.260s one-file gate and scoped-clean canonical autoreview remain attached to that exact repair. Earlier 186-case fixture and 421.598s full-gate proof remain historical evidence. The original 141-case lifecycle run is also historical: main #163169 rewrote an automatic-reset sibling test from three cases into one combined scenario, so no unchanged-byte/current-rerun claim is made for that file.

Latest full ClawSweeper revision 8 on 1add (2026-10-02T02:57:01.840Z) found no code/security defect and retained sufficient proof. Its two merge blockers and rank-up move are addressed by the exact-main conflict resolution, preserved fallback provenance, and bounded integration checks above. Fresh hosted CI and native landing on 71799815480d3d13454c270c0d5b27214df0d02b remain required; this mechanical integration does not require another re-review request under the less-than-12-hour rule.

Detailed prior receipt proof and lifecycle/fixture proof retain their original source identities and limits. No aggregate of historical overlapping test counts is claimed.

@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Oct 2, 2026
@Patrick-Erichsen
Patrick-Erichsen merged commit e9e1134 into openclaw:main Oct 2, 2026
142 of 144 checks passed
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Merged via squash.

Patrick-Erichsen pushed a commit to etzelm/openclaw that referenced this pull request Oct 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…ter the request closes (openclaw#148089)

* fix(gateway): let session lifecycle hooks finish deferred work after request scope closes

* test(ui): await effort picker readiness

Apply the existing upstream readiness synchronization from 9ba56c1 (openclaw#162869). Preserve the expected enabled state and existing deadline.

* test: expose prepared runtime config comparison in E2E mocks

* test(agents): decouple empty metadata fixture from runner mocks

Keep metadata-only mock factories independent of the prepared runtime owner
to avoid re-entering the pending current-plugin-metadata-snapshot mock.
Move the unchanged fixture and migrate all callers without a re-export.

* fix(plugins): queue compatibility removals pending reader migration

(cherry picked from commit 144f278)

* test(agents): distinguish same-model retries from fallback receipts

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: Patrick Erichsen <[email protected]>
steipete added a commit that referenced this pull request Oct 2, 2026
…nd keyed agent roster changes (#163623)

* fix(test): align reply-entry fallback E2E with concise error copy

The reply-entry fallback E2E still expected the pre-#163381 rate-limit and
auth-failure copy, so its two OpenAI cases fail on main. Hourly main CI skips
src E2E files, so the break stayed invisible there.

Assert the new pinned rate-limit copy and the exported auth copy constant.
The anthropic-attempt count still catches the original fallbackConfigured
defect, which surfaced as "temporarily rate-limited" after a fallback attempt.

The non-OpenAI failures reported on 2026-10-01 were a separate, already-fixed
fixture gap: #161103 added reply-path thinking-catalog hydration that calls
preparedModelRuntimeConfigsMatch through the prepared-model-runtime module,
and the shared E2E mock lacked that export until #148089. No product change.

* fix(test): migrate Gateway E2E fixtures to keyed agent rosters

#162612 made ordinary config reads reject a populated agents.list, but the
dreaming restart-cleanup and WhatsApp login-authority E2E fixtures still wrote
legacy rosters to disk. Both Gateways now refuse to start (code 78 or
InvalidConfigError) before any assertion runs, which fails Gateway E2E shard
1/4 on main. Hourly main CI does not run these files.

Write the canonical shapes Doctor produces: a sole keyed main entry for the
WhatsApp fixture, and explicit ownership with main as the system agent for the
two-agent dreaming fixture. Assertions are unchanged.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…nd keyed agent roster changes (openclaw#163623)

* fix(test): align reply-entry fallback E2E with concise error copy

The reply-entry fallback E2E still expected the pre-openclaw#163381 rate-limit and
auth-failure copy, so its two OpenAI cases fail on main. Hourly main CI skips
src E2E files, so the break stayed invisible there.

Assert the new pinned rate-limit copy and the exported auth copy constant.
The anthropic-attempt count still catches the original fallbackConfigured
defect, which surfaced as "temporarily rate-limited" after a fallback attempt.

The non-OpenAI failures reported on 2026-10-01 were a separate, already-fixed
fixture gap: openclaw#161103 added reply-path thinking-catalog hydration that calls
preparedModelRuntimeConfigsMatch through the prepared-model-runtime module,
and the shared E2E mock lacked that export until openclaw#148089. No product change.

* fix(test): migrate Gateway E2E fixtures to keyed agent rosters

openclaw#162612 made ordinary config reads reject a populated agents.list, but the
dreaming restart-cleanup and WhatsApp login-authority E2E fixtures still wrote
legacy rosters to disk. Both Gateways now refuse to start (code 78 or
InvalidConfigError) before any assertion runs, which fails Gateway E2E shard
1/4 on main. Hourly main CI does not run these files.

Write the canonical shapes Doctor produces: a sole keyed main entry for the
WhatsApp fixture, and explicit ownership with main as the system agent for the
two-agent dreaming fixture. Assertions are unchanged.
@xialonglee
xialonglee deleted the fix/gap-session-hook-detached-continuation branch October 8, 2026 04:05
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 P2 Normal backlog priority with limited blast radius. 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.

4 participants