Skip to content

fix: allow ratchet checks to read large Git baselines - #164743

Merged
shakkernerd merged 1 commit into
mainfrom
fix/ratchet-git-buffer
Oct 4, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
fix/ratchet-git-buffer

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #164741

What Problem This Solves

Fixes the baseline-ratchet CI lane failing with spawnSync git ENOBUFS when the mock-export ledger exceeds Node's default 1 MiB subprocess output buffer. The committed ledger at comparison base 301a040 is 1,675,312 bytes, so unrelated pull requests fail before the check can inspect mock factories.

User Impact

CI can read large committed and staged baseline files and continue enforcing the existing rules. There is no runtime or configuration change. The exact-factory comparison, shrink-only policy, malformed-input rejection, and missing-path behavior remain intact; no baseline entry or exception is added.

Why This Change Was Made

The shared Git text reader now uses the same finite 256 MiB output bound already used by its sibling Git readers. This fixes both reference and index reads at their existing owner without introducing a second reader or an unbounded allocation policy.

The existing real-Git snapshot test now uses a baseline larger than 1 MiB. Its distinct trailing values still prove that worktree, index, and committed-reference reads select the correct snapshot, and its missing-path control remains unchanged. No additional test fixture lifecycle or test case was added.

Evidence

On an isolated Cloud Mac with Node 24.21.0 and locked pnpm 12.5.1 dependencies, against base b72a95e3f75cb6143847265fe83cc2362b57eea2:

  • The enlarged existing regression fails with ENOBUFS on the original reader: 11 passed, 1 failed, 2.64 seconds wall time.
  • pnpm test test/scripts/shrink-ratchet.test.ts test/scripts/check-test-mock-exports.test.ts --maxWorkers=1 passes all 14 tests after the repair in 2.21 seconds wall time. This is the combined two-file duration; no additional test case or fixture lifecycle is added.
  • Formatting and both configured changed-file lint checks pass. Independent engineering review and repository autoreview through P2 report no actionable findings.
  • The real pnpm check:test-mock-exports --base 301a040200d10e65813c434a57364c5eb79e7b97 command now reads the ledger and reaches enforcement. It still exits 1 for three existing incomplete mock factories in src/agents/auth-profiles/usage.test.ts and src/agents/bash-tools.exec-host-node.integration.test.ts. Those files, the ledger, and the scanner are unchanged by this PR. This is proof that the buffer failure is repaired, not an all-green ratchet claim.

The same repaired scanner also reports those identical three policy violations when invoked through its existing main(root, argv) entry point against a clean, untouched b72a95e3 worktree. This is repaired-tool/baseline-data evidence, distinct from the original CLI reproduction that stops earlier at ENOBUFS.

Exact-head CI run 37174459227 completed with 33 successful and 26 skipped jobs. The ratchet job reports only the same three existing policy violations, and the CI aggregate reports that failed job. The other selected test, type, lint, structural, and security jobs passed. ClawSweeper awarded Platinum to head 0d89862b2d0891ef114eb756d5a614df6cd23613 with no findings. The separate mock-policy violations remain outside this buffer repair; this is not an all-green CI claim.

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@shakkernerd shakkernerd self-assigned this Oct 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 11:37 PM ET / October 4, 2026, 03:37 UTC.

ClawSweeper review

What this changes

The PR lets CI ratchet checks read large committed and staged baselines by applying the existing finite Git output limit and enlarging an existing snapshot regression.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: fetched main and the latest release still use the default buffer for baseline reads. The focused repair preserves enforcement, and no actionable patch defect was found.

Priority: P1
Reviewed head: 0d89862b2d0891ef114eb756d5a614df6cd23613

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful real-Git regression coverage and reported production-command verification.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body reports the real mock-export CLI on an isolated Cloud Mac reading the oversized committed ledger and reaching policy enforcement after the shared-reader repair; real-Git regression results supplement that observation. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body reports the real mock-export CLI on an isolated Cloud Mac reading the oversized committed ledger and reaching policy enforcement after the shared-reader repair; real-Git regression results supplement that observation. No stored-data contract changes.
Evidence reviewed 10 items Pinned introduced repair: The introduced production change adds maxBuffer: GIT_MAX_BUFFER to the existing readGitText owner. The constant already bounds sibling Git readers at 256 MiB; parsing, allowance selection, and enforcement are unchanged.
Current main still needs the repair: Fetched main retains readGitText without maxBuffer. loadRatchetSnapshot uses it for staged content, and loadRatchetReference uses it for committed baseline content.
Latest release lacks the repair: The v2026.9.8 source also omits maxBuffer in readGitText, so the repair is not present in the supplied latest release.
Findings None None.
Security None None.

How this fits together

Ratchet checks compare repository baselines with current or staged files to prevent new policy violations. Their shared Git reader supplies committed and staged baseline text to the existing parsers and enforcement rules.

flowchart TD
 A[Committed baseline] --> C[Shared Git reader]
 B[Staged baseline] --> C
 C --> D[Bounded text output]
 D --> E[Baseline parser]
 F[Current source inventory] --> G[Policy comparison]
 E --> G
 G --> H[Pass or actionable violations]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +1, Other +1. Total +2 across 2 files.

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

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164741
Summary: This PR is the candidate fix for the linked issue's committed-baseline buffer failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep baseline transport bounded at the existing shared limit while preserving exact-factory and shrink-only enforcement.

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

