Skip to content

Fail Closed on a Rooted Driveless Directory in the Guard and Fix the Wait Usage Text - #2939

Merged
ptr727 merged 3 commits into
developfrom
feature/guard-rooted-cd-and-wait-usage
Oct 13, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/guard-rooted-cd-and-wait-usage

Conversation

@ptr727

@ptr727 ptr727 commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Part of #2821 and #2897.

Why

The develop -> main promotion PR introduced two defects.

  1. On Windows (Git Bash), a rooted leading cd or -C value with no drive segment, such as /repos/wt-example, resolved with Windows Python semantics onto the session drive. Git Bash resolves it under the Git install root, so the cd fails there, ; runs the push in the session branch, and the guard read another branch and allowed. _bare_push_branch now returns unresolved for that value when the MSYS drive regime is on. POSIX behavior is unchanged.
  2. The wait usage text and the exit 49 text said "once Copilot has reviewed it at all" and "after Copilot's first round". Since the attest change, holds() needs a Copilot round on an earlier head. Both now say so, matching the status text. scripts/README.md and the pr-review-conduct skill state it without the stale claim, so they are unchanged.

Verification

  • New unit tests drive _bare_push_branch on POSIX with the Windows regime patched on. Reverting the two-line fix fails the leading-cd and -C tests, restoring it passes.
  • Guard selftest, test_install.py, test_pr_review.py, test_cli_usage.py and the whole suite pass. The only failure seen is the known TestAttest timing flake (Stop the Attest Timing Tests Recording Subprocess Polling Sleeps #2934), which passes alone.
  • Not run on Windows natively: no Windows host is available to this session, so the Git Bash behavior is taken from the existing _msys_drive_path contract.

Review

Local strict review declined two guard observations as extra denials only (UNC paths denied, and a deny message that does not name the drive spelling), since neither allows a push that origin/main's guard denied. Four sentence-length findings were fixed.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 13, 2026 06:48
… Windows

Git Bash resolves a rooted path with no drive segment under the Git install root, while Windows Python joins it onto the session drive. A failed leading cd then ran the push in the session branch while the guard read another branch and allowed. The decision is now unresolved there, and POSIX is unchanged.

The pr_review.py wait and exit 49 usage text now matches holds(), which needs a Copilot round on an earlier head.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ptr727

ptr727 commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 4b03636534fc6867f1191b6de0028919e948b600, the content this pull request carries at that commit against develop, and it recorded 6 findings.

Copilot AI lite review requested due to automatic review settings October 13, 2026 14:00
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d76e0a0-0feb-4163-bd92-c2f7d2d08c5f
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Update the held-branch message to mention review of an earlier head.

0 open findings

What changed in this PR

This PR hardens Windows/MSYS path handling and clarifies wait review-state messaging.

Changes:

  • Rejects ambiguous rooted paths without drive segments.
  • Adds path-resolution regression tests.
  • Updates wait and exit-code wording.
File Summary
scripts/​pr_review.py Updates review timing and exit-code text.
host-setup/​agent-safety/​claude/​test_install.py Adds rooted-path regression tests.
host-setup/​agent-safety/​claude/​gh-write-guard.py Fails closed for ambiguous MSYS rooted paths.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.96%. Comparing base (9ef1357) to head (56a39f7).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2939   +/-   ##
========================================
  Coverage    59.96%   59.96%           
========================================
  Files           17       17           
  Lines         8777     8777           
========================================
  Hits          5263     5263           
  Misses        3514     3514           
Flag Coverage Δ
python-3.13 59.96% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 56a39f7b3134dcb93f19583a92c50f8cc1e23dac, the content this pull request carries at that commit against develop, and it recorded 1 finding.

@ptr727

ptr727 commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

Fixed in 56a39f7: the held-branch note and the exit 49 status message now say Copilot has reviewed an earlier head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants