Skip to content

test(doctor): stabilize OAuth and manual repair fixtures - #158282

Merged
steipete merged 1 commit into
mainfrom
fix/l48-doctor-oauth-isolation
Sep 25, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/l48-doctor-oauth-isolation

Conversation

@steipete

@steipete steipete commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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:build contract.

Evidence

Independent Codex review completed through P2 with no findings on the combined diff.

Blacksmith Testbox tbx_01m3cs13eb61n4hva00zazryp0 runs 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 8bd09f47b5bca5d98e9ee0864b235bbd8855cb9b replay 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 with store 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=1 on the Testbox.

Changed fixture owner Tests per file Isolated wall Hosted wrapper wall
src/commands/doctor-lint.state-isolation.test.ts (OAuth support change) 31 60.29 s 81.39 s
src/commands/doctor-ui.test.ts 13 13.91 s 3.52 s

The 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.ts passed 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 at 6f2c05106740bacf421cd56e289cccb66cc6b134; 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.

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.
@clawsweeper

clawsweeper Bot commented Sep 25, 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 commands Command implementations size: XS labels Sep 25, 2026
@steipete
steipete marked this pull request as ready for review September 25, 2026 19:17
@clawsweeper clawsweeper Bot added 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 Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 3:50 PM ET / 19:50 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: 6f2c05106740bacf421cd56e289cccb66cc6b134

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The narrow patch has substantial fixture-focused validation, with the original intermittent OAuth failure remaining unreproduced in baseline replay.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The changed fixtures exercise real SQLite-backed OAuth resolution and a real platform shell for the generated repair command; the PR records twenty after-fix standalone repetitions, three ordered shard passes, and successful exact-head CI. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed fixtures exercise real SQLite-backed OAuth resolution and a real platform shell for the generated repair command; the PR records twenty after-fix standalone repetitions, three ordered shard passes, and successful exact-head CI. No stored-data contract changes.
Evidence reviewed 10 items Current main retains the OAuth deadline: The successful isolation fixture still passes a 250 ms abort signal to OAuth token resolution.
Current main starts pnpm in the repair-command test: The baseline test executes the rendered command with a ten-second subprocess timeout.
OAuth isolation remains checked: The proposed fixture resolves the stored token through the private state worker, checks the report, and compares source SQLite bytes after the held transaction.
Findings None None.
Security None None.

How this fits together

OpenClaw 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -22. Total -22 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 12 34 -22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 34 -22

Review metrics

Metric Value Why it matters
Changed test-file cost 60.29 s OAuth suite; 13.91 s Doctor UI suite on one worker The PR records the cost of both changed test owners and explains why the SQLite isolation suite exceeds the repository's 30-second threshold.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed fixtures exercise real SQLite-backed OAuth resolution and a real platform shell for the generated repair command; the PR records twenty after-fix standalone repetitions, three ordered shard passes, and successful exact-head CI. No stored-data contract changes.

Label justifications:

  • P2: The change addresses CI fixture stability with limited product blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed fixtures exercise real SQLite-backed OAuth resolution and a real platform shell for the generated repair command; the PR records twenty after-fix standalone repetitions, three ordered shard passes, and successful exact-head CI. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed fixtures exercise real SQLite-backed OAuth resolution and a real platform shell for the generated repair command; the PR records twenty after-fix standalone repetitions, three ordered shard passes, and successful exact-head CI. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-25T19:24:27.152Z sha 6f2c051 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 25, 2026
@steipete
steipete merged commit f6156c7 into main Sep 25, 2026
193 checks passed
@steipete
steipete deleted the fix/l48-doctor-oauth-isolation branch September 25, 2026 23:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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