Skip to content

improve(tests): accelerate local service timeout fixture - #118104

Merged
steipete merged 1 commit into
mainfrom
codex/test-performance-local-service
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-performance-local-service

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The provider local-service test suite spent five seconds of wall time waiting for a real readiness deadline solely to verify that diagnostic pipes are released after a failed startup. That made one cleanup regression test dominate the focused file.

Why This Change Was Made

The test still starts a real child process and exercises the production timeout and cleanup path. Its nested host advances only its own clock after the service PID exists, then asserts both the exact readiness-timeout error and that the clock advance actually occurred. Production code, production timeout values, coverage, and test sharding are unchanged.

User Impact

No product behavior changes. The focused test file completes substantially faster while retaining the same process-lifecycle coverage.

Evidence

  • Focused wall time: 12.31s -> 7.32s (40.5% faster).
  • Vitest test-body time: 9.19s -> 4.30s (53.2% faster).
  • Former 5.575s cleanup case: approximately 0.78s.
  • node scripts/run-vitest.mjs src/agents/provider-local-service.test.ts: 22/22 passing on repeated runs.
  • git diff --check: clean.
  • Autoreview: no accepted/actionable findings.
  • node scripts/check-changed.mjs attempted remote delegation; Blacksmith Testbox and brokered Crabbox were unavailable, so focused local proof was used and hosted CI is the broad gate.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Aug 2, 2026
@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 2:21 PM ET / 18:21 UTC.

ClawSweeper review

What this changes

The PR speeds up the provider local-service failed-startup test by advancing the nested test host’s readiness clock after its real child process starts, avoiding a five-second wall-clock wait.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary: current main still waits on the five-second failed-readiness fixture, while the proposed test-only clock advance preserves the real child-process cleanup path. The patch is cleanly mergeable and has no concrete correctness or security finding; the protected maintainer label keeps final handling with maintainers.

Priority: P3
Reviewed head: 3beb7f4d13800d003e3e3bbbf7ba8248435598ab

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, reviewable test-performance patch that preserves the real child-process lifecycle assertion and provides targeted timing evidence.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-labeled, test-only PR includes focused repeated-run timing evidence in its body; no user-facing external setup requires separate real-behavior proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-labeled, test-only PR includes focused repeated-run timing evidence in its body; no user-facing external setup requires separate real-behavior proof.
Evidence reviewed 5 items Current main still has the slow fixture: Current main configures this failed-readiness test with a 5,000 ms deadline and therefore still incurs the real timeout this PR targets.
Patch preserves the production timeout boundary: The branch retains a real spawned child and only advances the nested host clock after its PID exists; it then requires the expected not-ready error and verifies that the advance occurred.
Runtime deadline contract: The production manager records a deadline from Date.now(), probes the real service, and throws the readiness error only once the deadline is reached; the fixture exercises that path without changing production code.
Findings None None.
Security None None.

How this fits together

Provider local services are optional child processes started for model endpoints. The local-service manager probes a child until it becomes healthy or reaches its readiness deadline, then releases diagnostic pipes and terminates the child when startup fails.

flowchart LR
  A[Provider local-service test] --> B[Nested Node host]
  B --> C[Real local child process]
  C --> D[Readiness probe]
  D --> E{Healthy before deadline?}
  E -->|No| F[Startup cleanup]
  F --> G[Diagnostic pipes released]
  G --> H[Host and child exit assertions]
  B --> I[Test-only clock advance]
  I --> E
Loading

Before merge

  • Add real behavior proof - Not applicable: This maintainer-labeled, test-only PR includes focused repeated-run timing evidence in its body; no user-facing external setup requires separate real-behavior proof.
  • Complete next step (P2) - No bounded repair is needed: the patch has no actionable defect, and the protected maintainer review path should decide whether to merge it.
Agent review details

Security

None.

PR surface

Tests +18. Total +18 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 22 4 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 22 4 +18

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/agents/provider-local-service.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep the production lifecycle contract unchanged and merge this focused fixture acceleration after normal maintainer review of the current head.

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

Yes. Current main visibly configures the failed-readiness cleanup fixture with a 5,000 ms timeout, and the production loop reaches its error after the Date.now-based deadline; executing it was intentionally omitted in this read-only review.

Is this the best way to solve the issue?

Yes. Advancing only the nested host’s clock after the real child writes its PID preserves the failed-startup and pipe-cleanup boundary while removing avoidable wall-clock delay; it is narrower than changing production timeout behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1f7e2f0dc673.

Labels

Label changes:

  • add P3: This is a narrow test-performance improvement with no product-runtime behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled, test-only PR includes focused repeated-run timing evidence in its body; no user-facing external setup requires separate real-behavior proof.

Label justifications:

  • P3: This is a narrow test-performance improvement with no product-runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled, test-only PR includes focused repeated-run timing evidence in its body; no user-facing external setup requires separate real-behavior proof.

Evidence

What I checked:

Likely related people:

  • steipete: The current-main failed-one-shot-host fixture was introduced in commit 9bbaf43, and this PR narrows its wall-clock cost without changing the lifecycle assertion. (role: introduced the current cleanup fixture and recent test contributor; confidence: high; commits: 9bbaf433e9d5, 3beb7f4d1380; files: src/agents/provider-local-service.test.ts)
  • vincentkoc: Recent history shows substantial ownership of provider local-service diagnostics, failed-startup cleanup, and process-tree handling. (role: recent local-service lifecycle contributor; confidence: high; commits: 64c50da1b26d, a74c92f27cb9, d7866fc89b98; files: src/agents/provider-local-service.ts, src/agents/provider-local-service.test.ts)

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 self-assigned this Aug 2, 2026
@steipete
steipete merged commit 18ee52b into main Aug 2, 2026
101 of 109 checks passed
@steipete
steipete deleted the codex/test-performance-local-service branch August 2, 2026 18:28
@steipete

steipete commented Aug 2, 2026

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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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