Skip to content

refactor: reduce repeated CI test fixture setup - #158658

Closed
steipete wants to merge 2 commits into
mainfrom
ci-burden/tp3-fast-tests
Closed

steipete wants to merge 2 commits into
mainfrom
ci-burden/tp3-fast-tests

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Required PR tests repeatedly rebuild identical planner fixtures and restart SQLite reader workers between worker-service cases.

User Impact

Faster CI tests with the same cases and assertions. This is an internal test change with no product behavior change.

Why This Change Was Made

The worker-service fixture now owns reader-worker reuse. Each case still creates a fresh directory and database handles, stops its service, awaits turn-authority release, and drains its session, agent, auth, and shared-state resources before deleting the directory. The suite closes the reader pool after its last case. The old opt-in flag and its callers are removed.

Planner tests clone one unchanged extension fallback fixture and limit the Gateway timing-partition case to its real owner configs. The separate full-inventory bundling and host-policy tests retain repository-wide coverage.

Evidence

  • Linux Testbox: all 56 direct/transitive test importers plus the session-cleanup owner test passed (57 files, 727 tests), using their repository CI configs with two workers.
  • Script, production, and full-tree Knip export scans passed with zero entries.
  • Codex P2 review: no actionable findings, including the rebase that preserved main's asynchronous turn-release ordering.

All selected changed-file gates passed: core/test types, boundaries, ratchets, formatting, and lint. An initial prefer-set-has finding was corrected; test-root lint and types were rerun successfully.

Controlled median wall seconds from three alternating before/after runs per file on one Linux Testbox, one file at a time, each with pnpm test <file> --maxWorkers=1:

Test Before After Saved
ci-changed-node-test-plan.test.ts 171.3s 169.1s 2.2s (1.3%)
ci-node-test-plan.test.ts 123.1s 119.7s 3.4s (2.7%)
provider-provisioning.test.ts 53.4s 43.1s 10.3s (19.4%)
service-prepare.test.ts 39.5s 34.5s 5.0s (12.6%)

Baseline: 37259b7cab6b. Final candidate: 1dd4e9e87dd3; its changed-file hashes match the measured tree. All test cases and assertions remain. Testbox workflow, lease tbx_01m3dtrhwmxmpg30ycmnt6kxqt, wrapper exit 0.

The reference broad green run ended on an 840-second tooling job that already uses two file workers. The measured planner savings total 5.5 seconds: a simple balanced two-worker budget projects about 2.8 seconds off that job, or roughly 3–6 seconds under this fixed-plan model before runner and scheduling differences. This is a modest projection, not observed end-to-end CI improvement. The worker fixture serves 56 test files; the two measured examples also reduce work on other required jobs.

Serial configs were audited. The critical tooling configs already run files in parallel; tasks/fake-timer configs were absent from the twelve slowest jobs, and no additional isolation was established to change their policy. No runner, concurrency, selection, tier, or weight changes.

Auto-merge intentionally remains off for coordinator review.

Keep worker reader code warm while draining case-owned session and database resources before removing each root. Reuse identical extension fallback fixtures and scope the reduced Gateway timing case to its real owners, retaining full-inventory coverage in its sibling test.
@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 gateway Gateway runtime size: S labels Sep 26, 2026
@steipete
steipete marked this pull request as ready for review September 26, 2026 04:56
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 changes before merge.

What this changes

The PR reuses database reader workers and CI planner fixtures across tests while preserving case cleanup and coverage assertions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and useful, with controlled test-run evidence supporting its modest performance gains.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (terminal): The captured body reports the changed fixture’s real database lifecycle running through its Linux Testbox consumers, with 727 passing tests and controlled after-fix runtime improvements. This supports the internal test optimization, without claiming application behavior or an observed broad CI speedup; stored formats are unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes
User problem: Contributors wait for CI tests that repeatedly prepare identical resources.
Reason: Controlled measurements show modest recurring savings without adding production behavior or changing coverage policy.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it contains useful, measured test optimizations that current main does not include. No actionable patch defect was found; GitHub still reports a merge conflict.

Priority: P3
Reviewed head: 1dd4e9e87dd3cd04ab7338a816e7ac31d1b825b5

Before merge

  • Complete next step - Resolve the conflicts with main in this branch while preserving current fixture and planner behavior.

Findings

None.

Agent review details

How this fits together

OpenClaw’s worker-service tests exercise Gateway behavior against temporary databases, while planner tests verify how CI distributes test coverage. These fixtures supply isolated test inputs and release resources after each case.

flowchart TD
A[Test cases] --> B[Fresh case directory and databases]
B --> C[Worker service fixture]
C --> D[Stop service and release turn owners]
D --> E[Drain and close case resources]
E --> F[Retain reader workers until suite teardown]
G[Planner tests] --> H[Clone shared plan and verify coverage]
Loading

Technical review

Best possible solution:

Retain the shared fixture cleanup and cloned planner plans while integrating them with current main’s test-owner changes.

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

Not applicable to a product bug; the body supplies controlled before/after test-run measurements for the repeated setup cost.

Is this the best way to solve the issue?

Yes: the patch consolidates reuse in the existing fixture owner, removes its opt-in callers, and clones cached plans without changing production routing.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • src/gateway/worker-environments/service.test-support.ts keeps the original intent (improve(tests): reduce agents and Gateway fixture setup time #155562: Retain prepared reader workers while preserving separate case resources and complete suite teardown.)
  • test/scripts/ci-node-test-plan.test.ts: reduced Gateway timing partition keeps the original intent (19ab2d0: Split full Gateway coverage through the existing envelope owner while preserving coverage, workers, timeouts and budgets.)
  • test/scripts/ci-changed-node-test-plan.test.ts: shared broad fallback assertions keeps the original intent (fix(ci): cover core-driven extension impact in PR fallback #124579: Ensure core-impact and broad fallback plans include every affected plugin configuration through the existing resolver.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Tests +12. Total +12 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 6 78 66 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 78 66 +12

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P3: This is an internal test-cost improvement with measured savings and no product-runtime change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-26T04:55:57.570Z sha 1dd4e9e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T05:33:46.018Z sha 1dd4e9e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T00:03:56.927Z sha 1dd4e9e :: blocked before merge. :: none

Reviewed October 9, 2026, 5:30 PM ET / 21:30 UTC (Revision 4).

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 26, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Oct 9, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Worker-service reader reuse is already on main through #168806 (b6f0b64). The remaining planner-fixture changes have only small measured savings, so this overlapping test-optimization branch is being retired.

Closed in a sweep of stale maintainer PRs (no activity for 7+ days). Reopen with a current reproduction if this still matters.

@steipete steipete closed this Oct 21, 2026
@RomneyDa
RomneyDa deleted the ci-burden/tp3-fast-tests branch October 22, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant