Skip to content

Agent git guard: stop git writes in the shared checkout #1205

Closed

Description

@mforce

The agent git guard (#1158, #1172, #1175) blocks merges, pushes to main, force-pushes, src:dst refspec pushes and commits on main. It does not stop an agent working in the wrong directory.

On 2026-10-10 a worker ran a command without cd into its worktree. The command ran in the shared checkout /home/mforce/dev/cluckwork, which other agents also use. It edited 2 files there and created .git/shallow, which made the whole shared repository shallow. The worker repaired it, and nothing was lost.

Worker briefs already say "start every Bash call with cd <worktree> &&", and that prose rule failed. Options:

  • the guard refuses writing git commands (commit, checkout, switch, stash, fetch --depth, reset) whose working directory is the shared checkout when the agent was given a worktree (for example via an env var set at launch);
  • refuse git fetch --depth/--shallow-* and git stash outright for agents, since every worktree shares one .git.

Done when: the chosen check turns the 2026-10-10 command red, and normal worktree commands still pass.

Activity

  1. added this to the Platform hardening milestone on Oct 10, 2026
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

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions