oliver-zehentleitner / maity

runner: Claude sandbox makes the clone's .git read-only, so agents can't commit or push

Sign in to report

tsk-2zz5tjpbt28n Done An agent

A Claude Code agent on a runner, with the sandbox on, cannot write its clone's .git: git fetch fails with cannot open '.git/FETCH_HEAD': Read-only file system, so it can't commit, push or maity report code. The first two runner placements are blocked by this.

Likely cause (q445, read of main, not yet verified on a run): claude_settings in cli/src/maity/runner/adapters.py denies Edit(/{ws}/.git/**), and Claude Code's sandbox turns Edit deny rules into filesystem write denies for Bash too.

Wanted:

  • Agents can run git normally (refs, index, objects, FETCH_HEAD, logs).
  • Still nothing the agent writes can turn a git call into code execution: deny .git/config, .git/config.worktree, .git/hooks/**, .git/info/**, .git/commondir, .git/objects/info/alternates, and keep .git/maity/** unreadable and unwritable.
  • A test on the rendered settings, plus a check on a real sandboxed run (or the closest stand-in) showing that the mapping holds, with the output in the PR body.
  • The KTW entry behind the old rule (cli/context/runner.md) updated with the reason for the narrower list.

Decided (req-2adhtsb3ct75, option (c), 2026-11-10):

  • .git/commondir is not denied: denying the missing file breaks every git call in the session. The session's git and maity's own git are pinned (GIT_COMMON_DIR, GIT_CONFIG_COUNT) and ignore it.
  • The runner checks an existing clone at each start, with the same clone check as gc. A clone whose .git is not a plain clone's (a commondir, worktrees/, a config.worktree with content) does not start: failed, workspace_in_use, detail not_a_plain_clone (new row in §15.7). The runner's log names the finding; nothing in the clone is removed; no automatic retry. The sandbox's empty placeholders pass.
  • A person runs git in a runner's clone only through maity or after the runner's check.