Skip to content

fix(daemon): add safe.directory=* to gitEnv to fix CI dubious ownership errors#1980

Merged
forrestchang merged 2 commits intomainfrom
agent/lambda/f394c2ec
May 1, 2026
Merged

fix(daemon): add safe.directory=* to gitEnv to fix CI dubious ownership errors#1980
forrestchang merged 2 commits intomainfrom
agent/lambda/f394c2ec

Conversation

@forrestchang
Copy link
Copy Markdown
Collaborator

Summary

  • Adds safe.directory=* via GIT_CONFIG_* env vars to gitEnv() in repocache/cache.go
  • Fixes TestRegisterTaskReposAllowsProjectOnlyURL and TestRegisterTaskReposSurvivesWorkspaceRefresh failures on CI where git's ownership check rejects temp directories owned by a different UID
  • Updates TestGitEnv to verify the new env vars

Context

The backend CI (go test ./...) has been intermittently failing on main due to git's safe.directory ownership check (introduced in Git 2.35.2). When tests create local git repos via t.TempDir() and the daemon's repo cache clones from them, git clone --bare fails with "dubious ownership" because the CI runner UID differs from the directory owner.

The daemon manages its own bare caches and worktrees, so the ownership check provides no security value here.

Test plan

  • go test ./internal/daemon/repocache/... passes
  • go test ./internal/daemon/... passes
  • go build ./... succeeds
  • Full go test ./... passes

…ip errors

TestRegisterTaskReposAllowsProjectOnlyURL and
TestRegisterTaskReposSurvivesWorkspaceRefresh fail on GitHub Actions CI
because git clone --bare from local temp directories triggers git's
safe.directory ownership check when the runner UID differs from the
directory owner.

Set safe.directory=* via GIT_CONFIG env vars in gitEnv() so all daemon
git subprocesses trust any directory. The daemon manages its own bare
caches and worktrees, so the ownership check provides no security value.

Co-authored-by: multica-agent <github@multica.ai>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
multica-docs Ready Ready Preview, Comment May 1, 2026 2:11pm

Request Review

Instead of resetting GIT_CONFIG_COUNT to 1, read the existing count
from the environment and append safe.directory at the next available
index. This preserves any env-scoped git config (auth, URL rewrites,
extra headers) injected into the daemon process.

Adds TestGitEnvPreservesExistingConfig to verify the append behavior.

Co-authored-by: multica-agent <github@multica.ai>
@forrestchang forrestchang merged commit 3df95c8 into main May 1, 2026
3 checks passed
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.

1 participant