Repository navigation
fix(ci): restore lifecycle test reliability - #138238
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 8:02 AM ET / 12:02 UTC. ClawSweeper reviewWhat this changesThe PR replaces timing- and resource-reuse-sensitive lifecycle test assertions across browser control state, voice-call log cleanup, embedded-agent Code Mode denial, and service-child shutdown coverage. Merge readiness⛔ Blocked before merge - 1 item remains Keep this fresh maintainer-owned PR open. It contains a focused, test-only repair for real lifecycle assertion races; fetched main still has the browser test pattern being replaced, and source review found no blocking defect in the patch. Priority: P2 Review scores
Verification
How this fits togetherThese suites verify lifecycle owners around browser control startup, voice-call output, embedded-agent tool gating, and supervised child processes. They ensure CI observes the intended cleanup or denial result without relying on OS scheduling or incomplete test doubles. flowchart LR
A[Lifecycle test inputs] --> B[Browser control state]
A --> C[Voice-call log stream]
A --> D[Embedded-agent tool gate]
A --> E[Child process supervisor]
B --> F[Lifecycle owners]
C --> F
D --> F
E --> F
F --> G[Deterministic CI assertions]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +11. Total +11 across 5 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the focused test-only repair once the exact-head checks complete, retaining the real browser bind/auth and ignored-TERM escalation coverage as the sibling proofs for the seams now mocked or made cooperative. Do we have a high-confidence way to reproduce the issue? No reviewer-side execution was run because this is a read-only review. The source establishes the reported races: a released descriptor can be reused, the original browser test did not ensure startup had reached its gate, and the old child command ignored TERM through the grace window. Is this the best way to solve the issue? Yes. The patch corrects the affected test seams and fixtures rather than changing production lifecycle timing, cleanup ownership, or tool policy; retained sibling tests continue to exercise real listener binding and ignored-TERM escalation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6df6ea5c693a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Adopt the two relevant test-only corrections already landed in #138238 (e7fffcf). Supply the session methods consumed by nested tool observation and classify structured tool failures as AgentSession does. Keep policy-denial and never-entered action/preparer assertions intact. The original file reproduces three failures. All 112 files and 1,666 tests pass after this correction, with complete changed-file gates and independent review. Launcher implementation and release candidate are unchanged.
Merge current main and preserve the fixture cleanup from #138238. Retain real in-memory session management, structured denial classification, and recorded nested denial assertions while removing the redundant observation array. The CPU context-reader implementation remains unchanged. The combined candidate preserves main's batching and normal Code Mode continuation.
Adopt the SessionManager fixture and structured-result classification from #138238, preserving the attempted hidden namespace call and the checks that neither the original preparer nor action executes. Remove redundant pass-through mocks with the upstream fixture. Both files match the successful upstream CI head ce42af5 exactly. Gateway runtime code is unchanged; this resolves the parallel test-fix merge conflict.
* fix(cli): let the dev runner own child shutdown The JavaScript shim and dev runner both escalated after five seconds. The shim could kill the runner first, leaving its separately detached child alive. Delegate termination to the runner and handle SIGHUP through its existing signal and build-lock lifecycle. Preserve Node execution under Bun and other shim callers' termination behavior. Real process regressions fail before the fix and pass for SIGTERM/SIGHUP. Runner and entrypoint tests, changed-file checks, and independent review pass. A fresh Linux Node 24.19.0 build passes the original Gateway worker restart scenario (Actions 33868737194). Release-note context: source-checkout Gateway shutdown no longer abandons a slow child when the development launcher's shutdown timers race. * test(agents): align attempt fixtures with session contracts Adopt the two relevant test-only corrections already landed in #138238 (e7fffcf). Supply the session methods consumed by nested tool observation and classify structured tool failures as AgentSession does. Keep policy-denial and never-entered action/preparer assertions intact. The original file reproduces three failures. All 112 files and 1,666 tests pass after this correction, with complete changed-file gates and independent review. Launcher implementation and release candidate are unchanged.
* fix(gateway): keep received work inside its state lifetime Join original WebSocket dispatch, cooperating refreshes and connection cleanup before releasing Gateway dependencies. Retire passive approval/question/run observers without inventing durable decisions, and preserve test state until native callbacks and first browser closes settle. Remove the unused process-local approval implementation and forwarding adapters. The refactor removes 404 production lines from the initial repair while retaining boundary regressions and moving manager tests onto the real durable path. Verified under enforced credential-free isolation: 2,143 distinct owner/native/process tests, a final 77-test rerun, changed gates, product/UI builds and scoped-clean Codex P0 review. Protected exact-order browser replay remains a pre-merge gate; historical incomplete audits are not acceptance. * fix(gateway): join worker cleanup before closing transport Fence ingress without disconnecting the supervisor needed for worker cleanup, then join received work before releasing the remaining Gateway dependencies. Preserve exact pending-node authority during direct and restart shutdown. Keep startup logging and sidecar acquisition owned independently of fail-fast readiness, and retire published plugin services only through their actual owner. Join portal cleanup before reporting sibling shutdown failures. Record positive test-Gateway closure at its owner. Retain fixture state and selectors after incomplete shutdown, including across module reload, without confusing a post-close diagnostic with an unfinished producer. Cover that boundary through an isolated real-Gateway counterfactual and regression. Consolidate UI finalization with the shared QA cleanup owner and separate the lazy handler registry from dispatch without changing loading or method order. Derive handler families from typed descriptor rows and remove the old casts. Follow-up repair for the state-lifetime boundary in #136145 and #136146. * fix(gateway): fence worker frames during ordinary close Reject newly received worker frames once their connection generation starts closing, while retaining queued work and its completion owners. Cover the live-socket window through the real worker protocol and a checked synthetic node sink. Synchronize the update-failure UI test with its intended Updates recovery navigation before reopening the Inbox. Follow-up for #136146 (Gateway received-work lifetime), addressing the shutdown-admission gap from review. * fix(browser): join SDK-initiated MCP transport cleanup Route SDK initialization failure and transport close through the existing Chrome MCP process owner before native close clears the child PID. Capture the native closer separately so concurrent callers join one cleanup path without recursion or losing descendant ownership. Collect startup diagnostics after cleanup and stderr completion, while never-spawned commands skip the unused pipe. Preserve cleanup failures and the existing launch, environment, and process-group behavior. Exercise late stderr, descendant cleanup, forced termination, ENOENT, and backpressure through real subprocesses. * fix(gateway): retain supervisors after worker shutdown failure Require connection-dependent sidecars to stop successfully before draining their supervisor transports or releasing runtime dependencies. Cover public and startup-failure shutdown, retained-owner retry, and late sidecar registration. * test(gateway): join policy writers after releasing handler gates Preserve policy-revocation and response-order coverage under the received-work dispatcher completion contract. Retain all held calls and release/join them in finally so tests cannot wait on their own unreleased gates. * fix(gateway): retain execution through required shutdown Preserve early acknowledgements while joining original raw, typed, and agent execution through final cleanup. Cancel this Gateway's runs before the join, and fence late admission at controller publication. Retain failed startup acquisitions and plugin cleanup owners, preserve both startup and cleanup errors, and prevent CLI successors after incomplete retirement. Keep deferred startup hooks and sentinel refresh in their owner. Remove the monolithic close factory and redundant post-abort polling. Declare compiled plugin dependencies for the full lifecycle fixture through the existing pretest owner. Align the QA publishing reference with main. Validated isolated before/after regressions, original-order execution, startup/CLI/plugin suites, full build, types, lint, and Codex review. The protected metadata audit remains unaccepted; this is not merge approval. Refs #136145, #136146. * test(agents): align Code Mode fixtures with main Adopt the SessionManager fixture and structured-result classification from #138238, preserving the attempted hidden namespace call and the checks that neither the original preparer nor action executes. Remove redundant pass-through mocks with the upstream fixture. Both files match the successful upstream CI head ce42af5 exactly. Gateway runtime code is unchanged; this resolves the parallel test-fix merge conflict. * test(gateway): reuse tracked agent contexts Replace three partial agent-handler contexts with the shared fixture. The missing execution tracker threw after admission handoff and leaked session claims into later continuation tests. Preserve their assertions, timers, and original order. The complete 302-case file reproduces all six CI failures before this repair and passes afterward in the same order. Type checks, type-aware lint, formatting, and independent Codex review pass. No production code changes. * test: fix gateway, Signal, and UI fixture lifetimes Reset agent database handles, validation, and terminal latches only within retired fixture roots before deleting or recreating their files. Preserve ordinary runtime reopen behavior and unrelated roots. Model the pending host question in Signal's partial-delivery fixture and assert the accepted reaction binding. Use actual Settings navigation from independent cold UI contexts so document reloads do not abort startup scripts and masquerade as asset failures. Preserve existing assertions. Reproduced the Node and Signal failures locally and the UI cancellation on Linux. The Linux owner replay passes 30 tests across six files, the full settings suite passes seven, and the final UI revision passes both cold routes locally. Static checks and independent source review pass. The isolated native fixture still times out on this Mac; Linux completes its unchanged case in 13 seconds. Protected audit acceptance and final-head hosted checks remain separate landing requirements for PR #136146. * test(sessions): call database reset without hook context Wrap the participant suite teardown in a zero-argument callback. Vitest passes TestContext to registered hooks; the reset helper now accepts an optional root path for selective fixture retirement. The full seven-case file reproduced four teardown failures before this change and passes all seven afterward. Assertions and cleanup semantics are unchanged. The callback audit found no other direct registrations. Refs #136146, #136145.
* fix(cli): let the dev runner own child shutdown The JavaScript shim and dev runner both escalated after five seconds. The shim could kill the runner first, leaving its separately detached child alive. Delegate termination to the runner and handle SIGHUP through its existing signal and build-lock lifecycle. Preserve Node execution under Bun and other shim callers' termination behavior. Real process regressions fail before the fix and pass for SIGTERM/SIGHUP. Runner and entrypoint tests, changed-file checks, and independent review pass. A fresh Linux Node 24.19.0 build passes the original Gateway worker restart scenario (Actions 33868737194). Release-note context: source-checkout Gateway shutdown no longer abandons a slow child when the development launcher's shutdown timers race. * test(agents): align attempt fixtures with session contracts Adopt the two relevant test-only corrections already landed in openclaw#138238 (ce8b5ca). Supply the session methods consumed by nested tool observation and classify structured tool failures as AgentSession does. Keep policy-denial and never-entered action/preparer assertions intact. The original file reproduces three failures. All 112 files and 1,666 tests pass after this correction, with complete changed-file gates and independent review. Launcher implementation and release candidate are unchanged.
…136146) * fix(gateway): keep received work inside its state lifetime Join original WebSocket dispatch, cooperating refreshes and connection cleanup before releasing Gateway dependencies. Retire passive approval/question/run observers without inventing durable decisions, and preserve test state until native callbacks and first browser closes settle. Remove the unused process-local approval implementation and forwarding adapters. The refactor removes 404 production lines from the initial repair while retaining boundary regressions and moving manager tests onto the real durable path. Verified under enforced credential-free isolation: 2,143 distinct owner/native/process tests, a final 77-test rerun, changed gates, product/UI builds and scoped-clean Codex P0 review. Protected exact-order browser replay remains a pre-merge gate; historical incomplete audits are not acceptance. * fix(gateway): join worker cleanup before closing transport Fence ingress without disconnecting the supervisor needed for worker cleanup, then join received work before releasing the remaining Gateway dependencies. Preserve exact pending-node authority during direct and restart shutdown. Keep startup logging and sidecar acquisition owned independently of fail-fast readiness, and retire published plugin services only through their actual owner. Join portal cleanup before reporting sibling shutdown failures. Record positive test-Gateway closure at its owner. Retain fixture state and selectors after incomplete shutdown, including across module reload, without confusing a post-close diagnostic with an unfinished producer. Cover that boundary through an isolated real-Gateway counterfactual and regression. Consolidate UI finalization with the shared QA cleanup owner and separate the lazy handler registry from dispatch without changing loading or method order. Derive handler families from typed descriptor rows and remove the old casts. Follow-up repair for the state-lifetime boundary in openclaw#136145 and openclaw#136146. * fix(gateway): fence worker frames during ordinary close Reject newly received worker frames once their connection generation starts closing, while retaining queued work and its completion owners. Cover the live-socket window through the real worker protocol and a checked synthetic node sink. Synchronize the update-failure UI test with its intended Updates recovery navigation before reopening the Inbox. Follow-up for openclaw#136146 (Gateway received-work lifetime), addressing the shutdown-admission gap from review. * fix(browser): join SDK-initiated MCP transport cleanup Route SDK initialization failure and transport close through the existing Chrome MCP process owner before native close clears the child PID. Capture the native closer separately so concurrent callers join one cleanup path without recursion or losing descendant ownership. Collect startup diagnostics after cleanup and stderr completion, while never-spawned commands skip the unused pipe. Preserve cleanup failures and the existing launch, environment, and process-group behavior. Exercise late stderr, descendant cleanup, forced termination, ENOENT, and backpressure through real subprocesses. * fix(gateway): retain supervisors after worker shutdown failure Require connection-dependent sidecars to stop successfully before draining their supervisor transports or releasing runtime dependencies. Cover public and startup-failure shutdown, retained-owner retry, and late sidecar registration. * test(gateway): join policy writers after releasing handler gates Preserve policy-revocation and response-order coverage under the received-work dispatcher completion contract. Retain all held calls and release/join them in finally so tests cannot wait on their own unreleased gates. * fix(gateway): retain execution through required shutdown Preserve early acknowledgements while joining original raw, typed, and agent execution through final cleanup. Cancel this Gateway's runs before the join, and fence late admission at controller publication. Retain failed startup acquisitions and plugin cleanup owners, preserve both startup and cleanup errors, and prevent CLI successors after incomplete retirement. Keep deferred startup hooks and sentinel refresh in their owner. Remove the monolithic close factory and redundant post-abort polling. Declare compiled plugin dependencies for the full lifecycle fixture through the existing pretest owner. Align the QA publishing reference with main. Validated isolated before/after regressions, original-order execution, startup/CLI/plugin suites, full build, types, lint, and Codex review. The protected metadata audit remains unaccepted; this is not merge approval. Refs openclaw#136145, openclaw#136146. * test(agents): align Code Mode fixtures with main Adopt the SessionManager fixture and structured-result classification from openclaw#138238, preserving the attempted hidden namespace call and the checks that neither the original preparer nor action executes. Remove redundant pass-through mocks with the upstream fixture. Both files match the successful upstream CI head ce42af5 exactly. Gateway runtime code is unchanged; this resolves the parallel test-fix merge conflict. * test(gateway): reuse tracked agent contexts Replace three partial agent-handler contexts with the shared fixture. The missing execution tracker threw after admission handoff and leaked session claims into later continuation tests. Preserve their assertions, timers, and original order. The complete 302-case file reproduces all six CI failures before this repair and passes afterward in the same order. Type checks, type-aware lint, formatting, and independent Codex review pass. No production code changes. * test: fix gateway, Signal, and UI fixture lifetimes Reset agent database handles, validation, and terminal latches only within retired fixture roots before deleting or recreating their files. Preserve ordinary runtime reopen behavior and unrelated roots. Model the pending host question in Signal's partial-delivery fixture and assert the accepted reaction binding. Use actual Settings navigation from independent cold UI contexts so document reloads do not abort startup scripts and masquerade as asset failures. Preserve existing assertions. Reproduced the Node and Signal failures locally and the UI cancellation on Linux. The Linux owner replay passes 30 tests across six files, the full settings suite passes seven, and the final UI revision passes both cold routes locally. Static checks and independent source review pass. The isolated native fixture still times out on this Mac; Linux completes its unchanged case in 13 seconds. Protected audit acceptance and final-head hosted checks remain separate landing requirements for PR openclaw#136146. * test(sessions): call database reset without hook context Wrap the participant suite teardown in a zero-argument callback. Vitest passes TestContext to registered hooks; the reset helper now accepts an optional root path for selective fixture retirement. The full seven-case file reproduced four teardown failures before this change and passes all seven afterward. Assertions and cleanup semantics are unchanged. The callback audit found no other direct registrations. Refs openclaw#136146, openclaw#136145.
What Problem This Solves
Resolves false CI failures in browser startup, voice-call log cleanup, service-child shutdown and Code Mode denial coverage. The tests either inspected an OS resource after relinquishing it, raced the shutdown grace period, or failed in an incomplete session fixture before reaching the intended denial.
Why This Change Was Made
The browser state suite uses its existing listener seam, while separate real HTTP auth/bind tests retain network coverage. Voice logging observes the actual successful descriptor close instead of assuming the OS cannot reuse its number. The construction-uncertainty command now exits on TERM as its self-cleanup scenario requires; dedicated tests retain ignored-TERM escalation coverage.
The embedded session fixture supplies the current nested-transcript methods and classifies structured tool failures through the canonical helper. Code Mode assertions check the actual denial reason, so an unrelated fixture exception cannot satisfy the test. Three pass-through module mocks and redundant model-content recording are removed.
User Impact
No runtime behavior changes. CI continues to detect lost cleanup, incorrect execution authority and failed error reporting without depending on resource-allocation timing.
Evidence
Production delta: 0. Tests/test support: +45/-34, net +11. No timeout increase, skipped assertion, configuration option or dependency change.
Related CI failures: #138189, #138205 and #138216.