Repository navigation
perf(dev): uncap formatting and add pinned Bun selectors - #176368
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
72569c7 to
fe75e1c
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe75e1c788
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| oxlintPath, | ||
| finalArgs, | ||
| resolveOxlintToolchainEnv(oxlintPath, env), | ||
| resolveOxlintToolchainEnv(oxlintPath, tool.env), |
There was a problem hiding this comment.
Keep the repo toolchain on PATH for Bun lint
When OPENCLAW_LINT_TOOL=bun is used with the documented direct node scripts/run-oxlint.mjs ... workflow, tool.command is the cached Bun executable, so this call prepends Bun's cache directory rather than the checkout's node_modules/.bin. Because the direct Node invocation does not receive pnpm's PATH augmentation, type-aware lint cannot discover the tsgolint executable and fails before checking the requested files. Preserve the repository tool-bin directory separately when selecting Bun.
AGENTS.md reference: scripts/AGENTS.md:L21-L22
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Investigated on the pinned 1.4.4-canary.1+7bd4fdff3 fork through node scripts/run-oxlint.mjs --tsconfig tsconfig.json file.ts with OPENCLAW_LINT_TOOL=bun and every node_modules entry removed from PATH. A fixture containing an unawaited promise correctly exits 1 and reports typescript(no-floating-promises). Running standalone oxlint under the same environment instead reports Failed to find tsgolint executable. The pinned Bun owns its type-aware implementation, so this external-peer dependency does not apply to Bun. Leaving the existing toolchain handling unchanged.
|
@clawsweeper re-review Updated the lint lifecycle fixture to include the new selector/resolver dependency closure. All 18 cases pass on Node and the pinned Bun fork; fresh Codex autoreview is clean. The inline PATH finding was investigated through the documented direct wrapper and did not reproduce: Bun reports the seeded type-aware violation without node_modules on PATH. Details and current proof are in the PR body. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs changes before merge. What this changesThis PR selects pinned Bun for local formatting, adds CI formatter parity checks, and offers optional Bun linting. Example: Run pnpm format on supported macOS with no tool override.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: the maintainer-approved tooling change is useful and the fixture repair is correct, but one additional correctness fix is needed before merge. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherRepository commands and commit hooks pass formatting or lint arguments through shared tooling selectors, which resolve executables and return their output and exit status. flowchart TD
A[Package commands and hooks] --> B[Development tool selector]
B --> C[Existing pinned Bun resolver]
B --> D[Installed oxfmt or oxlint]
C --> E[Formatter or lint execution]
D --> E
E --> F[Output and exit status]
Technical reviewBest possible solution: Finalize sparse-checkout evidence suppression in the existing lint owner before deriving the selected tool's child environment. Do we have a high-confidence way to reproduce the issue? Source establishes the environment-copy defect for optional Bun lint with evidence enabled and a mix of present and omitted tracked targets; no target code was executed during this read-only review. Is this the best way to solve the issue? The shared selector appropriately reuses existing executable acquisition, lint supervision, and hook staging owners; the evidence environment needs to reflect their final policy. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3561a19c06ec. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceTests +118, Docs +60, Config 0, Other +96. Total +274 across 11 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 18, 2026, 4:08 PM ET / 20:08 UTC. |
|
Merged via squash.
|
Both formatter paths emit a timing footer when the selected files match no formatter inputs. Treat that footer as metadata instead of a changed path, so JSON-only PRs pass when both formatters select zero files. Exit status, actual changed paths, and unexpected output still participate in parity. Regressed in 806ea58 (#176368). The captured zero-file output fails on the base and passes with this change; real mismatches still fail in both directions. Runtime and update behavior are unchanged. Validation: pnpm test test/scripts/dev-tool.test.ts --maxWorkers=1 passes 20 cases (22.29s wrapper, 11.48s Vitest); exact CI zero-match command passes. Targeted script/test types, typed/boundary lint, erasability, and P2 review pass. The broad Linux run was interrupted by the provider after 100 passing files, with no test failure reported.
…6368) * feat(dev): use pinned Bun for local formatting * test(lint): include dev tool resolver in lifecycle fixture * perf(format): allow native formatter parallelism * perf(dev): retain faster formatter defaults and document fork
…w#176788) Both formatter paths emit a timing footer when the selected files match no formatter inputs. Treat that footer as metadata instead of a changed path, so JSON-only PRs pass when both formatters select zero files. Exit status, actual changed paths, and unexpected output still participate in parity. Regressed in e18ef17 (openclaw#176368). The captured zero-file output fails on the base and passes with this change; real mismatches still fail in both directions. Runtime and update behavior are unchanged. Validation: pnpm test test/scripts/dev-tool.test.ts --maxWorkers=1 passes 20 cases (22.29s wrapper, 11.48s Vitest); exact CI zero-match command passes. Targeted script/test types, typed/boundary lint, erasability, and P2 review pass. The broad Linux run was interrupted by the provider after 100 passing files, with no test failure reported.
What Problem This Solves
Adds one development formatter/linter selector backed by the existing checksum-pinned OpenClaw Bun resolver, while preserving the faster measured local defaults and the existing CI gates. The inherited
--threads=1made clean-tree writes take roughly 90–115 seconds; removing it restores native parallelism. Matched measurements do not justify making the current fork the formatter default.User Impact
pnpm format,format:check, their aliases, and the installed formatting hook share the selector. Oxfmt stays the local default;OPENCLAW_FORMAT_TOOL=bunopts into the pinned fork andOPENCLAW_FORMAT_TOOL=oxfmtforces oxfmt. Explicit Bun selection fails if unavailable. Oxlint stays the lint default;OPENCLAW_LINT_TOOL=bunopts into the same fork.DEFAULT_FORMAT_TOOLandDEFAULT_LINT_TOOLare the single switches for future qualification.The canonical OpenClaw Bun fork reference, linked from CONTRIBUTING and the scripts guide, documents openclaw/bun, the pin/cache owner, supported platforms, checksum verification, fallbacks, overrides, CI policy, and version probes. No Gateway runtime behavior changes.
Implementation and ownership
The selector reuses
resolvePinnedBun/pinnedBunEnv; it adds no download/cache owner. The built-in formatter isbun fmt;bun formatresolves the package script. The pinned fork does not supportbun lint --no-script; the lint child receivesnpm_lifecycle_event=lintto enter its built-in lint command without recursively invoking the package script. Existing lint configs, shards, resource limits, and non-oxlint phases remain owned by their current wrappers.CI's existing
format:checkgates on oxfmt and compares both tools' sorted changed-file sets and statuses on identical arguments. A mismatch fails in either direction; overrides cannot bypass this check. No additional CI job or runner is registered. Lint's gate remains oxlint until the required upstream fix (b39aa848) and exact diagnostic parity are qualified.Complete formatter caller inventory and reasons: all
format*aliases, check/check-changed/CI plan, installed pre-commit hooks, and the lint pipeline use the selector. Generated modules, snapshots, protocol source, generated UI/schema/maturity artifacts, and the dedicated docs formatter retain oxfmt to match their reproducible artifact gates. Dependency-less hook recovery retains its verified tooling-owner oxfmt fallback. The hydrate workflow only checks the dependency; there is no lint-staged formatter.Matched formatter measurements
Pinned executable revision:
1.4.4-canary.1+7bd4fdff3, matchingscripts/lib/openclaw-bun.json. macOS arm64, the same clean tree and 52,103 matched files, one sharedmac-build.lock, alternating order on repetition 2. Wall seconds include the package command and wrapper. The host was busy (load approximately 28–61); these are local measurements, not a universal speed claim.OPENCLAW_FORMAT_TOOL=bun pnpm formatOPENCLAW_FORMAT_TOOL=bun pnpm format:checkOPENCLAW_FORMAT_TOOL=oxfmt pnpm formatOPENCLAW_FORMAT_TOOL=oxfmt pnpm format:checkOPENCLAW_FORMAT_TOOL=oxfmt pnpm format --threads=1OPENCLAW_FORMAT_TOOL=oxfmt pnpm format:check --threads=1The initial controlled before/after write comparison was Bun 107.360s (one thread) → 13.332s (default threads), and oxfmt 114.481s → 12.612s. Every initial write preserved all tracked mtimes. All 18 matrix commands exited 0, the tree stayed clean, and sampled mtimes remained identical. The wrapper invokes one native process and one formatting pass; both native tools compare bytes before writing. The remaining native performance difference was not attributed to a measured hotspot. Removing the thread cap fixes the large slowdown; oxfmt remains default because Bun was not faster for both modes.
Exact-head CI
Timing/default/docs follow-up head:
c4ae266786c871272a87366b214cee92415aff21. Exact-head run 39166131438 completed. The exact-head watcher reports GREEN, excluding superseded checks.pnpm test:ci-failed 176368reports no selected Vitest failures. A separate PR-context check rejected the headingValidation; renaming it to the requiredEvidencepasses the same checker and the updated remote gate. No source changes or CI reruns were needed for that metadata correction.CI failure classification
Run 39161415724, head
1fe628d53d777323ac5afdc8eb43b30931940af2, failed two test shards. Both actually ran Bun despitechecks-node-*names. Neither test reaches the changed formatter/linter code: test commands, runtime routing, Gateway, and Codex production owners are unchanged.checks-node-changed-extensions-bundle-26-2:extensions/codex/src/session-catalog-index-recovery.test.ts, concurrent-native-rename case, 120-second timeout. The reported stack alone does not identify the stalled await. No matching failure was found in six recent scheduled-main runs and thirteen other PR runs. Three completed isolated Node replays pass all 12 tests; the concurrent-rename case takes 226ms, 188ms, and 313ms. All three isolated Bun replays also pass 12/12; the concurrent-rename case takes 1893ms, 3231ms, and 68ms. The earlier interrupted cold-compile attempt is inconclusive and excluded.checks-node-changed-16:test/e2e/qa-lab/runtime/gateway-timeout-recovery-subagent.e2e.test.ts, child-completion case. Exact independent Bun match in run 39160875395, job 117774078361, on an unrelated PR: child terminal/ok, delivery pending, nonleasable, no recovered parent reply, timeout during child handoff. This is an independent failure outside the tooling change; it is not established as Bun-only.Historical job metadata and exact logs were read once and retained locally. No claim is made that passing shard metadata proves selection of either test. The old Codex timeout is not yet sufficient evidence for the inherited-only landing exception. The isolated Node repetitions pass 12/12, 12/12, and 12/12, with Vitest durations 247.53s, 312.39s, and 206.96s (wrapper 294.87s, 348.13s, and 261.70s). Command:
CI=1 OPENCLAW_VITEST_RUNTIME=node OPENCLAW_VITEST_WORKER_CACHE=1 node scripts/test-projects.mts extensions/codex/src/session-catalog-index-recovery.test.ts --maxWorkers=1, withTMPDIR=/private/tmp/oc-devfmt. Passing replays establish nonreproduction, not a repair or inherited-failure attribution. The three matching Bun commands, withOPENCLAW_VITEST_RUNTIME=bunand explicitOPENCLAW_BUN_PATHset to the verified pinned executable, pass 12/12 each: Vitest 482.91s, 157.39s, and 178.91s; wrapper 534.68s, 198.07s, and 213.41s. All six processes exit 0.Current-head Bun CI explicitly passes both cases: Codex job 117789701704, concurrent rename 11ms and all 12 file tests passed; QA job 117789705038, child completion 19872ms, 1/1 passed. The observed old failures are disjoint from this tooling change and do not recur on the current head. The QA signature is independently observed on another PR; neither failure is established as Bun-only. No inherited-failure merge exception is needed.
Evidence
test/scripts/run-oxlint.test.ts(36 tests),test/git-hooks-pre-commit.test.ts(55), andtest/scripts/lint-status.test.ts(18). The lint-status fixture repair copies the newly imported selector and pinned resolver; its original unresolved-import failure was reproduced, then fixed without changing lifecycle assertions.test/scripts/dev-tool.test.ts: 19/19 on Node (3.91s Vitest, 7.45s wrapper) and pinned Bun (4.65s Vitest, 11.04s wrapper). Focused script and root-test lint, bounded typecheck, formatting, two-page MDX, and canonical anchor checks pass. Fresh Codex autoreview is clean at P0–P2.No runtime-only skips, fork workarounds, or unrelated product repairs are included. Production/tooling delta: +111/-12 (net +99); tests: +105/-0. Runtime source delta is zero. The necessary growth is the shared selector and CI parity entrypoint; existing lint orchestration and hook staging stay with their current owners. The simplification pass removes obsolete default-Bun fallback tests and folds silent default selection into the existing selector table. Changelog edits remain release-owned.