Skip to content

[Bug]: Checkpoint capture fails on every turn when the workspace has a file the server cannot read #38826

Closed

Description

@nickypro

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. In a Git repo used as a T3 Code workspace, commit a file, then make it unreadable by the user the server runs as. For example, chmod 000 locked.txt, or a file owned by another user with mode 0600.
  2. Start a turn in a thread on that workspace.

Shell repro of the same staging step:

git init repo && cd repo && echo committed > locked.txt && git add . && git commit -qm init
echo changed > locked.txt && chmod 000 locked.txt
GIT_INDEX_FILE=/tmp/t3-idx git read-tree HEAD
GIT_INDEX_FILE=/tmp/t3-idx git add -A -- .                  # exit 128: "fatal: updating files failed"
GIT_INDEX_FILE=/tmp/t3-idx git add -A --ignore-errors -- .  # exit 1, the rest is staged

Expected behavior

The checkpoint is captured. Files the server can't read keep their indexed (HEAD) version, the same way an untracked file it can't read is simply left out.

Actual behavior

captureCheckpoint fails on every turn in that workspace. The temporary-index git add -A exits 128 with error: open("…"): Permission denied / fatal: updating files failed (adding files failed for untracked ones). The nested-repo recovery then runs its ls-files --others scan and fails the same way. So no checkpoints are created, and each turn still pays for the failed staging (several seconds in a large repo).

This shows up on shared machines where an agent or another account writes 0600 files or 2770 directories into the repo.

Impact

Major degradation or frequent failure

Version or commit

v0.1.10. On main at 00c6adb, capture still stages with a plain git add -A and has no handling for unreadable files.

Environment

Headless Linux server (Debian 12, Git 2.39.5), t3 serve --mode web, about 30 Claude sessions, one large repo shared by many threads.

Logs or stack traces

VcsProcessExitError: VCS process failed in GitVcsDriver.checkpoints.captureCheckpoint: git (<workspace>) exited with 128 - Process exited with a non-zero status.
    at GitVcsDriver.gitCommand
    at GitVcsDriver.checkpoints.captureCheckpoint
    at captureCheckpoint
    at orchestrationV2.checkpointCapture.execute

Workaround

Make every file in the workspace readable by the server's user, for example with an ACL u:<server user>:rX.

A fix that works for us: when the strict git add fails, retry once with git add --ignore-errors (run with LC_ALL=C, nonzero exit allowed). Accept that result only if it exits 1 and every stderr line is a warning:, an error: unable to index file …, or a line ending in : Permission denied. Otherwise raise the original error. The retry runs before the nested-repo recovery and outside its 5 s timeout. The strict first pass keeps VcsProcess's index-lock retry. Happy to open a PR with that fix and a test (chmod 000 on a tracked file and an untracked file) if it's wanted.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions