Repository navigation
Description
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
From the root of a T3 Code checkout at the commit below, install the locked dependencies with vp i and run this script with Git and Node available. It creates a linked worktree and exercises the same client file reader used by the Antigravity ACP adapter.
#!/usr/bin/env bash
set -euo pipefail
cd apps/server
node --input-type=module <<'JS'
import { execFileSync } from "node:child_process"
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"
import { tmpdir } from "node:os"
import { join } from "node:path"
import * as NodeServices from "@effect/platform-node/NodeServices"
import * as Effect from "effect/Effect"
import * as FileSystem from "effect/FileSystem"
import * as Path from "effect/Path"
import * as clientFiles from "./src/provider/acp/AntigravityClientFiles.ts"
const root = await mkdtemp(join(tmpdir(), "t3-agy-worktree-"))
const repo = join(root, "repo")
const cwd = join(root, "linked")
const forged = join(root, "forged")
const attachments = join(root, "attachments")
const git = (...args) => execFileSync("git", args, { encoding: "utf8" }).trim()
const showPath = (value) => value.replaceAll(root, "<tmp>")
const run = (effect) => Effect.runPromise(Effect.provide(effect, NodeServices.layer))
try {
git("init", "-qb", "main", repo)
git("-C", repo, "-c", "user.name=T3", "-c", "[email protected]",
"-c", "commit.gpgsign=false", "commit", "--allow-empty", "-qm", "Initial commit")
git("-C", repo, "worktree", "add", "-qb", "linked", cwd)
const gitDir = git("-C", cwd, "rev-parse", "--absolute-git-dir")
const config = join(repo, ".git", "config")
for (const dir of [attachments, forged]) await mkdir(dir)
await writeFile(join(forged, ".git"), `gitdir: ${join(repo, ".git")}\n`)
console.log(".git =", showPath((await readFile(join(cwd, ".git"), "utf8")).trim()))
console.log("gitdir backlink =", showPath((await readFile(join(gitDir, "gitdir"), "utf8")).trim()))
await run(Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem
const path = yield* Path.Path
const resolve = (cwd) => clientFiles.resolveGitWorktreeDirectory?.({ fileSystem, path, cwd })
?? Effect.undefined
const worktreeGitDir = yield* resolve(cwd)
const forgedGitDir = yield* resolve(forged)
const check = (label, workspace, extraDir, target) =>
clientFiles.readAntigravityClientTextFile({
fileSystem, path, request: { sessionId: "repro", path: target },
allowedRoots: [workspace, attachments, ...(extraDir ? [extraDir] : [])],
}).pipe(Effect.match({
onSuccess: ({ content }) => console.log(`${label}: ${content.trim()}`),
onFailure: (err) => console.log(`${label}: ${err._tag}: ${showPath(err.errorMessage)}`),
}))
yield* check("linked HEAD", cwd, worktreeGitDir, join(gitDir, "HEAD"))
yield* check("linked parent config", cwd, worktreeGitDir, config)
yield* check("forged parent config", forged, forgedGitDir, config)
}))
} finally {
await rm(root, { recursive: true, force: true })
}
JSExpected behavior
A linked worktree session can read its backing Git directory, including its own HEAD. Reads of the parent repository’s shared .git/config stay blocked.
Actual behavior
Git puts the worktree-specific HEAD outside the checkout. T3 Code sends only its attachments directory in ACP additionalDirectories, and the client read rejects the backing HEAD as outside the session workspace.
Impact
Minor bug or occasional failure
Version or commit
upstream/main at 2f577fa397340c591ec8c43cb55e717b5981ae0c
Environment
Linux x86_64, Node 24.13.0, Git 2.43.0, Antigravity ACP adapter.
Logs or stack traces
The script replaces the generated fixture path with <tmp>.
.git = gitdir: <tmp>/repo/.git/worktrees/linked
gitdir backlink = <tmp>/linked/.git
linked HEAD: AcpRequestError: Path '<tmp>/repo/.git/worktrees/linked/HEAD' is outside the session workspace.
linked parent config: AcpRequestError: Path '<tmp>/repo/.git/config' is outside the session workspace.
forged parent config: AcpRequestError: Path '<tmp>/repo/.git/config' is outside the session workspace.
Verification with the fix
The same linked-worktree fixture was checked after the fix. With a fresh temporary home and a dummy API key, Antigravity 1.5.11 accepted the backing directory in session/new.
.git = gitdir: <tmp>/repo/.git/worktrees/linked
gitdir backlink = <tmp>/linked/.git
linked HEAD: ref: refs/heads/linked
linked parent config: AcpRequestError: Path '<tmp>/repo/.git/config' is outside the session workspace.
forged parent config: AcpRequestError: Path '<tmp>/repo/.git/config' is outside the session workspace.
initialize: agy 1.5.11
authenticate: OK
session/new: OK (additionalDirectories: <tmp>/attachments, <tmp>/repo/.git/worktrees/linked)
Activity