Yes: current-main source routes a verified 1,675,312-byte baseline through a subprocess reader without an explicit buffer limit, and the supplied report records ENOBUFS through the real CLI. This read-only review did not execute the failing command.

Is this the best way to solve the issue?

Yes: applying the existing finite limit at the shared reader fixes committed and staged reads without changing baseline policy or adding a competing implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The linked report identifies an actual CI ratchet transport failure blocking otherwise unrelated PRs, independently of this PR's pending checks.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports the real mock-export CLI on an isolated Cloud Mac reading the oversized committed ledger and reaching policy enforcement after the shared-reader repair; real-Git regression results supplement that observation. No stored-data contract changes.
  • 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 (live_output): The captured body reports the real mock-export CLI on an isolated Cloud Mac reading the oversized committed ledger and reaching policy enforcement after the shared-reader repair; real-Git regression results supplement that observation. No stored-data contract changes.

Label justifications:

  • P1: The linked report identifies an actual CI ratchet transport failure blocking otherwise unrelated PRs, independently of this PR's pending checks.
  • 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 (live_output): The captured body reports the real mock-export CLI on an isolated Cloud Mac reading the oversized committed ledger and reaching policy enforcement after the shared-reader repair; real-Git regression results supplement that observation. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports the real mock-export CLI on an isolated Cloud Mac reading the oversized committed ledger and reaching policy enforcement after the shared-reader repair; real-Git regression results supplement that observation. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced repair: The introduced production change adds maxBuffer: GIT_MAX_BUFFER to the existing readGitText owner. The constant already bounds sibling Git readers at 256 MiB; parsing, allowance selection, and enforcement are unchanged. (scripts/lib/shrink-ratchet.mts:41, 0d89862b2d08)
  • Current main still needs the repair: Fetched main retains readGitText without maxBuffer. loadRatchetSnapshot uses it for staged content, and loadRatchetReference uses it for committed baseline content. (scripts/lib/shrink-ratchet.mts:37, d0c59630c5a6)
  • Latest release lacks the repair: The v2026.9.8 source also omits maxBuffer in readGitText, so the repair is not present in the supplied latest release. (scripts/lib/shrink-ratchet.mts:36, fc23bc864e45)
  • Baseline exceeds the former transport bound: The actual comparison-base ledger is 1,675,312 bytes, matching the linked report and exceeding the default 1 MiB subprocess output limit. (config/test-mock-exports-baseline.txt, 301a040200d1)
  • Meaningful regression coverage: The existing real-Git snapshot test now exceeds 1 MiB and retains distinct trailing values for worktree, index, and committed reference selection, plus its missing-path control. No new test lifecycle or production seam is introduced. (test/scripts/shrink-ratchet.test.ts:60, 0d89862b2d08)
  • Reported production-entrypoint verification: The captured PR body reports an isolated Cloud Mac run with Node 24.21.0: the enlarged regression fails before the repair with ENOBUFS, both focused files pass afterward in 2.21 seconds, and pnpm check:test-mock-exports --base 301a040 reaches enforcement rather than failing during baseline transport. Its remaining exit 1 is explicitly attributed to three existing mock-policy violations. These are contributor-reported results, not reviewer execution. (scripts/check-test-mock-exports.mts:167, 0d89862b2d08)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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.

@shakkernerd
shakkernerd merged commit 58310ca into main Oct 4, 2026
119 of 122 checks passed
@shakkernerd
shakkernerd deleted the fix/ratchet-git-buffer branch October 4, 2026 03:43
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: ratchet checks can read large staged and committed baselines without overflowing the Git output buffer.

steipete added a commit that referenced this pull request Oct 4, 2026
Document the existing auth quota fixture isolation, and exercise real node discovery and capability selection through the Gateway RPC fixture. Prune four obsolete mock allowances without expanding the baseline.

The exact failing mock-export guard, all 65 auth cases and 28 node cases, changed checks, deslop, and independent review passed. Auth and node test files took 37.91s and 30.43s wall. Reuse the upstream large-baseline reader fix from #164743.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
Ratchet checks can read large staged and committed baselines while preserving existing baseline enforcement.

Fixes openclaw#164741.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
Document the existing auth quota fixture isolation, and exercise real node discovery and capability selection through the Gateway RPC fixture. Prune four obsolete mock allowances without expanding the baseline.

The exact failing mock-export guard, all 65 auth cases and 28 node cases, changed checks, deslop, and independent review passed. Auth and node test files took 37.91s and 30.43s wall. Reuse the upstream large-baseline reader fix from openclaw#164743.
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Oct 16, 2026
Ratchet checks can read large staged and committed baselines while preserving existing baseline enforcement.

Fixes openclaw#164741.

(cherry picked from commit 58310ca)
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
Ratchet checks can read large staged and committed baselines while preserving existing baseline enforcement.

Fixes openclaw#164741.

(cherry picked from commit 58310ca)
(cherry picked from commit e544e57)
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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.

CI mock-export ratchet fails when its Git baseline exceeds 1 MiB

1 participant