Repository navigation
fix(ci): env-var budget check fails on main after the Doctor lint anchor handoff - #172887
Conversation
#170374 added OPENCLAW_UPDATE_REHEARSAL_COMMAND_STARTED_AT_MS so the rehearsal `doctor lint --json` CLI could pass its validation-command budget anchor to the lint worker it spawns. That pushed the distinct OPENCLAW_* count to 455 against the owner-held budget of 454, failing the env-var check inside the max-lines ratchet on every main push. The CLI already sends the worker a JSON payload on stdin and both processes are always the same build, so the anchor now travels there. The worker parses a strict { options, commandStartedAtMs } envelope and threads the value into its single resolveDoctorUpdateBudget call; every other command keeps anchoring at its own performance.timeOrigin. Budget semantics are unchanged. The deferred-inspection result builder moves next to its sibling createStateSnapshotFailureExecution in doctor-lint-output.ts so doctor-lint-runner.ts stays within its line cap.
|
🦞👀 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 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR passes Doctor lint’s command-start anchor through the existing worker stdin payload instead of an environment variable. Example: The environment-variable ratchet checks production source against its budget of 454 names.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a concrete CI ratchet failure without raising the budget, and no introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update rehearsal launches a candidate Doctor CLI, which supervises a same-build lint worker; the worker consumes options and timing information and returns a JSON inspection report. flowchart TD
A[Update rehearsal] --> B[Candidate Doctor CLI]
B --> C[Worker stdin envelope]
C --> D[Doctor lint worker]
D --> E[Shared inspection budget]
E --> F[JSON inspection report]
Technical reviewBest possible solution: Use the existing same-build stdin handoff while preserving command-start budgeting, advisory deferral, and worker cleanup behavior. Do we have a high-confidence way to reproduce the issue? The ratchet source, fixed budget, introduced environment name, and supplied before/after count establish the failure path; this review executed no target code. Is this the best way to solve the issue? The existing stdin transport is an appropriate owner for this private same-build value, and inspection found no remaining consumer requiring the removed environment variable. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 03af81024de8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +23, Tests +7. Total +30 across 9 files. Added test files: 0. View PR surface stats
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 15, 2026, 3:32 AM ET / 07:32 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…hor handoff (openclaw#172887) * fix(ci): hand the Doctor lint budget anchor to its worker over stdin openclaw#170374 added OPENCLAW_UPDATE_REHEARSAL_COMMAND_STARTED_AT_MS so the rehearsal `doctor lint --json` CLI could pass its validation-command budget anchor to the lint worker it spawns. That pushed the distinct OPENCLAW_* count to 455 against the owner-held budget of 454, failing the env-var check inside the max-lines ratchet on every main push. The CLI already sends the worker a JSON payload on stdin and both processes are always the same build, so the anchor now travels there. The worker parses a strict { options, commandStartedAtMs } envelope and threads the value into its single resolveDoctorUpdateBudget call; every other command keeps anchoring at its own performance.timeOrigin. Budget semantics are unchanged. The deferred-inspection result builder moves next to its sibling createStateSnapshotFailureExecution in doctor-lint-output.ts so doctor-lint-runner.ts stays within its line cap. * test(doctor): narrow the captured worker stdin to a string
Complete the consumer migrations from openclaw#172887, openclaw#172992, openclaw#172771 and openclaw#172989. Keep local schemas and callback types private and remove redundant barrel exports. Session sharing authority remains in its policy owner and is still enforced by production callers.
…law#172887) (cherry picked from commit 9d5724c) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes: the environment-variable budget check fails on every
mainpush (and in PRs that run the max-lines ratchet) because #170374 added a 455th distinctOPENCLAW_*name against the owner-held budget of 454.User Impact
No user-visible change. The CI ratchet passes again (
OPENCLAW_* count 454/454) without raising the budget, and update rehearsal budgeting behaves exactly as #170374 intended.Why This Change Was Made
#170374 anchors each rehearsal validation command's optional-inspection window at that command's own start. The rehearsal
doctor lint --jsonCLI spawns a separate lint worker that starts later, so it handed the worker its start time through a new environment variable,OPENCLAW_UPDATE_REHEARSAL_COMMAND_STARTED_AT_MS. That value had exactly one consumer (the worker's single budget resolution), and the CLI already sends that worker a JSON payload on stdin from the same build.The anchor now travels in that stdin payload as a strict
{ options, commandStartedAtMs }envelope and is threaded intoresolveDoctorUpdateBudget. In-process lint and the repair Doctor (which runs in its own driver-spawned process) keep anchoring at their ownperformance.timeOrigin, so budget semantics are unchanged. The environment name and its constant are deleted.The deferred-inspection result builder moves unchanged into
doctor-lint-output.ts, beside its siblingcreateStateSnapshotFailureExecution, sodoctor-lint-runner.tsstays within its 700-line cap.Release-note context: internal CI/update-rehearsal fix; no changelog entry needed.
Evidence
node --import ./scripts/tsx.mjs scripts/check-env-var-count.mts:OPENCLAW_* count 454/454(was455 exceeds budget 454on main). Bisected with the script's own file filter: 454 at the parent of c7dd7b9, 455 at c7dd7b9; that name is the only net change since the last budget commit.pnpm check:max-lines-ratchet,pnpm check:assertion-safety,pnpm check:test-mock-exports(all--base origin/main): pass.pnpm test src/commands/doctor-lint-process.test.ts src/commands/doctor-lint.update-budget.test.ts src/cli/doctor-lint-disposal.process.test.ts src/cli/program/register.maintenance.lazy.test.ts: 24 passed. The disposal test spawns the real lint worker, so the new stdin envelope is exercised end to end; the process test asserts the envelope carries the anchor, and the update-budget test proves an inherited anchor wins over the process start.pnpm tsgo, oxlint and oxfmt on touched files,git diff --check: clean.Inherited CI failure (not caused by this PR)
checks-ui-e2e (2/7)failsui/src/e2e/session-management.sidebar.e2e.test.ts > nests spawned sessions(both personal-pin variants) withexpected 4 to be +0at the "children start collapsed" assertion. This PR changes noui/files. The same failure reproduces locally on bareorigin/mainat 90943ae without this diff (pnpm test:ui:e2e ui/src/e2e/session-management.sidebar.e2e.test.ts -t "nests spawned sessions": 2 failed). Bisected locally: both cases pass at 4d60655 and fail at 12ec309 (#172362,fix: reveal new child sessions in the sidebar), which changed child-session reveal behavior without updating this e2e; the newest scheduled main CI run (38694591842, head e1dbb56) predates it, so the failure report has no comparable main job. Tracked separately as a red-main follow-up.The first CI run (38697658120) also failed
check-test-types-core-5with a TS2322 in this PR's own test (options.inputisstring | Uint8Array); fixed in 66514e4 by narrowing the captured stdin to a string.