Repository navigation
fix(ci): prevent large source selection stalls - #157900
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 1:37 AM ET / 05:37 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch makes CI’s native source scanner match requested terms in one pass, prevents an unterminated Unicode escape from stalling it, and updates its regression tests and PR wrapper inventory. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main still performs the repeated source scans, while the branch has focused tests and measured proof that it preserves selection results and substantially reduces the large workload’s runtime. I found no blocking defect. Priority: P2 Review scores
Verification
How this fits togetherCI preflight reads changed files and scans source text to decide which tests to run. Those selections feed the CI manifest and its test jobs. flowchart LR
A[Changed files] --> B[Source facts scanner]
C[Requested terms] --> D[Term matcher]
B --> D
D --> E[Test selection]
E --> F[CI manifest]
F --> G[Test jobs]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +59, Other +117. Total +176 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the selector repair through the normal PR gates so large import frontiers retain complete test selection within the existing CI budget. Do we have a high-confidence way to reproduce the issue? Yes. The PR records the original large native request, baseline and candidate timings, byte-identical outputs, and a malformed-escape baseline timeout; current main still contains the slower scan. Is this the best way to solve the issue? Yes. The patch changes the existing scanner owner, retains its output contract, and includes the new dependency in the extracted wrapper. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 63944b8a1df1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Match literal terms and whole-token references in one native source pass, retaining UTF-16 semantics, requested ordering, and duplicate terms. Prevent malformed Unicode escapes from rewinding the source lexer and include the matcher in the copied PR wrapper dependency inventory.
4b1b501 to
7596257
Compare
|
Merged via squash.
|
Match literal terms and whole-token references in one native source pass, retaining UTF-16 semantics, requested ordering, and duplicate terms. Prevent malformed Unicode escapes from rewinding the source lexer and include the matcher in the copied PR wrapper dependency inventory.
Related: #157748
What Problem This Solves
CI manifest generation can exhaust preflight's 20-minute budget when changed-test discovery expands to large import frontiers.
User Impact
Developers retain the selected tests and existing CI budgets while source matching does less repeated work. There is no application runtime or configuration change.
Why This Change Was Made
The native selector previously searched each file again for every literal term, then allocated a complete token set. A request-scoped multi-pattern matcher scans each source once while preserving literal UTF-16 substring semantics, complete ASCII-token references, request order, and duplicates. File match state stays separate. The extracted PR wrapper inventory includes the matcher.
Fixes found along the way
Investigation also found that an unterminated Unicode escape could reset the source lexer cursor to zero. Requiring a real closing-brace position prevents that infinite loop. The native scanner regression covers the original malformed input without weakening existing assertions.
Evidence
Blacksmith Testbox, Node 24.19.0, exact failed CI merge
18dbb7a59b035ea953ac1c05b2f649e903774380, captured native requests:Each A-B-B-A group produced byte-identical JSON. The large request improved about 95%; this is a measured workload result, not a worst-case complexity guarantee. Overlap, empty/duplicate term, Unicode, and reference-boundary controls also matched. The malformed-escape baseline hit its 2-second diagnostic bound; the candidate completed in 64 ms.
The complete CI manifest replay, with the original 115 changed paths and hybrid attempt-2 inputs, completed in 258.288 seconds, emitting 109 changed-test rows. It retained selection rules, runner placement, limits, and the original manifest code. This replay proves the original failing workload; the separate hosted run below uses this PR's narrower changed-file scope.
Diagnostic provider:
blacksmith-testbox, leasetbx_01m3b5jwg1dd6pbr4hcgvvn3ta, run, stopped after successful proof. Commands used the repository Crabbox wrapper with an exact-source checkout and one command at a time.Fresh P0–P2 managed Codex review of the final rebased four-file diff is clean. On fresh main
0515cb8d70c1e3bdc46fd2bb9801a48c5ee28b25, the original native scanner fails the new regression withETIMEDOUT; the fixed scanner passes all 1,654 owner tests. The exact clean base also reproduced both consumer failures in the original file order (250.527 s); the repaired ten-file consumer selection passed (249.381 s).pnpm test test/scripts/test-projects.test.ts --maxWorkers=1node scripts/check-changed.mjs -- <changed paths>pnpm buildpnpm openclaw --helpand--versionThe existing owner files cover real test selection, Git/file inventory, native scanner behavior, and complete planner inventories; the new scanner regression reuses the existing native process. The changed owner file remains above 30 seconds because it retains the broad selector contract suite, with no extra process per corpus item. The owner file passed in hosted CI with 1,662 cases in the tested merge tree, taking 71.599 s in
checks-node-compact-small-6. The candidate is rebased ontoe4414b6146d52326f1e42aaa612c5f046f23ad63. Main already repaired the two unrelated consumer failures, so duplicate inventory and packing-test edits were removed. All four remaining complete files, the selector dependencies, and package inputs match the validated snapshot. Hosted CI verified the new merge context.Final proof provider:
blacksmith-testbox, leasetbx_01m3b99ny3ktv3yfk8dj3m0j67, run. Owner/cross tests, changed checks, build and CLI commands run sequentially throughnode scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --id … --idle-timeout 180m --timing-json -- OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 …; fresh dependencies were installed withpnpm install --frozen-lockfile. The lease is stopped. Exact-head hosted CI passed for7596257062b1a200e34de176f2e56b575dcee187, includingopenclaw/ci-gate; this PR's manifest step took 29 seconds. READY-TO-LAND; not merged.