Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-5774 fix(daemon): isolate Git metadata for Windows Codex checkouts (#6565)

Bohan Jiang734ad51c9344
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ca1e7258ee..6185115bee 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -387,6 +387,27 @@ jobs:
# silently as "ok".
run: go test ./internal/daemon/execenv -v -run '^TestWindowsOpenclawShim' -count=1 -timeout=5m
+ - name: Test Windows isolated repo checkout is committable
+ working-directory: server
+ # #6449: on Windows the daemon now hands Codex tasks a checkout whose
+ # .git lives inside the task workdir, because a linked worktree's
+ # external gitdir stays read-only under the native sandbox and breaks
+ # `git add` / `git commit` at the end of a task. Two of the guarantees
+ # are claims about Windows itself and cannot be made on ubuntu: that
+ # Git puts the gitdir inside the task directory, and that the clone's
+ # objects are private copies rather than NTFS hard links sharing one
+ # file and one security descriptor with the daemon-owned cache. The
+ # cross-volume test covers what a hard link cannot express at all.
+ # Scoped to the two windows-tagged tests by exact name. A prefix match
+ # also caught the package's cross-platform isolated-checkout test,
+ # which cannot run here: repocache derives a cache directory name from
+ # the full source repo path, so a t.TempDir() path that already embeds
+ # a long test name doubles and blows past MAX_PATH. That test belongs
+ # to the ubuntu backend job, which runs the whole package.
+ # -v so a skip (single-volume runner) is visible instead of passing
+ # silently as "ok".
+ run: go test ./internal/daemon/repocache -v -run '^(TestIsolatedCheckoutIsCommittableOnWindows|TestIsolatedCheckoutAcrossVolumesOnWindows)$' -count=1 -timeout=5m
+
- name: Build Windows CLI helper entrypoint
working-directory: server
run: go build ./cmd/multica
diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.go
index c42df8bfbd..104b46a75e 100644
--- a/server/internal/daemon/daemon.go
+++ b/server/internal/daemon/daemon.go
@@ -91,11 +91,30 @@ const (
// shrink it, same as the other timing knobs in this package.
var pendingWorkHintMinInterval = time.Second
+// repoCheckoutModeFor picks the Git metadata layout for a task's
+// `multica repo checkout`. Under Codex's workspace-write sandbox a linked
+// worktree's gitdir resolves into the shared cache and stays read-only even
+// when the task workdir is an explicit writable root, so `git add` /
+// `git commit` fail from inside the checkout — Linux hit this in
+// multica-ai/multica#2925, Codex's native Windows sandbox in
+// multica-ai/multica#6449.
+//
+// Both platforms now default to danger-full-access (execenv's
+// codexSandboxPolicyFor), so in practice only a user who opted into
+// windows.sandbox still trips the Windows case. The layout stays a per-platform
+// choice rather than a per-policy one: it is decided before a task's resolved
+// sandbox config is known, one workdir is reused across tasks whose policies
+// can differ, and task-local metadata is correct under either policy.
func repoCheckoutModeFor(provider, goos string) string {
- if provider == "codex" && goos == "linux" {
+ if provider != "codex" {
+ return ""
+ }
+ switch goos {
+ case "linux", "windows":
return repoCheckoutModeIsolated
+ default:
+ return ""
}
- return ""
}
var (
diff --git a/server/internal/daemon/daemon_test.go b/server/internal/daemon/daemon_test.go
index b564c11a76..bf5de16c3e 100644
--- a/server/internal/daemon/daemon_test.go
+++ b/server/internal/daemon/daemon_test.go
@@ -300,9 +300,10 @@ func TestRepoCheckoutModeFor(t *testing.T) {
name, provider, goos, want string
}{
{name: "Linux Codex isolates Git metadata", provider: "codex", goos: "linux", want: repoCheckoutModeIsolated},
+ {name: "Windows Codex isolates Git metadata", provider: "codex", goos: "windows", want: repoCheckoutModeIsolated},
{name: "macOS Codex keeps worktree", provider: "codex", goos: "darwin"},
- {name: "Windows Codex keeps worktree", provider: "codex", goos: "windows"},
{name: "Linux Claude keeps worktree", provider: "claude", goos: "linux"},
+ {name: "Windows Claude keeps worktree", provider: "claude", goos: "windows"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
diff --git a/server/internal/daemon/repocache/cache.go b/server/internal/daemon/repocache/cache.go
index bf74cf5c26..a8bea6d4d8 100644
--- a/server/internal/daemon/repocache/cache.go
+++ b/server/internal/daemon/repocache/cache.go
@@ -11,6 +11,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
+ "runtime"
"strconv"
"strings"
"sync"
@@ -487,9 +488,10 @@ type WorktreeParams struct {
CoAuthoredByEnabled bool // install prepare-commit-msg hook for Co-authored-by trailer
// IsolatedGitMetadata creates a local clone whose .git directory lives
// inside WorkDir instead of a linked worktree whose gitdir lives under the
- // shared cache. Linux Codex tasks need this because workspace-write keeps a
+ // shared cache. Codex tasks need this because workspace-write keeps a
// resolved external worktree gitdir read-only even when it is explicitly
- // listed as a writable root (multica-ai/multica#2925).
+ // listed as a writable root — on Linux (multica-ai/multica#2925) and on the
+ // Windows native sandbox (multica-ai/multica#6449).
IsolatedGitMetadata bool
}
@@ -688,11 +690,12 @@ const (
)
// createOrUpdateIsolatedCheckout keeps Git metadata inside the task workdir.
-// The fresh path uses a same-filesystem local clone, so immutable Git objects
-// are hard-linked from the daemon's cache while refs, index, logs, config, and
-// new objects remain private to the task checkout. The temporary cache remote
-// is then replaced with the real repository URL so an agent's normal fetch /
-// push commands still target GitHub rather than the daemon-owned bare cache.
+// The fresh path uses a local clone, so immutable Git objects are hard-linked
+// (copied on Windows, see localCloneArgs) from the daemon's cache while refs,
+// index, logs, config, and new objects remain private to the task checkout.
+// The temporary cache remote is then replaced with the real repository URL so
+// an agent's normal fetch / push commands still target GitHub rather than the
+// daemon-owned bare cache.
func (c *Cache) createOrUpdateIsolatedCheckout(barePath, repoURL, checkoutPath, branchName, baseRef string) (string, error) {
baseCommit, err := resolveCommit(barePath, baseRef)
if err != nil {
@@ -726,8 +729,8 @@ func (c *Cache) createOrUpdateIsolatedCheckout(barePath, repoURL, checkoutPath,
}
return actualBranch, nil
}
- // A daemon upgrade can resume a pre-fix Linux Codex workdir that still has
- // a linked worktree. Remove it through Git (so the shared admin record is
+ // A daemon upgrade can resume a pre-fix Codex workdir that still has a
+ // linked worktree. Remove it through Git (so the shared admin record is
// cleaned too), then recreate the same checkout path with local metadata.
if isGitWorktree(checkoutPath) {
if err := removeLinkedWorktree(barePath, checkoutPath); err != nil {
@@ -780,11 +783,27 @@ func sameResolvedPath(a, b string) bool {
return clean(a) == clean(b)
}
+// localCloneArgs builds the `git clone --local` invocation that seeds a fresh
+// isolated checkout from the shared bare cache.
+//
+// On Windows the clone also passes --no-hardlinks. A local clone hardlinks
+// .git/objects whenever it can, but an NTFS hard link only exists within a
+// single volume and every link shares one underlying file *and* one security
+// descriptor. Copying the objects instead keeps a cache and workdir that live
+// on different drives working, and stops a task checkout — whose tree the
+// sandbox makes writable — from re-permissioning the daemon-owned cache's
+// object files. The cost is extra disk and a slower first checkout on Windows.
+func localCloneArgs(goos, barePath, checkoutPath string) []string {
+ args := []string{"clone", "--local", "--no-checkout", "--no-tags"}
+ if goos == "windows" {
+ args = append(args, "--no-hardlinks")
+ }
+ return append(args, "--origin", isolatedCacheRemoteName, barePath, checkoutPath)
+}
+
func createIsolatedCheckout(barePath, repoURL, checkoutPath, branchName, baseRef, baseCommit string) (_ string, retErr error) {
if out, err := runGitCombinedOutput(
- "clone", "--local", "--no-checkout", "--no-tags",
- "--origin", isolatedCacheRemoteName,
- barePath, checkoutPath,
+ localCloneArgs(runtime.GOOS, barePath, checkoutPath)...,
); err != nil {
// Do not remove checkoutPath here. A different repository with the
// same basename could have won the path race after our pre-check; Git
diff --git a/server/internal/daemon/repocache/cache_test.go b/server/internal/daemon/repocache/cache_test.go
index cb4515c9fa..0bb57a1077 100644
--- a/server/internal/daemon/repocache/cache_test.go
+++ b/server/internal/daemon/repocache/cache_test.go
@@ -3,6 +3,7 @@ package repocache
import (
"context"
"errors"
+ "io/fs"
"log/slog"
"os"
"os/exec"
@@ -701,6 +702,132 @@ func TestCreateWorktreeMigratesLinkedWorktreeToIsolatedMetadata(t *testing.T) {
}
}
+func TestLocalCloneArgsOnlyDisablesHardlinksOnWindows(t *testing.T) {
+ t.Parallel()
+ const barePath, checkoutPath = "/cache/repo.git", "/task/repo"
+
+ for _, tt := range []struct {
+ goos string
+ wantNoHardlnk bool
+ }{
+ {goos: "windows", wantNoHardlnk: true},
+ {goos: "linux"},
+ {goos: "darwin"},
+ } {
+ t.Run(tt.goos, func(t *testing.T) {
+ t.Parallel()
+ args := localCloneArgs(tt.goos, barePath, checkoutPath)
+ got := false
+ for _, arg := range args {
+ if arg == "--no-hardlinks" {
+ got = true
+ }
+ }
+ if got != tt.wantNoHardlnk {
+ t.Fatalf("localCloneArgs(%q) --no-hardlinks = %v, want %v (args: %v)", tt.goos, got, tt.wantNoHardlnk, args)
+ }
+ // Inserting a flag must never displace the trailing operands.
+ if src, dst := args[len(args)-2], args[len(args)-1]; src != barePath || dst != checkoutPath {
+ t.Fatalf("localCloneArgs(%q) operands = %q %q, want %q %q", tt.goos, src, dst, barePath, checkoutPath)
+ }
+ })
+ }
+}
+
+// TestIsolatedCheckoutCloneWithoutHardlinksIsIndependent runs the exact clone
+// invocation Windows Codex tasks now use (multica-ai/multica#6449) and proves
+// it still yields a usable checkout whose object files are private copies
+// rather than links back into the daemon-owned cache. Kept platform-agnostic
+// so Linux/macOS CI guards the Windows-only flag.
+func TestIsolatedCheckoutCloneWithoutHardlinksIsIndependent(t *testing.T) {
+ t.Parallel()
+ sourceRepo := createTestRepo(t)
+ cache := New(t.TempDir(), testLogger())
+ if err := cache.Sync("ws-1", []RepoInfo{{URL: sourceRepo}}); err != nil {
+ t.Fatalf("sync failed: %v", err)
+ }
+ barePath := cache.Lookup("ws-1", sourceRepo)
+ baseCommit := gitRefCommit(t, barePath, getRemoteDefaultBranch(barePath))
+ checkoutPath := filepath.Join(t.TempDir(), "repo")
+
+ if out, err := runGitCombinedOutput(localCloneArgs("windows", barePath, checkoutPath)...); err != nil {
+ t.Fatalf("windows-shaped local clone failed: %s: %v", strings.TrimSpace(string(out)), err)
+ }
+ if out, err := runGitCombinedOutput("-C", checkoutPath, "checkout", "--detach", baseCommit); err != nil {
+ t.Fatalf("checkout base commit: %s: %v", strings.TrimSpace(string(out)), err)
+ }
+ if got := gitHead(t, checkoutPath); got != baseCommit {
+ t.Fatalf("checkout HEAD = %s, want %s", got, baseCommit)
+ }
+ if _, err := os.Stat(filepath.Join(checkoutPath, ".git", "objects", "info", "alternates")); !os.IsNotExist(err) {
+ t.Fatalf("clone must not borrow cache objects via alternates, err=%v", err)
+ }
+
+ assertObjectsAreNotHardLinked(t, barePath, checkoutPath)
+}
+
+// assertObjectsAreNotHardLinked fails if an object file present in both the
+// cache and the checkout is the same underlying file. os.SameFile compares
+// dev+inode on Unix and the volume serial + file index on Windows, either of
+// which identifies a hard link. Both "nothing in the cache" and "nothing in
+// common" are failures, so the assertion cannot pass vacuously.
+func assertObjectsAreNotHardLinked(t *testing.T, barePath, checkoutPath string) {
+ t.Helper()
+ cacheObjects := filepath.Join(barePath, "objects")
+ checkoutObjects := filepath.Join(checkoutPath, ".git", "objects")
+
+ names := objectFiles(t, cacheObjects)
+ if len(names) == 0 {
+ t.Fatal("cache has no object files; assertion would pass vacuously")
+ }
+ compared := 0
+ for _, rel := range names {
+ cloned, err := os.Stat(filepath.Join(checkoutObjects, rel))
+ if err != nil {
+ continue // repacked differently in the checkout; nothing to compare
+ }
+ cached, err := os.Stat(filepath.Join(cacheObjects, rel))
+ if err != nil {
+ t.Fatalf("stat cache object %s: %v", rel, err)
+ }
+ if os.SameFile(cached, cloned) {
+ t.Errorf("object %s is hard-linked to the shared cache", rel)
+ }
+ compared++
+ }
+ if compared == 0 {
+ t.Fatal("no cache object was found in the checkout; assertion would pass vacuously")
+ }
+}
+
+// objectFiles lists regular files under a Git objects directory, relative to
+// it, skipping the bookkeeping subdirectory that never holds object data.
+func objectFiles(t *testing.T, objectsDir string) []string {
+ t.Helper()
+ var found []string
+ err := filepath.WalkDir(objectsDir, func(path string, entry fs.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
+ if entry.IsDir() {
+ if entry.Name() == "info" {
+ return filepath.SkipDir
+ }
+ return nil
+ }
+ rel, err := filepath.Rel(objectsDir, path)
+ if err != nil {
+ return err
+ }
+ found = append(found, rel)
+ return nil
+ })
+ if err != nil {
+ t.Fatalf("walk %s: %v", objectsDir, err)
+ }
+ return found
+}
+
func TestCreateWorktreeExcludesOpenCodeSkills(t *testing.T) {
t.Parallel()
sourceRepo := createTestRepo(t)
diff --git a/server/internal/daemon/repocache/cache_windows_test.go b/server/internal/daemon/repocache/cache_windows_test.go
new file mode 100644
index 0000000000..c9b2023ef7
--- /dev/null
+++ b/server/internal/daemon/repocache/cache_windows_test.go
@@ -0,0 +1,158 @@
+//go:build windows
+
+package repocache
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+// The isolated checkout exists so a Codex task can commit inside its own
+// workdir (multica-ai/multica#2925 on Linux, #6449 on Windows). The rest of
+// the suite proves the shape of that checkout on whatever platform CI runs,
+// but two of its guarantees are claims about Windows itself: that Git really
+// puts the gitdir inside the task directory there, and that --no-hardlinks
+// really yields private object files on NTFS — where a hard link would
+// otherwise share one file and one security descriptor with the daemon-owned
+// cache. Neither can be proven on the ubuntu backend job, so they live here
+// and run in the windows-execenv CI job.
+
+// TestIsolatedCheckoutIsCommittableOnWindows walks the exact sequence a task
+// performs: check out, branch, stage, commit — then verifies the shared cache
+// was neither moved nor linked into.
+func TestIsolatedCheckoutIsCommittableOnWindows(t *testing.T) {
+ t.Parallel()
+ sourceRepo := createTestRepo(t)
+ cache := New(t.TempDir(), testLogger())
+ if err := cache.Sync("ws-1", []RepoInfo{{URL: sourceRepo}}); err != nil {
+ t.Fatalf("sync failed: %v", err)
+ }
+ barePath := cache.Lookup("ws-1", sourceRepo)
+ baseRef := getRemoteDefaultBranch(barePath)
+ baseCommit := gitRefCommit(t, barePath, baseRef)
+
+ result, err := cache.CreateWorktree(WorktreeParams{
+ WorkspaceID: "ws-1",
+ RepoURL: sourceRepo,
+ WorkDir: t.TempDir(),
+ AgentName: "Windows Codex",
+ TaskID: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
+ IsolatedGitMetadata: true,
+ })
+ if err != nil {
+ t.Fatalf("CreateWorktree failed: %v", err)
+ }
+
+ // 1. The gitdir a sandbox would have to make writable must be the one
+ // inside the task workdir, not the shared cache outside it.
+ gitDir := absoluteGitDir(t, result.Path)
+ if !isUnder(gitDir, result.Path) {
+ t.Fatalf("git dir %s is outside the task checkout %s", gitDir, result.Path)
+ }
+
+ // 2. Branch, stage, commit — the sequence that fails on a linked worktree.
+ runGitAuthored(t, result.Path, "checkout", "-b", "feature/windows-commit")
+ if err := os.WriteFile(filepath.Join(result.Path, "windows.txt"), []byte("committable\n"), 0o644); err != nil {
+ t.Fatalf("write file: %v", err)
+ }
+ runGitAuthored(t, result.Path, "add", "windows.txt")
+ runGitAuthored(t, result.Path, "commit", "-m", "windows isolated commit")
+ if got := gitHead(t, result.Path); got == baseCommit {
+ t.Fatal("commit did not advance the checkout")
+ }
+
+ // 3. The shared cache must be untouched by all of the above.
+ if got := gitRefCommit(t, barePath, baseRef); got != baseCommit {
+ t.Fatalf("commit mutated shared cache base: got %s, want %s", got, baseCommit)
+ }
+ assertObjectsAreNotHardLinked(t, barePath, result.Path)
+}
+
+// TestIsolatedCheckoutAcrossVolumesOnWindows covers the cross-drive case an
+// NTFS hard link cannot express at all: hard links are confined to a single
+// volume, so a cache on C: and a workdir on D: is precisely where linking
+// would fail. Skips visibly when the runner has only one writable volume.
+func TestIsolatedCheckoutAcrossVolumesOnWindows(t *testing.T) {
+ t.Parallel()
+ cacheRoot := t.TempDir()
+ workDir := tempDirOnOtherVolume(t, cacheRoot)
+
+ sourceRepo := createTestRepo(t)
+ cache := New(cacheRoot, testLogger())
+ if err := cache.Sync("ws-1", []RepoInfo{{URL: sourceRepo}}); err != nil {
+ t.Fatalf("sync failed: %v", err)
+ }
+ barePath := cache.Lookup("ws-1", sourceRepo)
+ baseCommit := gitRefCommit(t, barePath, getRemoteDefaultBranch(barePath))
+
+ result, err := cache.CreateWorktree(WorktreeParams{
+ WorkspaceID: "ws-1",
+ RepoURL: sourceRepo,
+ WorkDir: workDir,
+ AgentName: "Windows Codex",
+ TaskID: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
+ IsolatedGitMetadata: true,
+ })
+ if err != nil {
+ t.Fatalf("cross-volume CreateWorktree failed: %v", err)
+ }
+ if gitDir := absoluteGitDir(t, result.Path); !isUnder(gitDir, result.Path) {
+ t.Fatalf("git dir %s is outside the task checkout %s", gitDir, result.Path)
+ }
+ runGitAuthored(t, result.Path, "commit", "--allow-empty", "-m", "cross-volume commit")
+ if got := gitHead(t, result.Path); got == baseCommit {
+ t.Fatal("commit did not advance the cross-volume checkout")
+ }
+}
+
+func absoluteGitDir(t *testing.T, repoPath string) string {
+ t.Helper()
+ out, err := runGitOutput("-C", repoPath, "rev-parse", "--absolute-git-dir")
+ if err != nil {
+ t.Fatalf("rev-parse --absolute-git-dir in %s: %v", repoPath, err)
+ }
+ return strings.TrimSpace(string(out))
+}
+
+// isUnder reports whether path lies inside dir, comparing the same
+// absolute/symlink-free form the daemon's own path checks use.
+func isUnder(path, dir string) bool {
+ rel, err := filepath.Rel(resolvePath(dir), resolvePath(path))
+ if err != nil {
+ return false
+ }
+ return rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator))
+}
+
+func resolvePath(path string) string {
+ if abs, err := filepath.Abs(path); err == nil {
+ path = abs
+ }
+ if resolved, err := filepath.EvalSymlinks(path); err == nil {
+ path = resolved
+ }
+ return filepath.Clean(path)
+}
+
+// tempDirOnOtherVolume returns a writable temp directory on a volume different
+// from other's, skipping the test when the runner exposes only one.
+func tempDirOnOtherVolume(t *testing.T, other string) string {
+ t.Helper()
+ skipVolume := strings.ToUpper(filepath.VolumeName(resolvePath(other)))
+ for _, letter := range "DEFGHIJKLMNOPQRSTUVWXYZC" {
+ volume := string(letter) + ":"
+ if strings.ToUpper(volume) == skipVolume {
+ continue
+ }
+ dir, err := os.MkdirTemp(volume+`\`, "multica-repocache-")
+ if err != nil {
+ continue
+ }
+ t.Cleanup(func() { _ = os.RemoveAll(dir) })
+ return dir
+ }
+ t.Skipf("no writable volume other than %s on this runner", skipVolume)
+ return ""
+}
diff --git a/server/internal/daemon/repocache/partial_clone_test.go b/server/internal/daemon/repocache/partial_clone_test.go
index 7376ef67b9..6c0716e5c4 100644
--- a/server/internal/daemon/repocache/partial_clone_test.go
+++ b/server/internal/daemon/repocache/partial_clone_test.go
@@ -91,7 +91,7 @@ func assertCheckoutIsComplete(t *testing.T, checkoutPath string) {
}
}
-// The isolated-checkout path (Linux Codex) clones the cache with
+// The isolated-checkout path (Linux and Windows Codex) clones the cache with
// `git clone --local`. That command neither inherits a promisor remote's
// configuration nor refuses to run against an incomplete object store: it
// exits 0 and leaves every tracked file missing from the working tree. Without
diff --git a/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.md b/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.md
index ba7f556792..5b306e2a09 100644
--- a/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.md
+++ b/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.md
@@ -45,7 +45,7 @@ multica repo checkout <url>
multica repo checkout <url> --ref <branch-or-sha>
```
-`runtime update` and `runtime delete` are writes. Starting a runtime update is limited to its owner or a workspace owner/admin; the original initiator may keep polling that specific in-flight request if their admin role changes. `runtime delete` removes a runtime registration; if active agents are still bound, it refuses unless the user explicitly passes `--cascade`, which unbinds those agents and cancels their queued/running tasks before deleting the runtime. Unbinding keeps the agents and everything they own — instructions, skills, chats, labels, channel installations, autopilots and task history — and only clears `agent.runtime_id`; an unbound agent cannot run until it is bound to a runtime again (`multica agent update <id> --runtime-id <runtime-id>`), and every trigger path refuses it with `agent_runtime_required`. `repo checkout` creates a dedicated branch in the task working directory. Most runtimes use a linked worktree; Linux Codex uses task-local Git metadata so a task can stage and commit without making the shared `.repos` cache writable.
+`runtime update` and `runtime delete` are writes. Starting a runtime update is limited to its owner or a workspace owner/admin; the original initiator may keep polling that specific in-flight request if their admin role changes. `runtime delete` removes a runtime registration; if active agents are still bound, it refuses unless the user explicitly passes `--cascade`, which unbinds those agents and cancels their queued/running tasks before deleting the runtime. Unbinding keeps the agents and everything they own — instructions, skills, chats, labels, channel installations, autopilots and task history — and only clears `agent.runtime_id`; an unbound agent cannot run until it is bound to a runtime again (`multica agent update <id> --runtime-id <runtime-id>`), and every trigger path refuses it with `agent_runtime_required`. `repo checkout` creates a dedicated branch in the task working directory. Most runtimes use a linked worktree; Linux and Windows Codex use task-local Git metadata so a task can stage and commit without making the shared `.repos` cache writable.
`repo checkout` requires `MULTICA_DAEMON_PORT`; it is intended to run inside a daemon task. If absent, you are not in the normal agent checkout path. When a project `github_repo` resource has `resource_ref.ref`, `repo checkout <url>` uses that ref by default for the current task; an explicit `repo checkout <url> --ref <branch-or-sha>` overrides it.
diff --git a/server/internal/service/builtin_skills/multica-runtimes-and-repos/references/runtimes-and-repos-source-map.md b/server/internal/service/builtin_skills/multica-runtimes-and-repos/references/runtimes-and-repos-source-map.md
index c6808dc5be..ba3d408e7a 100644
--- a/server/internal/service/builtin_skills/multica-runtimes-and-repos/references/runtimes-and-repos-source-map.md
+++ b/server/internal/service/builtin_skills/multica-runtimes-and-repos/references/runtimes-and-repos-source-map.md
@@ -7,7 +7,7 @@
- `server/cmd/multica/cmd_repo.go` registers `repo checkout <url> [--ref]`.
- `repo checkout` requires `MULTICA_DAEMON_PORT`, sends `workspace_id`, `workdir`, `ref`, `agent_name`, `task_id`, and the daemon-managed optional `checkout_mode` to local daemon `/repo/checkout`, then prints the checked-out path.
- `server/internal/daemon/health.go` resolves the checkout ref: request `ref` wins; otherwise it asks `server/internal/daemon/daemon.go` for the current task's project repo default ref. It forwards the validated isolated-checkout mode into `repocache.WorktreeParams`.
-- `server/internal/daemon/daemon.go` injects `MULTICA_REPO_CHECKOUT_MODE=isolated` only for Linux Codex tasks. `server/internal/daemon/repocache/cache.go` implements that mode as a same-filesystem local clone with task-local Git metadata and the real repository as `origin`; other runtimes keep the linked-worktree path.
+- `server/internal/daemon/daemon.go` injects `MULTICA_REPO_CHECKOUT_MODE=isolated` for Linux and Windows Codex tasks. Linux keeps the isolated checkout it already had; Windows Codex now uses the same layout to cover its native sandbox, where a linked worktree's external gitdir stays read-only and `git add` / `git commit` fail from inside the checkout (multica-ai/multica#6449). That failure only bites a Windows user who opted into `windows.sandbox` — `server/internal/daemon/execenv/codex_sandbox.go` defaults both Linux and Windows Codex to `danger-full-access` — but the checkout layout is chosen per platform, not per sandbox policy, so it does not depend on a task's resolved policy. `server/internal/daemon/repocache/cache.go` implements the mode as a local clone with task-local Git metadata and the real repository as `origin`; on Windows it clones with `--no-hardlinks` so the checkout's objects are private copies rather than NTFS links that share one file and security descriptor with the cache. Other runtimes keep the linked-worktree path.
- When the bare cache is a partial clone, that isolated checkout must have `remote.origin.promisor` / `partialclonefilter` restored before its first `checkout`: `git clone --local` neither inherits them nor errors on the missing objects it leaves behind, so the checkout would otherwise succeed with an empty working tree. The linked-worktree path shares the cache's own config and needs no such repair.
- `server/cmd/server/router.go` registers daemon APIs under `/api/daemon`, including workspace repos and task claim.
- `server/internal/daemon/daemon.go` claims tasks, prepares workdirs, launches provider CLIs, and reports completion.
diff --git a/server/internal/service/builtin_skills_test.go b/server/internal/service/builtin_skills_test.go
index d783d002f2..bfd8a3c963 100644
--- a/server/internal/service/builtin_skills_test.go
+++ b/server/internal/service/builtin_skills_test.go
@@ -529,6 +529,11 @@ func TestRuntimesAndReposSkillCoversClaimAndCheckoutChain(t *testing.T) {
"local_directory",
"Runtime and repo commands affect active agent execution",
"references/runtimes-and-repos-source-map.md",
+ // An agent reads this to know whether its checkout can be committed to.
+ // Codex on Linux and Windows gets task-local Git metadata; every other
+ // runtime gets a linked worktree (multica-ai/multica#2925, #6449).
+ "Linux and Windows Codex",
+ "task-local Git metadata",
}
for _, want := range mustContain {
if !strings.Contains(body, want) {