Skip to content

fix(review): support Git null device on Windows - #1303

Merged
brokemac79 merged 1 commit into
mainfrom
codex/csw-146-windows-git-null
Aug 30, 2026
Merged

brokemac79 merged 1 commit into
mainfrom
codex/csw-146-windows-git-null

Conversation

@brokemac79

Copy link
Copy Markdown
Contributor

Summary

Fixes native Windows local committed-range review after hardened Git reads were introduced. The hardened reader now uses Git-for-Windows' NUL device spelling on Windows and retains Node's os.devNull value on POSIX.

Problem

Node 24 reports os.devNull as \\\\.\\nul on Windows. Git for Windows 2.52 rejects that spelling when it is supplied through GIT_CONFIG_GLOBAL, so readReviewGit failed before the trusted-input scanner could infer the local range.

Implementation

  • Add one platform-aware gitNullDevice value in src/pr-review-evidence.ts.
  • Use it for the hardened reader's existing core.hooksPath, GIT_CONFIG_GLOBAL, and GIT_GRAFT_FILE null-device targets.
  • Preserve every existing isolation flag, scanner path, hosted workflow, and platform policy.
  • Add a focused regression test that supplies a malformed inherited global config, verifies the child raw Git read still succeeds, and confirms the parent environment is unchanged.

Platform classification

This is a category-1 product/runtime defect in native Windows local review only. It is not a hosted-workflow or repository-wide cross-platform CI change. POSIX keeps its previous /dev/null behavior.

Validation

  • Native Windows (Node v24.13.0, Git for Windows 2.52.0): pnpm run build, node --test test/pr-review-evidence.test.ts, and an independent raw readReviewGit invocation passed. Direct Git reproduction showed GIT_CONFIG_GLOBAL=NUL succeeds while GIT_CONFIG_GLOBAL=\\\\.\\nul fails with fatal: unable to access '\\\\.\\nul': Invalid argument.
  • pnpm run build:all passed.
  • pnpm exec oxlint src/pr-review-evidence.ts --tsconfig tsconfig.json --type-aware --deny-warnings --report-unused-disable-directives -D correctness -D preserve-caught-error passed.
  • pnpm exec oxlint test/pr-review-evidence.test.ts --deny-warnings --report-unused-disable-directives -D correctness -D preserve-caught-error passed.
  • pnpm exec oxfmt --check src/pr-review-evidence.ts test/pr-review-evidence.test.ts and git diff --check origin/main...HEAD passed.
  • pnpm run review -- --local-range --target-repo openclaw/clawsweeper --base origin/main completed locally for the one committed range: decision=keep_open, confidence=high.
  • Codex dirty-patch review and committed-range review against origin/main found no actionable issues.

Real Behavior Proof

Claim: hardened raw Git reads work on native Windows without weakening isolation, and POSIX retains its null-device behavior.

Surface/scenario: a malformed inherited GIT_CONFIG_GLOBAL would normally make Git fail; the reader must provide its own compatible null device for raw reads. The focused test creates a temporary Git repository, sets a malformed parent global config, calls readReviewGit(..., ["rev-parse", "--is-inside-work-tree"]), and checks both successful output and parent-env preservation.

Native trace: Windows Node v24.13.0 / Git for Windows 2.52.0 ran the focused test successfully. Independent device experiment: GIT_CONFIG_GLOBAL=NUL returned true with exit 0; GIT_CONFIG_GLOBAL=\\\\.\\nul exited 128 with Git's invalid-argument error.

Hosted POSIX trace: Crabbox AWS/Linux run run_1a8c9178a38a, lease cbx_8b6e29cb4336 (crimson-shrimp), c7a.8xlarge, promoted AMI ami-0461d919be7deb53c in eu-west-1. The exact two-file dirty worktree was synced (dirty_delta=2) with --no-hydrate; remote command was corepack enable && pnpm install --frozen-lockfile, pnpm run build, then node --test test/pr-review-evidence.test.ts. Exit 0; frozen install, build, and the one POSIX test passed. Timing JSON: lease 58.289s, sync 18.281s, command 11.278s, total 31.590s, end-to-end 90.854s. Crabbox reported leaseStopped=true; a subsequent lease listing did not contain cbx_8b6e29cb4336.

Limits: the hosted run proves retained POSIX behavior, while the focused native test and direct Git experiment prove the Windows device contract. The broader native unit fixtures still contain unrelated direct uses of Node's Windows null-device spelling; this change intentionally does not expand into those separate surfaces.

Risk and rollout

Low risk: the patch changes only the spelling passed to the already-hardened reader on Windows. It does not alter source validation, network isolation, scanner behavior, hosted workflows, or platform policy. User-visible outcome is that local committed-range review can progress to the scanner/model phases on native Windows.

Related: CSW-143 and CSW-145 were blocked by this independent local-review regression.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 8:27 PM ET / August 30, 2026, 00:27 UTC.

ClawSweeper review

What this changes

The PR uses Git for Windows’ NUL device spelling for isolated raw Git reads on Windows and adds a focused regression test.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This is a narrow, correct Windows compatibility repair with sufficient native and POSIX behavior evidence; it remains open for normal maintainer landing.

Priority: P2
Reviewed head: a26b0b6cdf32da3ccba6400324c0845a121e8a72

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong platform-specific runtime evidence supports a small, well-contained compatibility patch.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed production owner is the hardened raw Git reader; the captured native Windows terminal trace exercised that owner with a malformed inherited Git configuration and observed NUL recover the real Git call, while a Crabbox Linux trace covered retained POSIX behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed production owner is the hardened raw Git reader; the captured native Windows terminal trace exercised that owner with a malformed inherited Git configuration and observed NUL recover the real Git call, while a Crabbox Linux trace covered retained POSIX behavior.
Evidence reviewed 6 items Introduced implementation: The exact PR delta selects NUL on Windows and applies that value to the existing hooks-path, global-config, and graft-file isolation settings.
Focused regression coverage: The added test runs the production reader against a real temporary Git repository with a malformed inherited global configuration and verifies both successful output and parent-environment preservation.
Production call path: The trusted-input scanner calls this reader for raw Git object access, so correcting its Windows device spelling restores local committed-range review before scanning and model evaluation.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s review reader invokes Git to collect repository evidence before a model review. Its environment and command-line settings isolate those reads from inherited Git configuration, hooks, and ancestry overrides.

flowchart LR
  A[Local review request] --> B[Hardened Git reader]
  B --> C[Platform device selection]
  C --> D[Isolated Git command]
  D --> E[Repository evidence]
  E --> F[Review decision]
Loading

Before merge

  • Complete next step (P2) - No concrete defect remains for an automated repair; normal current-head maintainer review is the appropriate next action.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope production +6/-3; tests +29; 2 files affected The fix stays confined to the raw Git reader and one regression test.

Technical review

Best possible solution:

Keep the platform-specific isolation boundary and land the focused repair once the draft is ready for maintainer approval.

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

Yes — the captured native Windows trace reproduces the incompatible device spelling on the fetched main behavior and shows the NUL replacement succeeding with Git for Windows.

Is this the best way to solve the issue?

Yes — choosing the device spelling at the existing reader boundary preserves all isolation controls and leaves POSIX on its prior os.devNull behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded native-Windows local-review failure without affecting hosted review workflows.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 changed production owner is the hardened raw Git reader; the captured native Windows terminal trace exercised that owner with a malformed inherited Git configuration and observed NUL recover the real Git call, while a Crabbox Linux trace covered retained POSIX behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the hardened raw Git reader; the captured native Windows terminal trace exercised that owner with a malformed inherited Git configuration and observed NUL recover the real Git call, while a Crabbox Linux trace covered retained POSIX behavior.

Evidence

What I checked:

  • Introduced implementation: The exact PR delta selects NUL on Windows and applies that value to the existing hooks-path, global-config, and graft-file isolation settings. (src/pr-review-evidence.ts:94, a26b0b6cdf32)
  • Focused regression coverage: The added test runs the production reader against a real temporary Git repository with a malformed inherited global configuration and verifies both successful output and parent-environment preservation. (test/pr-review-evidence.test.ts:10, a26b0b6cdf32)
  • Production call path: The trusted-input scanner calls this reader for raw Git object access, so correcting its Windows device spelling restores local committed-range review before scanning and model evaluation. (src/agent-input-scan.ts:158, a26b0b6cdf32)
  • Feature-history routing: The current main ancestor includes prior merged review-runtime work on this file, including the provenance-hardening commit; history identifies Peter Steinberger as the strongest routing candidate for this code path. (src/pr-review-evidence.ts:71, 8d11c21558ba)
  • Real behavior proof: The captured PR-body trace reports native Windows Node 24.13.0 and Git for Windows 2.52.0: GIT_CONFIG_GLOBAL=NUL succeeded while Node’s Windows null-device spelling failed with Git’s invalid-argument error; a Crabbox Linux run separately retained POSIX behavior. (a26b0b6cdf32)
  • Pinned merge identity: The verified test merge has the fetched main SHA as first parent and this exact head as second parent, with only the two introduced files changed relative to main. (9e8e786ab9e9)

Likely related people:

  • Peter Steinberger: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-30T00:22:21.890Z sha a26b0b6 :: needs maintainer review before merge. :: none

@brokemac79
brokemac79 marked this pull request as ready for review August 30, 2026 00:31
@brokemac79
brokemac79 merged commit fa535d5 into main Aug 30, 2026
20 checks passed
@brokemac79
brokemac79 deleted the codex/csw-146-windows-git-null branch August 30, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant