Skip to content

test: accelerate provider shutdown recovery coverage - #159098

Merged
steipete merged 1 commit into
mainfrom
codex/test-provider-shutdown-clock-5790
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-provider-shutdown-clock-5790

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The provider shutdown recovery test spent four seconds waiting after its real child had exited.

User Impact

No user-visible behavior change. Linux test runs retain the same shutdown and recovery coverage with less waiting; Windows keeps its existing timing.

Why This Change Was Made

The provider shutdown recovery test deliberately withholds the POSIX process-group exit observation. Even after its real child had closed, the test waited through both two-second shutdown deadlines.

Register and await the real child close event before advancing the logical shutdown clock. The existing rejection, retained service ownership, replacement-process health, dead-PID, free-port, and cleanup assertions remain intact. Real timers and the liveness observation are restored before recovery. Windows retains real timers for asynchronous taskkill settlement; production behavior and the other three cases are unchanged.

Evidence

Measured on Linux through Crabbox/Testbox, using all four cases and the normal runner, reporters, and cache policy at base 5790b128b7d609c2a6859066b905941c6f0c14c7:

A–B–B–A pass Full-command wall Affected case
Baseline A1 10.014 s 4.548 s
Candidate B1 5.491 s 0.544 s
Candidate B2 5.560 s 0.546 s
Baseline A2 9.453 s 4.544 s

Mean full-command wall fell 43.2%; both candidate passes beat warm A2 by more than 41%. All 16 ordered case executions passed, source and dependency state were restored, and processes and the lease settled cleanly. CPU and memory savings are not claimed. Comparison run.

Independent review found no actionable issues. The required pnpm test src/agents/provider-local-service.shutdown.test.ts --maxWorkers=1 cost run passed all four cases in 6.594 seconds wall, including 0.554 seconds for the affected case. All 21 canonical changed-file checks passed in 245.185 seconds, including formatting, the agents test typecheck, and targeted lint with zero warnings or errors. Qualification run. Hosted CI passed on published head 64dfaaa241b87757fe484045c9a71e165fc72f7e (attempt 1: 28 successful jobs, 21 intentional skips). Linux passed all four cases: the affected recovery case took 559 ms, the file took 6.17 s in Vitest / 7.26 s through its wrapper, and the complete one-file command took 8.20 s. The job took 64 s including setup.

Windows passed its three applicable cases and retained the existing POSIX-only signal-handler skip. Its recovery case took 6.637 s with real timers, as intended. No standalone Windows file wall was emitted: the containing nine-file agents shard took 23.34 s, and its full eight-shard job took 334.01 s through the wrapper / 422 s including setup. These hosted costs are separate from the controlled Linux comparison; no Windows speedup is claimed.

Both target jobs tested merge fe94c74db4c818584355fd3203703eaaa60f91ef, with main d0931ccefcc25dae4853cc4ac1921c2ff5f58e51 and the published head as parents. The test, provider process/lifecycle owners, fixture helpers and dependency inputs match the head. The two differing selected tooling files only add a separate CLI message fixture registration and compiler boundary.

Completed ClawSweeper review found no actionable correctness or security issues. Its reviewer could not retrieve the redirected Testbox logs; the original execution records were independently verified by the maintainer, and hosted CI supplies fresh Linux and Windows proof.

Post-merge verification

Merged as bfd690f4cac121e476055621898df2a46410aa89, with the exact reviewed patch verified on captured main 915e37b7ddcbf884a78cb650e9463bfa9f0000e9. The post-merge Crabbox smoke passed all four cases in 6.222 seconds full-command wall; the affected recovery case took 550 ms. Source, dependencies, index, process settlement, and cleanup were verified, and the lease is stopped. The normal wrapper rebuilt a source mirror before testing; that setup cost is recorded separately. No test retry or comparison was performed.

Initial native receipt verification saw the pre-merge main commit. Read-only reconciliation confirmed the original merge and completed the native landing record and cleanup; no second merge request was submitted.

@clawsweeper

clawsweeper Bot commented Sep 26, 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: XS labels Sep 26, 2026
@steipete
steipete marked this pull request as ready for review September 26, 2026 18:51
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 2:56 PM ET / 18:56 UTC.

ClawSweeper review

What this changes

The branch speeds up a local-provider shutdown recovery test by observing real child close before advancing simulated POSIX deadlines, while leaving Windows timers real.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main still incurs both shutdown deadlines in this test, and the focused patch has no identified correctness defect.

Priority: P3
Reviewed head: 64dfaaa241b87757fe484045c9a71e165fc72f7e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is narrow and source-consistent, with specific repeated timing evidence and no identified blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured PR body reports repeated Linux Testbox runs of the changed shutdown suite, which starts a real child and verifies failure recovery; affected-case time fell from about 4.55 to 0.55 seconds while all ordered cases passed. Linked raw logs were inaccessible to this reviewer; 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 (live_output): The captured PR body reports repeated Linux Testbox runs of the changed shutdown suite, which starts a real child and verifies failure recovery; affected-case time fell from about 4.55 to 0.55 seconds while all ordered cases passed. Linked raw logs were inaccessible to this reviewer; no stored-data contract changes.
Evidence reviewed 6 items Introduced change: The pinned merge-base-to-head diff changes only the shutdown test. On POSIX it awaits the real child close before draining simulated timers; the rejection and recovery assertions remain.
Current-main necessity: Fetched main still awaits the shutdown rejection with real timers, so it does not contain this test speedup. The verified test merge also changes only this file relative to its main parent.
Shutdown contract: The process owner sends termination signals, polls for process-tree settlement through two deadlines, and throws if the tree still appears alive. The test's simulated clock targets those waits.
Findings None None.
Security None None.

How this fits together

OpenClaw can start a local model-provider process and hold a lease while it serves requests. This test forces a shutdown observation failure, then checks that OpenClaw retains ownership and can start a healthy replacement.

flowchart LR
A[Local provider request] --> B[Managed child and lease]
B --> C[Shutdown attempt]
C --> D[Exit observation]
D --> E[Retained service ownership]
E --> F[Replacement acquisition]
F --> G[Healthy replacement]
G --> H[Stopped child and free port]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +21. Total +21 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 23 2 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 23 2 +21

Review metrics

Metric Value Why it matters
Affected-case wall time Reported 4.546 s → 0.545 s average The repeated baseline and candidate measurements directly assess the intended test-speed improvement.

Technical review

Best possible solution:

Keep the real-process shutdown and reacquisition coverage within the CI time budget, including the ownership and cleanup assertions on both platforms.

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

Yes. The current-main test still waits through the two real shutdown deadlines, and the PR gives a focused Linux before/after timing procedure; I did not execute it in this read-only checkout.

Is this the best way to solve the issue?

Yes. The change targets only the slow test case, waits for actual child close, and retains the failure, recovery, and Windows behavior checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8bb8609f59be.

Labels

Label changes:

  • add P3: This is a focused CI-time improvement with no user-visible behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured PR body reports repeated Linux Testbox runs of the changed shutdown suite, which starts a real child and verifies failure recovery; affected-case time fell from about 4.55 to 0.55 seconds while all ordered cases passed. Linked raw logs were inaccessible to this reviewer; no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured PR body reports repeated Linux Testbox runs of the changed shutdown suite, which starts a real child and verifies failure recovery; affected-case time fell from about 4.55 to 0.55 seconds while all ordered cases passed. Linked raw logs were inaccessible to this reviewer; no stored-data contract changes.

Label justifications:

  • P3: This is a focused CI-time improvement with no user-visible behavior change.
  • 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 captured PR body reports repeated Linux Testbox runs of the changed shutdown suite, which starts a real child and verifies failure recovery; affected-case time fell from about 4.55 to 0.55 seconds while all ordered cases passed. Linked raw logs were inaccessible to this reviewer; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured PR body reports repeated Linux Testbox runs of the changed shutdown suite, which starts a real child and verifies failure recovery; affected-case time fell from about 4.55 to 0.55 seconds while all ordered cases passed. Linked raw logs were inaccessible to this reviewer; no stored-data contract changes.

Evidence

What I checked:

  • Introduced change: The pinned merge-base-to-head diff changes only the shutdown test. On POSIX it awaits the real child close before draining simulated timers; the rejection and recovery assertions remain. (src/agents/provider-local-service.shutdown.test.ts:343, 64dfaaa241b8)
  • Current-main necessity: Fetched main still awaits the shutdown rejection with real timers, so it does not contain this test speedup. The verified test merge also changes only this file relative to its main parent. (src/agents/provider-local-service.shutdown.test.ts:344, 8bb8609f59be)
  • Shutdown contract: The process owner sends termination signals, polls for process-tree settlement through two deadlines, and throws if the tree still appears alive. The test's simulated clock targets those waits. (src/agents/provider-local-service-process.ts:79, 64dfaaa241b8)
  • Observed test behavior: The captured PR body reports Linux A–B–B–A runs: affected-case times of 4.548 and 4.544 seconds at baseline versus 0.544 and 0.546 seconds with the patch, with all 16 ordered case executions passing. The linked workflow logs could not be independently read because their redirect host is unavailable in this review environment. (64dfaaa241b8)
  • Relevant history: File history shows earlier shutdown recovery work in commit 3e68350 and earlier Gateway shutdown coverage in 9903991. Raw parent blobs were unavailable locally, so no source-line introduction claim is made. (src/agents/provider-local-service.shutdown.test.ts, 3e68350c7cd4)
  • Release context: The latest published release is v2026.9.6 from September 23, before this September 26 PR; the proposed test change is not in that release.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • ToToKr: 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.

@steipete
steipete merged commit bfd690f into main Sep 26, 2026
184 checks passed
@steipete
steipete deleted the codex/test-provider-shutdown-clock-5790 branch September 26, 2026 19:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant