Skip to content

fix(runtime): restore environment variable count ratchet - #125175

Merged
steipete merged 1 commit into
mainfrom
fix/node-version-check-env-ratchet
Aug 17, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/node-version-check-env-ratchet

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #124812

What Problem This Solves

Fixes an issue where the environment-variable count ratchet failed on current main because a non-environment exported identifier was mistaken for a new OPENCLAW_* variable.

Why This Change Was Made

Renames the worker bootstrap expression export to the semantic PROCESS_NODE_VERSION_CHECK across its declaration, type, production consumer, and existing tests. The environment-variable budget remains unchanged, and runtime behavior is unchanged.

User Impact

Maintainers can run the environment-variable count ratchet successfully again without raising its budget or treating an internal identifier as configuration surface.

Evidence

  • Before: OPENCLAW_* count 502 exceeds budget 501
  • After: node --import tsx scripts/check-env-var-count.mts --base origin/main → OPENCLAW_* count 501/501
  • node scripts/run-vitest.mjs src/gateway/worker-environments/bootstrap.test.ts → 36 passed
  • node scripts/check-changed.mjs -- node-version.mjs node-version.d.mts src/gateway/worker-environments/bootstrap.ts src/gateway/worker-environments/bootstrap.test.ts → passed (ratchets, formatting, typechecks, lint, import cycles)
  • Fresh autoreview: clean, no accepted/actionable findings; patch correct (0.99 confidence)
  • Toolchain: Node v24.15.0, pnpm 11.15.1; OPENCLAW_SKIP_PROVIDERS=1, OPENCLAW_SKIP_CHANNELS=1

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 08:38
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 17, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 4:46 AM ET / 08:46 UTC.

ClawSweeper review

What this changes

The PR renames the gateway worker’s generated Node-version-check export and all local references so the environment-variable count ratchet no longer treats it as an OPENCLAW_* setting.

Regression provenance

Regression provenance — verified: source commit a917c99e92c8 by Peter Steinberger; canonical PR #124812 (blame-to-merge-commit).

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this focused repair open. Current main still places the internal OPENCLAW_* identifier in counted gateway source, while the PR removes that false configuration-surface token without changing the generated Node-version expression; the protected maintainer label also requires normal maintainer handling.

Priority: P3
Reviewed head: 32bd2885a9bf8b4495f6abb38f3dc8e8a8f4e82b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving patch with direct terminal evidence and no supported correctness findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides direct after-fix terminal output for the ratchet and focused worker-bootstrap tests; redact-sensitive handling is not implicated by this internal change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides direct after-fix terminal output for the ratchet and focused worker-bootstrap tests; redact-sensitive handling is not implicated by this internal change.
Evidence reviewed 7 items Ratchet contract: The checker collects every OPENCLAW_* token from production source roots, and the budget is fixed at 501.
Current-main failure path: Current main imports and interpolates OPENCLAW_PROCESS_NODE_VERSION_CHECK from counted src/gateway source, creating the extra distinct ratchet token.
Exact PR repair: The branch changes only the export name and all declaration, production, and test consumers; the expression body and configured budget are untouched.
Findings None None.
Security None None.

How this fits together

Gateway worker bootstrap embeds OpenClaw’s canonical Node release check before a remote worker starts. A repository ratchet scans production src, packages, and extensions text for OPENCLAW_* names to limit public configuration growth.

flowchart LR
A[Node release policy] --> B[Generated worker check]
B --> C[Gateway worker bootstrap]
C --> D[Remote worker preflight]
C --> E[Environment-name ratchet]
E --> F[Configuration budget]
Loading

Before merge

  • Resolve merge risk (P1) - The supplied snapshot shows the PR behind main with some exact-head checks still running; merge only after GitHub recomputes the clean merge and required checks finish green.
  • Complete next step (P2) - This already contains the narrow owner-boundary repair; it needs ordinary maintainer merge review rather than an automated replacement.
Agent review details

Security

None.

PR surface

Source 0, Tests 0, Other 0. Total 0 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 1 4 4 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 2 0
Total 4 8 8 0

Review metrics

Metric Value Why it matters
Production and test LOC production +4/-4 (net 0); tests +4/-4 (net 0) All changes are a behavior-neutral identifier rename; the repair adds no production surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the producer-side rename, preserve the unchanged generated expression and budget, then merge after current-head checks confirm the clean merge.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the producer-side rename, preserve the unchanged generated expression and budget, then merge after current-head checks confirm the clean merge.

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

Yes, source-reproducible: the checker scans OPENCLAW_* tokens in production src, and current main imports that exact internal identifier there. Local execution could not run because this checkout lacks tsx, while the PR supplies before-and-after terminal output.

Is this the best way to solve the issue?

Yes. Renaming the internal producer and its only in-repository consumers fixes the false ratchet count at the producer boundary without weakening the scanner or raising its budget.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ee86b24ac170.

Labels

Label changes:

  • add P3: This is a small internal ratchet repair with no changed user-facing runtime behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides direct after-fix terminal output for the ratchet and focused worker-bootstrap tests; redact-sensitive handling is not implicated by this internal change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides direct after-fix terminal output for the ratchet and focused worker-bootstrap tests; redact-sensitive handling is not implicated by this internal change.

Label justifications:

  • P3: This is a small internal ratchet repair with no changed user-facing runtime behavior.
  • 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 (terminal): The PR body provides direct after-fix terminal output for the ratchet and focused worker-bootstrap tests; redact-sensitive handling is not implicated by this internal change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides direct after-fix terminal output for the ratchet and focused worker-bootstrap tests; redact-sensitive handling is not implicated by this internal change.

Evidence

What I checked:

  • Ratchet contract: The checker collects every OPENCLAW_* token from production source roots, and the budget is fixed at 501. (scripts/check-env-var-count.mts:9, ee86b24ac170)
  • Current-main failure path: Current main imports and interpolates OPENCLAW_PROCESS_NODE_VERSION_CHECK from counted src/gateway source, creating the extra distinct ratchet token. (src/gateway/worker-environments/bootstrap.ts:3, ee86b24ac170)
  • Exact PR repair: The branch changes only the export name and all declaration, production, and test consumers; the expression body and configured budget are untouched. (node-version.mjs:76, 32bd2885a9bf)
  • Behavior coverage: The existing worker-bootstrap test still verifies both injection of the generated expression and equivalence with the canonical Node-release classifier across the shared case corpus. (src/gateway/worker-environments/bootstrap.test.ts:400, 32bd2885a9bf)
  • History provenance: The related merged Node-version work added the generated expression and the gateway consumer; current-line blame attributes the export to that merge commit. (node-version.mjs:76, a917c99e92c8)
  • Release provenance: The related merge is on current main but is not contained in the latest stable tag v2026.7.1-2, so this is current-main behavior rather than a released behavior. (node-version.mjs:76, a917c99e92c8)

Likely related people:

  • steipete: The merged related change created node-version.mjs and added its gateway worker-bootstrap consumer. (role: introduced the current Node-version expression and recent area contributor; confidence: high; commits: a917c99e92c8; files: node-version.mjs, src/gateway/worker-environments/bootstrap.ts, src/gateway/worker-environments/bootstrap.test.ts)

Rank-up moves

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

  • Let the exact-head required checks complete green before merge.

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.

Copy link
Copy Markdown
Contributor Author

Land-ready verification for 32bd2885a9bf8b4495f6abb38f3dc8e8a8f4e82b:

  • Reproduced current-main failure: OPENCLAW_* count 502 exceeds budget 501.
  • node --import tsx scripts/check-env-var-count.mts --base origin/main → OPENCLAW_* count 501/501.
  • node scripts/run-vitest.mjs src/gateway/worker-environments/bootstrap.test.ts → 36/36 passed.
  • node scripts/check-changed.mjs -- node-version.mjs node-version.d.mts src/gateway/worker-environments/bootstrap.ts src/gateway/worker-environments/bootstrap.test.ts → passed all selected ratchets, formatting, typechecks, lint, and import-cycle checks.
  • Fresh autoreview: clean, no accepted/actionable findings; patch correct (0.99 confidence).
  • Exact-head hosted CI/Testbox gate: run 32011340649 green; scripts/pr prepare-run 125175 accepted hosted_exact_or_recent_parent for the exact head at 2026-08-17T08:49:54Z.
  • ClawSweeper's only rank-up move—complete exact-head CI—is satisfied. No actionable findings remain.

Toolchain: Node v24.15.0, pnpm 11.15.1, with OPENCLAW_SKIP_PROVIDERS=1 and OPENCLAW_SKIP_CHANNELS=1. Production LOC: +4/-4 (net 0); tests: +4/-4. No proof gaps for this behavior-neutral internal rename.

@steipete
steipete merged commit 31a4bab into main Aug 17, 2026
279 checks passed
@steipete
steipete deleted the fix/node-version-check-env-ratchet branch August 17, 2026 08:51

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

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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.

2 participants