Skip to content

Managed Antigravity omits Auto on Ubuntu when AppArmor restricts unprivileged user namespaces #41654

Not planned

Description

@kendonB

What happened

On Ubuntu with kernel.apparmor_restrict_unprivileged_userns=1, T3 Code's managed Antigravity runtime (~/.t3/tools/antigravity-acp/linux-x64/versions/<release-id>/antigravity) cannot use its terminal sandbox and omits auto from ACP session/new (modes.availableModes and the mode config option). Fresh T3 threads also omit Auto.

I want Auto enabled for T3's managed agy while keeping kernel.apparmor_restrict_unprivileged_userns=1 on, with an AppArmor profile that applies only to a trusted executable and survives provider updates.

Diagnosis

Checked against 0.1.12-nightly.20261123.5151 (856b105fa23f9cb9fdd49a8f102cb66a71b78265):

  • T3 has no AppArmor profile, host setup command, or blocked-sandbox diagnostic for Antigravity. It only manages AppArmor for /opt/T3 Code (Beta)/t3code (.deb) and chrome-headless-shell (t3 browser setup). docs/user/permission-modes.md:34-36 only mentions account eligibility as a reason Auto is absent.
  • AntigravityInstallation (apps/server/src/provider/AntigravityInstallation.ts:197-205, 841-1204) installs under ~/.t3/tools/antigravity-acp/<platform>-<arch>/versions/<releaseId>/antigravity, where releaseId is asset.sha512.slice(0, 64) and changes on every update. resolve() rejects symlinks across the managed tree (300-313, 427, 464-475) and acquires a write-requiring proper-lockfile lock beside managedDirectory (393-421, 689). There is no read-only system runtime lookup.
  • Launches run via exec through systemd-run --user --scope (packages/provider-acp/src/server/AcpSessionRuntime.ts:1497-1532, apps/server/src/process/agentScope.ts:426-471), so antigravity runs under AppArmor label unconfined. agy logs Terminal sandbox unavailable: AppArmor restricts unprivileged user namespaces and drops auto. AntigravityProvider (apps/server/src/provider/AntigravityProvider.ts:187-195) only offers Auto when session/new advertises it.
  • Reusing t3-chrome-headless-shell's wildcard pattern against ~/.t3/tools/antigravity-acp/... breaks the trust boundary. AppArmor matches resolved paths, not ownership or hashes. Because the user owns $HOME and versions/ (even with 0500/0555 modes, the owner can chmod u+w or rename), any process running as that user could drop an arbitrary binary at the matched path to get userns.

Proposed design:

  1. Add a root-owned system runtime root on Linux (e.g. /usr/local/lib/t3code/antigravity-acp/<platform>-<arch>/versions/<releaseId>/antigravity and active.json, root:root, 0755/0555/0644). Have AntigravityInstallation.resolve() prefer it over ~/.t3/tools/antigravity-acp/ when no explicit binaryPath is set, verifying root ownership and reading without a write lock beside the directory.
  2. Ship /etc/apparmor.d/t3-antigravity matching only /usr/local/lib/t3code/antigravity-acp/linux-{x64,arm64}/versions/[0-9a-f]*/antigravity. Root ownership keeps unprivileged users from abusing the glob, and the glob survives updates without reloading AppArmor. Verify on Ubuntu 24.04+ whether agy 1.5.13+ accepts flags=(unconfined) { userns, } (which sets /proc/self/attr/apparmor/current to t3-antigravity (unconfined)) or needs a confined profile like bwrap-userns-restrict that prevents sandboxed child commands from inheriting userns.
  3. Add sudo t3 antigravity setup and update (mirroring t3 browser setup): fetch Google's pinned manifest, verify SHA-512, run ACP initialize validation unprivileged, publish atomically into the root-owned tree, load /etc/apparmor.d/t3-antigravity, and verify a fresh session advertises auto and can run a sandboxed command. When the system runtime is active, do not let unprivileged UI updates silently drop an unprofiled copy into ~/.t3—point to sudo t3 antigravity update, or offer an opt-in root updater service/timer that only pulls from Google's verified manifest with no user-supplied URL or path.
  4. When kernel.apparmor_restrict_unprivileged_userns=1 and session/new omits auto, show a setup hint in Antigravity provider settings and document it in docs/user/providers-antigravity.md and docs/user/permission-modes.md.

Steps to reproduce

  1. On Ubuntu 24.04+ x64 with kernel.apparmor_restrict_unprivileged_userns=1, kernel.unprivileged_userns_clone=1, and user.max_user_namespaces > 0, install T3's managed Antigravity (1.5.13) and sign in with oauth-personal.
  2. Probe ACP session/new against ~/.t3/tools/antigravity-acp/linux-x64/versions/<release-id>/antigravity or open a fresh Antigravity thread in T3.
  3. Both modes.availableModes and the mode config option contain only default, accept-edits, and plan, T3 omits Auto, and agy's ACP log records the AppArmor userns warning.

Version

0.1.12-nightly.20261123.5138 (also verified on 0.1.12-nightly.20261123.5151)

Environment

Ubuntu 24.04.5 LTS (Linux x64, kernel 7.0.0-43-generic, AppArmor 4.0.1, kernel.apparmor_restrict_unprivileged_userns=1), Node v26.13.1, managed agy 1.5.13 (oauth-personal), T3 Code t3code.service with Windows desktop client 0.1.12-nightly.20261123.5151

Evidence

$ sysctl kernel.apparmor_restrict_unprivileged_userns kernel.unprivileged_userns_clone user.max_user_namespaces
kernel.apparmor_restrict_unprivileged_userns = 1
kernel.unprivileged_userns_clone = 1
user.max_user_namespaces = 115347

$ cat /proc/<agy-pid>/attr/current
unconfined

# ~/.t3/userdata/providers/antigravity/<instance-hash>/antigravity-acp/log/acp-server-*.log
W1124 09:05:13.214921     283 store.go:31] Terminal sandbox unavailable: AppArmor restricts unprivileged user namespaces (kernel.apparmor_restrict_unprivileged_userns = 1)

Related issues

Fix applied or workaround

None applied. Manually copying antigravity to a root-owned path, adding an AppArmor profile for it, and setting Antigravity's Binary path works around the restriction today, but opts out of T3's managed updates (ProviderInstallation.start disables managed updates when binaryPath is set).

Filed by

Gemini 4 Neon in Antigravity via t3 triage

Activity

  1. added
    via-triage
    on Nov 23, 2026
  2. juliusmarminge commented on Nov 23, 2026

    @juliusmarminge
    Member

    Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.

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