Skip to content

chore(test): retain Doctor fixture settlement diagnostics - #155944

Merged
vincentkoc merged 1 commit into
mainfrom
test/doctor-fixture-settlement-diagnostics-20260923
Sep 22, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
test/doctor-fixture-settlement-diagnostics-20260923

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Related: #155905

What Problem This Solves

Doctor configuration tests can time out without identifying the unfinished operation or showing whether their temporary-home fixture settled before the next case began.

User Impact

No user-visible or runtime behavior change. Failed or unsettled test fixtures emit bounded diagnostic receipts; successful fixtures remain quiet. This is an observation change, not a claimed fix for the CI failure.

Why This Change Was Made

Observe the existing awaited phases in the two affected suites and report body/fixture settlement, outstanding phases, and overlapping fixtures. Preserve the original test order, deadlines, mocks, temporary-home ownership, SQLite worker-scope reuse, and cleanup. Receipts contain static labels, synthetic identifiers, timings, and a home-ownership boolean, without paths, configuration contents, or credentials. The finished hook observes state after existing afterEach hooks; it does not identify the exact timeout instant or establish causality.

Evidence

Measured test costs

Ordinary exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/35782086482.

Test file Passed --maxWorkers=1 command wall CI Vitest duration CI file-invocation wall
src/commands/doctor-config-preflight.test.ts 24 94.95 s 69.11 s 70.73 s
src/commands/doctor-config-flow.billing-route.test.ts 6 111.23 s 138.65 s 140.45 s

doctor-config-preflight.test.ts (94.95 s) protects the real preflight boundary between active config files, last-known-good recovery, and SQLite state. Its cases verify updater write ownership, profile/custom-path selection, repair of readable legacy config before fallback recovery, preservation of agent ownership and state locators, durable rereads, and idempotent recovery without extra clobber backups. A pure migration/schema test can check transformed objects; it cannot prove that the actual preflight selects and preserves the correct file and state store across repair and reread. This fixture change therefore retains the existing file’s integration coverage and case order, including repeated calls and shared worker-scope cleanup.

doctor-config-flow.billing-route.test.ts (111.23 s) protects billing-route migration and update-ledger commit ordering through real Doctor context preparation and config writes. It checks inherited routes for single/multiple agents, warning deduplication after repeated writes and a fresh context, and deferred model retirement through both update correlation channels. Completion must follow a durable valid config write; missing correlation must leave the run unchanged, and write refusal must preserve the deferred receipt and original file. Mocking migration, auth-store reads, config persistence, or the ledger would remove these cross-owner assertions; a resolver-only or receipt-formatting unit test cannot prove them.

These measurements are the existing file-level execution cost, including startup/compilation, not a claim that every second is irreducible or that observer overhead has been isolated. The scoped proof retains these persistence/lifecycle boundaries; it does not reproduce the original shared-shard timeout.

Single-worker measurements ran time -p corepack pnpm test <file> --maxWorkers=1 sequentially, preflight then billing, on exact head 7a1e0c520b33d2f5967645f25967086bd32bdc69: https://github.com/openclaw/openclaw/actions/runs/35783965610. The receiver had 4 logical CPUs and 16.56 GB RAM, Node 24.19.0, pnpm 12.4.0, and the pinned patched Vitest 5.0.0. Both commands exited 0; final source/input and runtime guards passed, diagnostic receipts stayed quiet, and the native one-shot lease closed. Wall times include the package-manager/test wrapper and startup/compilation, excluding dependency installation; they do not isolate observer overhead.

The CI jobs configured OPENCLAW_VITEST_MAX_WORKERS=2 and ran each selected file in a separate Vitest invocation. The billing job observed 2 logical CPUs and 8.22 GB RAM, with 2 outer plans requested and 1 admitted; the actual Vitest pool cardinality was not emitted. The affected files belonged to different changed-test jobs, so this is not the original shared 24-file shard. Within-file test order and deadlines remain unchanged.

@vincentkoc vincentkoc self-assigned this Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 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: M maintainer Maintainer-authored PR labels Sep 22, 2026
@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 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 22, 2026, 5:14 PM ET / 21:14 UTC (Revision 4).

ClawSweeper review

What this changes

