Skip to content

Antigravity TMPDIR is too long (~70 bytes) and breaks Unix domain sockets in agent shell commands #39046

Done

Description

@jameblai

What happened

I was running T3 Code on my server, connected through my MacBook Pro, using Antigravity.

One of my local dev scripts starts a local Convex backend, which uses $TMPDIR.

T3 Code sets $TMPDIR (since #12008) to a ~69-byte path, about 65 bytes longer than /tmp. Because Linux enforces a 108-byte path limit for Unix domain sockets, this causes Convex to fail when creating a Unix domain socket with a path over 108 bytes. Convex then hangs in an infinite retry loop, with POST /api/deploy2/start_push returning 500 Internal Server Error.

While you could claim that this is a problem with my project or Convex:

  1. T3 Code eats ~65% of an OS kernel limit, which could break other common developer tooling.
  2. Anything an agent runs that puts a Unix socket under $TMPDIR could hit EINVAL.
  3. The same project and scripts work under Claude, Codex, Cursor, and normal terminals, and only fail under Antigravity.

Written by me with assistance from Antigravity (Gemini 4 Neon).

Diagnosis

To reclaim Antigravity's ~1 GB PyInstaller _MEI... unpack folders after force-kill, T3 Code sets TMPDIR on the Antigravity ACP process to a per-run directory under stateDir:

  • apps/server/src/provider/antigravityAuthSupport.ts:193 (resolveAntigravityInstanceDirectories) sets runtimeTemp to path.join(stateDir, "antigravity-tmp", key.slice(0, 12)).
  • apps/server/src/provider/Drivers/AntigravityDriver.ts:253 creates a run-XXXXXX subdirectory inside runtimeTemp.
  • apps/server/src/provider/antigravityAuthSupport.ts:236 (antigravityEnvironment) sets TMPDIR: tempDirectory on non-Windows platforms.

Every shell command the Antigravity agent spawns inherits that TMPDIR. With a typical Linux home directory, the path is already ~68 to 75 bytes:

/home//.t3/userdata/antigravity-tmp/ac0a3dfd6ddd/run-Z3MAVm (69 bytes)

Linux caps AF_UNIX sockaddr_un.sun_path at 108 bytes (107 plus NUL), and macOS caps it at 104 bytes. Any tool that creates a temp subdirectory and a Unix domain socket under os.tmpdir() / TMPDIR (such as Convex's local backend, Postgres, tmux, or SSH ControlPath) can exceed the limit and fail with EINVAL.

A comment at antigravityAuthSupport.ts:180 notes runtimeTemp was previously shortened for Windows' 260-character path limit, but the path is still too long for Unix domain sockets. Placing the T3-owned per-run directory under /tmp on Unix (for example /tmp/t3-agy-<uid>/[run-XXXXXX](https://github.com/tmp/t3-agy-%3Cuid%3E/run-XXXXXX) or similar) would keep orphan cleanup while leaving ~80 bytes of headroom for sun_path.

Written by Antigravity (Gemini 4 Neon).

Steps to reproduce

  1. On Linux, start an Antigravity thread on a T3 Code server with the default ~/.t3/[userdata](https://github.com/home/jamesblair/.t3/userdata) state directory.
  2. In a shell command inside the Antigravity thread, check TMPDIR and create a Unix domain socket inside a ~22-character temp subdirectory under os.tmpdir():
node -e '
const fs = require("node:fs");
const net = require("node:net");
const path = require("node:path");
const os = require("node:os");
console.log("os.tmpdir() length:", os.tmpdir().length);
const sub = fs.mkdtempSync(path.join(os.tmpdir(), "app-backend-tmp-"));
const sock = path.join(sub, "backend-ipc-123456.sock");
console.log("subdir length:", sub.length, "socket path length:", sock.length);
const srv = net.createServer();
srv.on("error", (err) => {
  console.log("listen error:", err.code, err.message);
  fs.rmSync(sub, { recursive: true, force: true });
});
srv.listen(sock, () => {
  console.log("listen succeeded");
  srv.close(() => fs.rmSync(sub, { recursive: true, force: true }));
});
'
  1. Observe listen error: EINVAL. Re-run with TMPDIR=/tmp and observe listen succeeded.

Written by Antigravity (Gemini 4 Neon).

Version

0.1.11-nightly.20261119.4918

Environment

Linux x64 (6.12.117+deb13-amd64), Node v26.13.1, Antigravity CLI 1.5.12, running as t3code.service systemd user service.

Written by Antigravity (Gemini 4 Neon).

Evidence

$ echo "TMPDIR=$TMPDIR (${#TMPDIR} chars)"
TMPDIR=/home/<user>/.t3/userdata/antigravity-tmp/ac0a3dfd6ddd/run-Z3MAVm (69 chars)

$ node -e '...net.createServer().listen(sock)...'
os.tmpdir() length: 69
subdir length: 91 socket path length: 115
listen error: EINVAL listen EINVAL: invalid argument /home/<user>/.t3/userdata/antigravity-tmp/ac0a3dfd6ddd/run-Z3MAVm/app-backend-tmp-aJo3kT/backend-ipc-123456.sock

# Original Convex local backend repro in the affected thread:
# TMPDIR="$TMPDIR/app-convex-diag01" (91 chars): timed out (exit 124) stuck at "Preparing Convex functions..." (POST /api/deploy2/start_push -> 500)
# TMPDIR="/tmp/app-convex-diag01" (26 chars): finished in 2.47s

Written by Antigravity (Gemini 4 Neon).

Related issues

#33300, #23877, and #11204 cover Antigravity _MEI... temp-dir leaks and cleanup (the reason antigravity-tmp exists), not AF_UNIX socket path overflows caused by TMPDIR length. ###

Written by Antigravity (Gemini 4 Neon).

Fix applied or workaround

Workaround is to override TMPDIR=/tmp when running tools that create Unix domain sockets inside Antigravity shell commands, or fall back to /tmp in project scripts when os.tmpdir() is long.

Written by Antigravity (Gemini 4 Neon).

Filed by

Antigravity (Gemini 4 Neon) via t3 triage

Activity

  1. added
    via-triage
    on Nov 19, 2026
  2. changed the title [-]Antigravity per-run TMPDIR is ~70 bytes and breaks Unix domain sockets in agent shell commands[/-] [+]Antigravity TMPDIR is too long (~70 bytes) and breaks Unix domain sockets in agent shell commands[/+] on Nov 19, 2026
  3. PranavTJ-05 commented on Nov 19, 2026

    @PranavTJ-05

    Can I take this issue?

  4. PranavTJ-05 commented on Nov 19, 2026

    @PranavTJ-05

    I have submitted a fix in PR #39061.

    Summary of What Was Fixed

    Root Cause:
    resolveAntigravityInstanceDirectories placed runtimeTemp under stateDir (~/.t3/userdata/antigravity-tmp/<key>/run-XXXXXX), which produces a ~69–75 character base path. Because Linux and macOS kernels cap AF_UNIX sockaddr_un.sun_path at 108 and 104 bytes respectively, tools that create a temporary subdirectory and Unix domain socket under os.tmpdir() / $TMPDIR (e.g. Convex's local backend, PostgreSQL, tmux, or SSH ControlPath) produce paths ~115 bytes long, causing listen() to fail with EINVAL: invalid argument.

    What Was Done:

    1. Short POSIX Runtime Temp Path:
      • On POSIX platforms (platform !== "win32"), resolveAntigravityInstanceDirectories now places runtimeTemp under /tmp/t3-agy-<uid>/<key.slice(0, 6)> (falling back to /tmp/t3-agy if uid is unavailable).
      • This reduces the per-run TMPDIR path to ~34 characters, leaving ~74 bytes of headroom on Linux and ~70 bytes on macOS—preventing socket path truncation and EINVAL.
    2. Preserved Windows Placement:
      • On Windows, runtimeTemp remains under stateDir (path.join(stateDir, "antigravity-tmp", key.slice(0, 12))) to prevent long extracted paths from exceeding Windows' 260-character MAX_PATH limit.
    3. Legacy Cleanup:
      • AntigravityDriver now also sweeps legacyRuntimeTemp under stateDir on POSIX so that previous runs left over in ~/.t3/userdata/antigravity-tmp are cleaned up on startup.
    4. Tests Added:
      • Added a unit test in antigravityAuthSupport.test.ts verifying that runtimeTemp on POSIX keeps the total socket path well below the 104-byte limit.
      • Verified that all existing Windows MAX_PATH tests, session cleanup tests, and driver tests pass.
  5. Nils-2m commented on Nov 23, 2026

    @Nils-2m

    Another common way to hit this: headless Chromium / Google Chrome abort on startup when an Antigravity agent runs them, e.g. to render HTML to PDF (--headless=new --print-to-pdf=...). The browser dies with SIGABRT before loading the page:

    FATAL:chrome/browser/process_singleton_posix.cc:313] Socket path too long: /home/<user>/.t3/userdata/antigravity-tmp/<12-hex>/run-XXXXXX/org.chromium.Chromium.XXXXXX/SingletonSocket
    

    Chromium creates its process-singleton socket in a mkdtemp directory under $TMPDIR, even with --headless and a custom --user-data-dir. With the current Antigravity TMPDIR, that path is len($HOME) + 98 bytes for Chromium (org.chromium.Chromium.XXXXXX) and len($HOME) + 94 for Chrome (com.google.Chrome.XXXXXX), against the 107-byte sun_path limit. So Chromium fails for any $HOME longer than 9 bytes (that is, every normal /home/<user>), and Chrome fails once the user name is 8 or more characters.

    Repro (Linux, inside an Antigravity thread)

    printf '<h1>ok</h1>' > /tmp/t.html
    chromium --headless=new --disable-gpu --no-first-run \
      --user-data-dir="$(mktemp -d /tmp/prof-XXXXXX)" \
      --print-to-pdf=/tmp/t.pdf file:///tmp/t.html
    # -> FATAL ... Socket path too long ..., SIGABRT (core dump), no PDF
    
    TMPDIR=/tmp chromium --headless=new --disable-gpu --no-first-run \
      --user-data-dir="$(mktemp -d /tmp/prof-XXXXXX)" \
      --print-to-pdf=/tmp/t.pdf file:///tmp/t.html
    # -> "... bytes written to file /tmp/t.pdf"

    The same happens with google-chrome-stable. Outside T3 (normal terminal, Claude Code, Codex), the same command works.

    Agents that hit this often retry with a different approach, so the visible symptom is usually just a systemd-coredump crash notification for chromium, with no clear link back to T3.

    Environment

    • T3 Code v0.1.7 (AppImage, headless t3 serve as a systemd user service), Antigravity ACP runtime 1.4.5, Google sign-in
    • Arch Linux, kernel 7.2, Chromium 155.0.8059.84, Google Chrome 158.0.8127.36

    Workaround until #39060 lands

    A wrapper earlier on PATH (e.g. ~/.local/bin/chromium) that resets TMPDIR when it is long:

    #!/bin/sh
    if [ "${#TMPDIR}" -gt 50 ]; then TMPDIR=${XDG_RUNTIME_DIR:-/tmp}; export TMPDIR; fi
    exec /usr/bin/chromium "$@"

    The /tmp/t3-agy-<hash> link in #39060 (~35-byte TMPDIR) would leave about 25 bytes of headroom for Chromium's singleton socket, so that PR should fix this case too.

  6. iHat3Microsoft commented on Nov 25, 2026

    @iHat3Microsoft

    Another occurrence on 0.1.7, this time not in a shell command but in an Antigravity ACP run taking a headless Chromium screenshot — so --screenshot is affected too, and the abort is provable from the process's own log buffer:

    [486331:486331:1125/050328.197590:FATAL:chrome/browser/process_singleton_posix.cc:313]
    Socket path too long: /home/<user>/.t3/userdata/antigravity-tmp/<12-hex>/run-kaMH9h/org.chromium.Chromium.Zs5vI7/SingletonSocket
    
    • T3 Code 0.1.7 (t3code-bin, Arch/Omarchy), Antigravity provider, Chromium 154.0.8037.97, 2026-11-25 05:03:28 MSK, PID 486331, SIGABRT (SI_TKILL), unit t3code-acp-…scope.
    • Sizes: TMPDIR = 67 chars, socket path = 112 vs the 107-byte limit (sun_path[108] incl. NUL). Chromium needs 44 extra bytes below TMPDIR (/org.chromium.Chromium.XXXXXX/SingletonSocket), so this fails for any $HOME longer than ~4 bytes — i.e. always, with or without --headless, --user-data-dir or --no-sandbox, since ProcessSingleton::Create() always mkdtemps under $TMPDIR (https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/process_singleton_posix.cc).
    • Impact: the agent retried 8 times between 04:58 and 05:03, each attempt aborting at startup before rendering anything; the screenshot only appeared once it was re-run with TMPDIR=/tmp. Cores are stripped (Arch ships no debuginfo), and the only FATAL string in the core is the one above — no other failure mode involved.

    One thing the fix should budget for: the run-XXXXXX component is added by the Antigravity runtime inside whatever TMPDIR it is given, so the useful constraint is len(TMPDIR) + 44 <= 107. /tmp/t3-agy-<uid>/<6-hex> from #39060 gives ~33 → ~77 total, which is fine; the Windows MAX_PATH reasoning for keeping stateDir does not apply on POSIX.

  7. juliusmarminge commented on Nov 30, 2026

    @juliusmarminge
    Member

    Fixed by #45979, now on main: Antigravity shells now inherit the host temp environment instead of the long antigravity-tmp run path, so the reported Linux Convex/socket probe and Chromium commands can run with the same temp path as a normal terminal without a TMPDIR workaround.

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

    via-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions