Skip to content

Fail Closed When the Write Guard's @{push} Read Times Out or Cannot Run #3036

Closed

Description

@ptr727

Context

Found by the local review of the change that answers a Copilot finding on #3030. That change makes a failed git remote read in _read_branch answer unresolved, so a bare push fails closed when the guard cannot read the remote names. The @{push} read just before it still treats its own failure as "no push target", and develop's guard shares this shape.

A Failed @{push} Read Falls Back to the Local Branch Name

_current_push_branch reads rev-parse --symbolic-full-name @{push} first and rev-parse --abbrev-ref HEAD second. _git_stdout answers None alike for a non-zero exit, a timeout, and a command that could not run, so _read_branch cannot tell "this branch has no push target" from "the read failed". In each case it moves on to the HEAD read.

A constructed case: push.default=upstream, with feature/two tracking refs/remotes/up/stream/develop. Where the @{push} read times out or raises and the HEAD read then succeeds, the guard reads the targets as feature/two and two and allows the push, while git writes develop.

#3019 covers the same fallback when @{push} exits non-zero because the destination is not stored as a remote-tracking branch. This issue covers the read failing for any other reason.

Possible Direction

Have _git_stdout, or a variant of it, tell a non-zero exit apart from a timeout or a failure to run, and make the second answer unresolved in _read_branch. Where #3019 moves the read onto branch configuration, the same distinction applies to those reads.

Activity

  1. added
    bug
    pre-existing
    on Oct 15, 2026
  2. ptr727 commented on Oct 15, 2026

    @ptr727
    OwnerAuthor

    Claimed for an engineering-track lane (handoff #3040 resume). Branch: feature/guard-bare-push-target-3019. Predicted file set: host-setup/agent-safety/claude/gh-write-guard.py, host-setup/agent-safety/claude/test_install.py, host-setup/agent-safety/README.md, host-setup/agent-safety/claude/README.md.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions