Skip to content

chore(test): expose profiler help finalization stages - #148804

Merged
steipete merged 1 commit into
mainfrom
codex/profiler-stage-diagnostic-20260915
Sep 15, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/profiler-stage-diagnostic-20260915

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related: #148610

What Problem This Solves

Profiler help tests can print usage and create a CPU profile file but still time out without showing whether finalization, inner process shutdown, or child completion stopped progressing. The cause remains unknown.

User Impact

No user-visible change. This maintainer-requested diagnostic makes future CI failures more informative; it does not claim to fix the timeout or attribute it to Fleet.

Why This Change Was Made

Extend only the existing help-case preload to record Inspector stop, the fixture CPU-profile write, disconnect, inner exit processing, and outer-observed child exit/close. The existing failure reporter reads at most 4 KiB from a separate fixture artifact; successful runs print none of it. Records contain only fixed roles/stages, numeric exit codes, and allowlisted signals, with no paths, config, profile contents, or error messages.

Production code, the hash-order observation and assertion, deadlines, spawn arguments/options, process-group ownership, and cleanup behavior remain unchanged. The original write Promise and ChildProcess are returned unchanged, and observer I/O failures are contained. These observations can narrow a future timeout but do not establish a native deadlock or identify a fix.

Evidence

Physical frozen-lockfile install; root-test TypeScript lane; targeted oxlint; oxfmt; git diff --check; and generated-preload syntax check all passed. Fresh isolated P2 review found no actionable findings. Local runtime/native profiling replay was intentionally not performed. Hosted CI run 34933540965 passed for cbf449000adbeb4765a818ceb8cf483682227866. ClawSweeper’s review of that exact head also found no actionable defects. This qualifies the diagnostic candidate without proving that the intermittent timeout is fixed.

@clawsweeper

clawsweeper Bot commented Sep 15, 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.

@steipete
steipete marked this pull request as ready for review September 15, 2026 05:38
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 15, 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 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 2:05 AM ET / 06:05 UTC (Revision 2).

ClawSweeper review

What this changes

Adds failure-only observations to profiler help tests showing whether profile finalization, inner-process exit, or child completion stopped progressing.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, bounded diagnostic improvement absent from current main. No actionable correctness or security findings remain, and the prior review identified no unresolved findings.

Priority: P3
Reviewed head: cbf449000adbeb4765a818ceb8cf483682227866

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused diagnostic extension with bounded output, preserved lifecycle behavior, and successful exact-head hosted validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer status exempts this internal diagnostic PR from external-contributor proof requirements; exact-head hosted CI passed, but no observed failing-run stage trace or timeout repair is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer status exempts this internal diagnostic PR from external-contributor proof requirements; exact-head hosted CI passed, but no observed failing-run stage trace or timeout repair is claimed.
Evidence reviewed 6 items Introduced change and current-main comparison: The pinned introduction changes only the existing profiler test. Comparing fetched main with the reviewed head shows the same stage-observation additions, so main does not already provide this diagnostic detail.
Hooks match the actual finalization owner: The profiler stops Inspector sampling, awaits CPU-profile writing, and disconnects in finally. The help entrypoint awaits that finalizer before exiting; the added observers match these operations and preserve the original write Promise and ChildProcess.
Diagnostic bounds and isolation: Stage recording is deduplicated and capped per process, the failure reporter reads at most 4096 bytes, and records contain fixed stages, numeric exit codes, and allowlisted signals. Existing help assertions, cancellation registration, and cleanup remain intact.
Findings None None.
Security None None.

How this fits together

OpenClaw’s test profiler launches Vitest and writes CPU profiles. These test-only observations follow profiling and subprocess shutdown, then feed the existing failure report when a help invocation fails or times out.

flowchart TD
  A[Profiler help test] --> B[Outer profiler process]
  B --> C[Inner Vitest process]
  C --> D[Stop profiler and write profile]
  D --> E[Disconnect and exit]
  E --> B
  B --> F[Bounded stage log]
  D --> F
  F --> G[Failure diagnostic report]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +79. Total +79 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 84 5 +79
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 84 5 +79

Review metrics

Metric Value Why it matters
Diagnostic bounds 4 KiB read; at most 16 distinct stages per process Failure reporting stays bounded and successful runs remain quiet.

Technical review

Best possible solution:

Keep finalization observations inside the existing test fixture and use future failure output to locate the stall before changing production shutdown behavior.

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

Not applicable to this diagnostic-only change; the intermittent timeout remains unreproduced here, and the PR explicitly makes no timeout-fix claim.

Is this the best way to solve the issue?

Yes. Extending the existing failure observer is a focused way to distinguish finalization stages without changing deadlines, assertions, or production lifecycle ownership.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This improves internal test diagnostics without changing product behavior or claiming to repair the 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 supplied maintainer status exempts this internal diagnostic PR from external-contributor proof requirements; exact-head hosted CI passed, but no observed failing-run stage trace or timeout repair is claimed.

Evidence

What I checked:

  • Introduced change and current-main comparison: The pinned introduction changes only the existing profiler test. Comparing fetched main with the reviewed head shows the same stage-observation additions, so main does not already provide this diagnostic detail. (test/scripts/run-vitest-profile.test.ts:60, cbf449000adb)
  • Hooks match the actual finalization owner: The profiler stops Inspector sampling, awaits CPU-profile writing, and disconnects in finally. The help entrypoint awaits that finalizer before exiting; the added observers match these operations and preserve the original write Promise and ChildProcess. (scripts/lib/vitest-profiler.mts:84, cbf449000adb)
  • Diagnostic bounds and isolation: Stage recording is deduplicated and capped per process, the failure reporter reads at most 4096 bytes, and records contain fixed stages, numeric exit codes, and allowlisted signals. Existing help assertions, cancellation registration, and cleanup remain intact. (test/scripts/run-vitest-profile.test.ts:460, cbf449000adb)
  • Related merged work and routing history: improve(test): retain profiling timeout diagnostics #148610 merged the existing failure reporter; this PR extends its observations rather than replacing it. Local recent history identifies repeated related work by Peter Steinberger, and GitHub commit metadata identifies steipete. Deeper local history inspection encountered unavailable objects; the GitHub commit patch supplied the relevant prior change. (test/scripts/run-vitest-profile.test.ts:42, c0c4881d0178)
  • Exact-head hosted validation: GitHub reports hosted run 34933540965 completed successfully for the reviewed head. The captured PR body explicitly says native profiling was not replayed locally and does not claim the intermittent timeout is fixed. No tests were executed during this read-only review. (cbf449000adb)
  • Latest-release comparison: The latest release’s profiler test contains the help cases but lacks both the existing failure reporter and these new finalization-stage observations. (test/scripts/run-vitest-profile.test.ts, 3a9d69db306c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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-15T05:43:10.570Z sha cbf4490 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit fdb848b into main Sep 15, 2026
125 checks passed
@steipete
steipete deleted the codex/profiler-stage-diagnostic-20260915 branch September 15, 2026 06:05
@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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

1 participant