Adds bounded diagnostics to Doctor configuration tests showing unfinished operations, fixture settlement, and overlapping fixtures while keeping successful runs quiet.

Merge readiness

⛔ Needs changes before merge - 1 item remains

The work remains useful and is absent from current main. No actionable code defect was found; the prior timing follow-up is partially resolved, with the cost justification still outstanding.

Priority: P3
Reviewed head: 7a1e0c520b33d2f5967645f25967086bd32bdc69

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused diagnostic patch with no actionable correctness finding and useful validation; one previously requested cost explanation remains.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test-only PR. Reported exact-head runs exercise the changed Doctor fixture and show quiet success; failure receipts and the original timeout's cause remain unproven without being claimed as fixed. No stored-data contract changes.
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 MEMBER-authored test-only PR. Reported exact-head runs exercise the changed Doctor fixture and show quiet success; failure receipts and the original timeout's cause remain unproven without being claimed as fixed. No stored-data contract changes.
Evidence reviewed 8 items Verified introduced scope: The pinned merge-base-to-head diff changes only the two Doctor test suites and their shared test fixture. Existing assertions, fixture cleanup, worker reuse, and deadlines remain intact; production code is unchanged.
Current main still lacks these diagnostics: Current main retains the original worker-scoped temporary-home wrapper without the observation state or completion receipts. The three affected files have no differences between fetched main and the pinned merge base.
Existing measurement boundary reused: The preflight suite supplies its observer through the existing measurement callback. That callback wraps the existing bootstrap measurement and operation; it does not introduce another migration owner or alter persisted configuration contracts. Unchanged Codex runtime identifiers in fixtures do not establish a dependency on the Codex harness for this diagnostic change.
Findings None None.
Security None None.

How this fits together

Doctor checks and repairs OpenClaw configuration. These test fixtures exercise that flow in temporary homes and report lifecycle observations to CI logs when tests fail or remain unsettled.

flowchart TD
  A[Doctor configuration tests] --> B[Temporary home fixture]
  B --> C[Existing Doctor operations]
  C --> D[Bounded phase observations]
  B --> E[Fixture settlement]
  D --> F{Failed or unsettled?}
  E --> F
  F -->|Yes| G[Diagnostic receipt in CI logs]
  F -->|No| H[Quiet completion]
Loading

Before merge

  • Complete next step (P2) - Complete the prior cost follow-up in the PR body: explain which contracts require the 94.95-second preflight and 111.23-second billing-route runs and why cheaper coverage cannot prove them; reuse the recorded measurements.
Agent review details

Security

None.

PR surface

Tests +197. Total +197 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 300 103 +197
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 300 103 +197

Review metrics

Metric Value Why it matters
Single-worker test cost Preflight 94.95 s; billing-route 111.23 s Both reported measurements exceed the threshold requiring a contract and cheaper-layer justification; they do not isolate observer overhead.

Technical review

Best possible solution:

Keep diagnostics in the existing fixture owner, preserving failure behavior and cleanup while making future timeout investigation more informative.

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

Not applicable to this diagnostic-only patch: the original CI timeout is documented, but no deterministic current-main reproduction or causal repair is claimed.

Is this the best way to solve the issue?

Yes. Observing existing promises and the existing fixture lifecycle is a focused approach that preserves assertions and avoids changing timeout or cleanup policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This improves internal test diagnostics without changing production behavior or claiming to repair the underlying timeout.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 MEMBER-authored test-only PR. Reported exact-head runs exercise the changed Doctor fixture and show quiet success; failure receipts and the original timeout's cause remain unproven without being claimed as fixed. No stored-data contract changes.

Evidence

