Skip to content

fix(test): route extension roots through bounded planner - #124553

Merged
steipete merged 2 commits into
mainfrom
steipete/bound-codex-test-lane
Aug 16, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/bound-codex-test-lane

Conversation

@steipete

@steipete steipete commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #124413

What Problem This Solves

Fixes an issue where maintainers running either pnpm test extensions/codex or node scripts/run-vitest.mjs extensions/codex could finish the Codex tests and then lose the run to Worker exited unexpectedly during teardown. The issue's clean Linux/macOS A/B evidence isolated this to the one-shot lane itself (Crabbox leases cbx_d0045e753f72 and cbx_e4c804319801).

Why This Change Was Made

Codex is enrolled in the existing bounded-extension planner with the Matrix-precedent limit of 40 files, producing five fresh processes for the current 165-file lane. Exact existing extensions/<id> directory targets now delegate from the direct Vitest wrapper to that same canonical project router, so both documented entrypoints share one process-lifetime owner. Explicit files, extension subdirectories, watch/project/config modes, and the direct --config path remain unchanged; affected Codex CI fallback shards consume the same bounded file sets.

User Impact

pnpm test extensions/codex and node scripts/run-vitest.mjs extensions/codex now complete with real summaries instead of dying during worker teardown. Product behavior is unchanged. Codex fallback CI plans preserve complete, duplicate-free test coverage while bounding each descriptor to 40 files.

Evidence

Pre-fix planner regression:

FAIL ... bounds an explicit Codex directory target across process lifetimes
AssertionError: expected 1 to be greater than 1
Tests 1 failed | 273 passed (274)

Pre-fix wrapper-routing regression:

FAIL ... delegates an existing extension root to the project router
AssertionError: expected null to deeply equal [ 'extensions/codex' ]
Tests 1 failed | 96 passed (97)

Post-fix proof:

  • node scripts/run-vitest.mjs test/scripts/run-vitest.test.ts test/scripts/test-projects.test.ts — 2 files, 371 tests passed.
  • node scripts/run-vitest.mjs extensions/codex — emitted five [test] starting test/vitest/vitest.extension-codex.config.ts invocations; [test] passed 5 Vitest shards in 276.52s.
  • pnpm test extensions/codex — [test] passed 5 Vitest shards in 273.42s.
  • Stability repeat, pnpm test extensions/codex — [test] passed 5 Vitest shards in 265.59s.
  • node scripts/run-vitest.mjs test/scripts/ci-changed-node-test-plan.test.ts — 32 tests passed; bounded Codex fallback descriptors are complete and duplicate-free.
  • CI=1 node scripts/check-changed.mjs — passed on the final six-file diff.
  • node_modules/.bin/oxfmt on all six touched files — clean.
  • Changed-file oxlint — clean. The requested broad node scripts/run-oxlint.mjs scripts test/scripts also surfaced 17 pre-existing findings in untouched current-main test files; none are in this diff or selected by check-changed.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted — clean after the final test update, no accepted/actionable findings.

AI-assisted: yes. The change was reviewed against the owning router/planner boundaries and verified through both real entrypoints.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 16, 2026 12:11
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. 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 Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 8:23 AM ET / 12:23 UTC.

ClawSweeper review

What this changes

The PR sends exact extension-root test commands through the shared project planner, adds a 40-file Codex process limit, and covers local and CI fallback plans.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: this is a focused repair with no blocking correctness finding. It needs normal maintainer handling because it is maintainer-authored and carries the protected maintainer label.

Priority: P2
Reviewed head: de6cb3063661f5f1705f9477697376b9ebc61f90

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with strong terminal evidence and relevant planner coverage; the broader extension-root routing is the main merge consideration.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR; its body nevertheless includes after-fix terminal evidence for both entrypoints.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR; its body nevertheless includes after-fix terminal evidence for both entrypoints.
Evidence reviewed 6 items Current-main failure boundary: Current main only delegates broad script targets and owned agent directories; an existing extension root therefore continues to direct Vitest rather than the project planner.
Canonical planning owner: The branch adds Codex to the existing bounded process-limit registry, alongside Matrix and Telegram, and the planner expands roots into sorted, bounded file chunks only for plain one-shot runs.
Caller and sibling coverage: The project runner consumes the same process-root map for direct plans and full-extension plans; the branch adds Codex beside existing Matrix and Telegram bounded lanes.
Findings None None.
Security None None.

How this fits together

Local test commands enter the Vitest wrapper, which either invokes Vitest directly or delegates eligible targets to the project planner. The planner selects an extension configuration and emits bounded fresh-process test shards for lanes that cannot safely retain all test state in one process.

flowchart LR
  A[Local test command] --> B[Vitest wrapper]
  B --> C{Eligible extension root?}
  C -->|yes| D[Project planner]
  C -->|no| E[Direct Vitest]
  D --> F[Extension configuration]
  F --> G[Bounded process plans]
  G --> H[Vitest shards]
  H --> I[Test summary]
Loading

Before merge

  • Resolve merge risk (P1) - All existing top-level extension-directory commands now take the project-planner route, so this is an automation behavior change beyond the Codex lane.
  • Resolve merge risk (P1) - Production test-routing code grows by 26 net lines; the two owner-boundary additions are needed to route raw extension roots and register Codex's existing planner limit, but should remain narrowly scoped.
Agent review details

Security

None.

PR surface

Tests +70, Other +30. Total +100 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 91 21 +70
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 32 2 +30
Total 6 123 23 +100

Review metrics

Metric Value Why it matters
Production versus test LOC production +27/-1; test-support +5/-1; tests +91/-21 The production growth adds the two canonical routing/planning decisions, while most of the change is regression coverage for command routing and shard completeness.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124413
Summary: This PR is the concrete candidate repair for the linked Codex one-shot test-lane teardown issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the bounded planner route (recommended)
    Land with the branch’s direct command proof and exact-head checks, accepting the intentional routing of extension-root test commands through the canonical planner.
  2. Narrow the new router
    If maintainers do not want all extension roots to use planner routing, restrict delegation to explicitly supported roots and add matching command-level coverage.

Technical review

Best possible solution:

Keep a single planner-owned route for exact extension roots and retain the narrow routing and limit entries; land only with the demonstrated one-shot commands and exact-head automation checks still green.

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

Yes: the linked issue gives the current-main commands and clean Linux/macOS results, and current source confirms that an exact Codex extension root bypasses the planner before this patch.

Is this the best way to solve the issue?

Yes: routing the direct entrypoint to the existing bounded planner keeps process-lifetime policy in one owner; a separate wrapper-only sharding path would duplicate the Matrix and Telegram precedent.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 66db70133b2c.

Labels

Label changes:

  • add P2: The repair addresses a reproducible maintainer test-runner teardown failure without changing shipped product behavior.
  • add merge-risk: 🚨 automation: The branch changes how local and CI extension test commands select processes and shards.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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: The external-contributor proof gate does not apply to this maintainer-authored PR; its body nevertheless includes after-fix terminal evidence for both entrypoints.

Label justifications:

  • P2: The repair addresses a reproducible maintainer test-runner teardown failure without changing shipped product behavior.
  • merge-risk: 🚨 automation: The branch changes how local and CI extension test commands select processes and shards.
  • 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. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR; its body nevertheless includes after-fix terminal evidence for both entrypoints.

Evidence

What I checked:

  • Current-main failure boundary: Current main only delegates broad script targets and owned agent directories; an existing extension root therefore continues to direct Vitest rather than the project planner. (scripts/run-vitest.mts:717, 66db70133b2c)
  • Canonical planning owner: The branch adds Codex to the existing bounded process-limit registry, alongside Matrix and Telegram, and the planner expands roots into sorted, bounded file chunks only for plain one-shot runs. (scripts/lib/extension-test-plan.mts:97, de6cb3063661)
  • Caller and sibling coverage: The project runner consumes the same process-root map for direct plans and full-extension plans; the branch adds Codex beside existing Matrix and Telegram bounded lanes. (scripts/test-projects.test-support.mts:266, de6cb3063661)
  • Regression coverage: Branch tests cover wrapper delegation, bounded exact-root plans, full-extension plans, and complete duplicate-free Codex CI fallback shards. (test/scripts/test-projects.test.ts:2265, de6cb3063661)
  • Current area provenance: Blame attributes the adjacent bounded-extension policy and test-project process-root map on current main to Peter Steinberger; the behavior appears to have been carried in commit 0c7b560. (scripts/lib/extension-test-plan.mts:92, 0c7b560b2346)
  • Patch integrity: The six-file branch diff has no whitespace errors and consists of production routing/planning changes plus test and test-support coverage. (scripts/run-vitest.mts:703, de6cb3063661)

Likely related people:

  • steipete: Current-main blame assigns the adjacent extension process-limit and project-root policy to Peter Steinberger, and the branch continues that same planner boundary. (role: recent test-planning contributor; confidence: high; commits: 0c7b560b2346, 94c28e093d69; files: scripts/lib/extension-test-plan.mts, scripts/run-vitest.mts, scripts/test-projects.test-support.mts)

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

Copy link
Copy Markdown
Contributor Author

ClawSweeper rank-up handling:

  • Accepted the intentional automation change: exact existing extensions/<id> roots now route through the canonical project planner. Subdirectories, explicit files, watch mode, --project, and --config remain on their prior paths; both real root commands passed through five bounded Codex processes.
  • Accepted the focused production growth: the exact-root delegation predicate and Codex process-limit registration are the two owner-boundary additions required to converge the entrypoints without duplicating sharding in run-vitest. The remaining growth is regression/test-support coverage.

Exact-head CI is green at de6cb3063661f5f1705f9477697376b9ebc61f90; no ClawSweeper findings were skipped.

@steipete
steipete merged commit d437a4a into main Aug 16, 2026
178 of 180 checks passed
@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

maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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.

extension-codex one-shot vitest run dies in worker teardown after all tests pass (serial lane heap accumulation)

1 participant