Repository navigation
test(doctor): stabilize OAuth and manual repair fixtures - #158282
Conversation
Keep OAuth source-isolation proof structural and inspect manual repair command arguments through the real shell without starting pnpm. Preserve cancellation, source-state, quoting, and command-directory coverage.
|
🦞👀 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, 3:50 PM ET / 19:50 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch removes a deadline from a Doctor OAuth isolation test and checks Control UI repair-command arguments through the platform shell without starting pnpm. Merge readiness✅ Ready for maintainer review Current main still contains both scheduler-sensitive fixtures. This focused PR has no actionable review finding, and the related Control UI PR remains open with this branch as its prerequisite. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw Doctor inspects OAuth state and Control UI assets, then reports health findings or repair commands. These tests feed Doctor isolated SQLite state and synthetic source roots, then check its reports and generated command. flowchart LR
A[OAuth state] --> B[Doctor lint]
B --> C[Health report]
D[UI source assets] --> E[Doctor UI check]
E --> F[Manual build command]
F --> G[Shell argument check]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -22. Total -22 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the bounded fixture repair and its existing SQLite isolation and shell-quoting checks together for ordinary maintainer review. Do we have a high-confidence way to reproduce the issue? No high-confidence replay of the original OAuth failure is recorded: the baseline replay passed that case. Current-main source confirms its artificial 250 ms deadline, and the PR records the separate build-hint timeout. Is this the best way to solve the issue? Yes. The patch removes the deadline from the success case and checks the manual command at the shell argument boundary while retaining separate cancellation and source-state coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f13c49ca2035. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…8282) Keep OAuth source-isolation proof structural and inspect manual repair command arguments through the real shell without starting pnpm. Preserve cancellation, source-state, quoting, and command-directory coverage.
What Problem This Solves
Fixes two scheduler-sensitive Doctor test fixtures: successful OAuth inspection can be cancelled by an artificial deadline, and checking a rendered build hint can time out while starting pnpm.
User Impact
No product behavior changes. Doctor, OAuth cancellation, storage formats, and update behavior are unchanged; this repairs CI fixtures.
Why This Change Was Made
The OAuth success fixture supplied
AbortSignal.timeout(250)while resolving a stored synthetic token. The state-lease owner reports the exact observed CI error,state lease operation was aborted, when that caller signal expires after acquisition or during owned work. Remove the deadline and its cold-module warmup while retaining the private database path, token and report, held source transaction, open source handle, and unchanged source-byte assertions. The separate cancellation case still explicitly aborts after observing real lease contention.Replaying that historical shard also exposed a manual-build-hint fixture whose real pnpm subprocess exceeded its ten-second guard; the sibling took 7.496 seconds. The exact pnpm startup bottleneck was not observable in the truncated stderr. The fixture now executes the rendered command through the real platform shell and records the arguments delivered to pnpm. It still starts from an unrelated directory and uses a source path with spaces and an apostrophe. The recorder only emits received arguments; it does not interpret
--dir, change directories, or fabricate a build result. The existing timeout stays unchanged. pnpm owns execution of its public--dir <root> ui:buildcontract.Evidence
Independent Codex review completed through P2 with no findings on the combined diff.
Blacksmith Testbox
tbx_01m3cs13eb61n4hva00zazryp0runs Node 24.19.0, matching the original CI runtime. Despite its 16-vCPU label, direct inspection shows four CPUs and 16 GB RAM. The recorded replay preserves all 159 files across the original ordered groups (31 infra, 57 Gateway, 71 Doctor), plan concurrency one, two workers for the preceding groups, and eight Doctor workers. Only the temporary replay plan's fallback was set to eight to preserve that concurrency on this smaller host; repository scheduling is unchanged.The exact original CI merge
8bd09f47b5bca5d98e9ee0864b235bbd8855cb9breplay passed the OAuth case, so the original intermittent failure did not recur. Its unrelated manual-hint timeout is repaired here. The OAuth negative control deliberately routes the real OAuth call to the locked writable source after the private-context assertions; it fails normally withstore unavailable (sqlite-busy). No abort timer or watchdog caused that failure.Both fixture files passed twenty complete standalone Linux repetitions: 620 OAuth isolation cases and 260 Doctor UI cases. The command-quoting negative controls each failed both intended cases: omitting the source root produced an argv mismatch, and omitting its quotes produced a real shell parse error. The production formatter was restored before the positive runs.
Isolated measurements use
pnpm test <file> --maxWorkers=1on the Testbox.src/commands/doctor-lint.state-isolation.test.ts(OAuth support change)src/commands/doctor-ui.test.tsThe existing isolation file exceeds 30 seconds because it exercises real SQLite snapshots, workers, held transactions, and lifecycle cleanup across 31 cases. This change adds no cases or process boots; helper-only assertions cannot establish that source state remains untouched. The manual-command file now spends its test time at the shell argument boundary; module transformation is separate startup cost.
All three complete ordered shard replays passed: 159 files / 2,215 tests per run, in 446.59, 534.46, and 441.99 seconds.
node scripts/check-changed.mjs -- src/commands/doctor-lint.oauth-isolation.test-support.ts src/commands/doctor-ui.test.tspassed in 282.04 seconds, including types, static guards, dead exports, and changed-file lint (zero warnings/errors).The Testbox runner is stopped. Commands ran through the repository Crabbox wrapper with frozen installation and candidate-byte verification. The verified combined source tree is
8da4d3b647eab3e6ee5172ff39cd59139326991e. Exact-head CI passed at6f2c05106740bacf421cd56e289cccb66cc6b134; all applicable jobs completed successfully. Hosted Vitest durations were 79.32 s for the isolation file and 2.10 s for Doctor UI; wrapper durations in the table include startup and cleanup. The two manual-command shell cases took 8 ms and 5 ms. ClawSweeper reviewed this head with no actionable or security findings. The PR is ready for normal maintainer review and remains unmerged.Related: #158198. This test repair is a separate prerequisite; neither PR is being merged by this task.