What I checked:

  • Verified introduced scope: The pinned merge-base-to-head diff changes only the two Doctor test suites and their shared test fixture. Existing assertions, fixture cleanup, worker reuse, and deadlines remain intact; production code is unchanged. (src/commands/doctor-config-preflight.test-support.ts:96, 7a1e0c520b33)
  • Current main still lacks these diagnostics: Current main retains the original worker-scoped temporary-home wrapper without the observation state or completion receipts. The three affected files have no differences between fetched main and the pinned merge base. (src/commands/doctor-config-preflight.test-support.ts:13, b060cfed1b71)
  • Existing measurement boundary reused: The preflight suite supplies its observer through the existing measurement callback. That callback wraps the existing bootstrap measurement and operation; it does not introduce another migration owner or alter persisted configuration contracts. Unchanged Codex runtime identifiers in fixtures do not establish a dependency on the Codex harness for this diagnostic change. (src/commands/doctor-config-preflight-measure.ts:4, 7a1e0c520b33)
  • Dependency hook contract inspected: The newly imported onTestFinished hook establishes the dependency signal. Published vitest 5.0.0 metadata identifies vitest-dev/vitest as its repository; the bundled runner invokes completion hooks with the test context after afterEach and records failures before invoking them. OpenClaw's inspected runner patch changes task-update throttling, not this ordering. The package metadata did not provide a source commit SHA.
  • Prior follow-up and updated measurements: The supplied body snapshot, sourceRevision 6f7cf6cb39accb49de374dd5bf4a7a640dab2bcb8aefa712220d84979bcce34b, now reports single-worker wall times of 94.95 seconds for preflight and 111.23 seconds for billing-route, plus CI durations. This resolves the prior request for measurements. It does not yet explain which contracts require the cost and why cheaper coverage cannot prove them, as required above 30 seconds. No additional timing run is needed for that explanation. Public docs: docs/help/testing/writing-tests.md. (docs/help/testing/writing-tests.md:70, 7a1e0c520b33)
  • Validation evidence and limits: GitHub confirms ordinary CI run 35782086482 succeeded on the reviewed head. The captured body reports 30 passing focused tests and quiet successful fixtures; it explicitly distinguishes these passes from reproducing or fixing the original timeout. The measurement workflow is cancelled, consistent with the stated one-shot cleanup behavior; its command result was not independently verified because the log download redirected to a blocked artifact host. No tests or target code were executed during this review, and the checkout remained clean. (7a1e0c520b33)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add the protected contract and why cheaper coverage cannot prove it for each test file exceeding 30 seconds, using the measurements already recorded.

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 (3 earlier review cycles)
  • reviewed 2026-09-22T20:32:13.755Z sha 7a1e0c5 :: needs changes before merge. :: none
  • reviewed 2026-09-22T20:50:39.697Z sha 7a1e0c5 :: needs changes before merge. :: none
  • reviewed 2026-09-22T21:06:59.527Z sha 7a1e0c5 :: needs changes before merge. :: none

@vincentkoc
vincentkoc marked this pull request as ready for review September 22, 2026 20:42
@vincentkoc
vincentkoc merged commit 389b30a into main Sep 22, 2026
197 of 202 checks passed
@vincentkoc
vincentkoc deleted the test/doctor-fixture-settlement-diagnostics-20260923 branch September 22, 2026 23:27
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit '7d7f977ccfc1ac177526232e4f4960febd010015': (91 commits)
  test: avoid unused target setup in package profile fixtures (#155972)
  fix(worktrees): batch snapshot metadata reads
  test(plugin-state): distinguish borrowed and foreign lifecycle owners
  refactor(agents): share external harness session and attempt machinery (#152181)
  chore(i18n): refresh native locales (#156006)
  chore(test): retain Doctor fixture settlement diagnostics (#155944)
  perf(codex): reuse unchanged inference request bytes (#155987)
  perf(test): prepare snapshot ownership subprocess imports (#155973)
  perf(test): consolidate channel registry coverage (#155014)
  fix(runtime): preserve Node worker dependencies and cleanup diagnostics (#155292)
  perf(test): prepare worktree GC child runtime (#155928)
  fix(ui): open browser cards after delayed panel renders (#153253)
  fix(update): retain the running updater by hard link instead of copying the package (#155977)
  feat(decisions): add explicit evaluation and Labs opt-in foundation (#155134)
  fix(state): preserve lifecycle custody across worker dispatch
  improve: reuse shared tooling fixtures and defer legacy updater proof (#155731)
  improve(ui): reduce real-Gateway test preparation (#155979)
  perf(state): move session RPC SQL off the Gateway main thread (#155740)
  docs(freebsd): explain native Codex runtime limits (#155980)
  fix(qa): count Code Mode nested tool activity as transcript tool evidence (#155976)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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