Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Integrated terminal can't use sudo: the desktop app runs with no_new_privs set, and every terminal inherits it #27880

OpenRajvira10(GitHub profile, opens in a new tab) opened this issue 3 comments

What happens

In the T3 Code integrated terminal (desktop and when opened remotely from the mobile app), any sudo command fails immediately, before asking for a password:

$ sudo pacman -Sc
sudo: The "no new privileges" flag is set, which prevents sudo from running as root.
sudo: If sudo is running in a container, you may need to adjust the container configuration to disable the flag.

So there's no way to do admin work from T3 Code, which matters most when you're remote and T3 is your only way into the machine.

Cause

The T3 Code desktop process itself has NoNewPrivs: 1, and the flag can't be cleared once set, so every terminal and agent it spawns inherits it:

$ for p in $(pgrep -x t3code); do grep NoNewPrivs /proc/$p/status; done
NoNewPrivs:	1   (all 5 t3code processes)

parent chain of the main process:
33802 t3code    NoNewPrivs=1  /opt/t3code-bin/t3code
1287  systemd   NoNewPrivs=0  /usr/lib/systemd/systemd --user

Other Chromium-based apps launched the same way (Brave, Codex desktop) have NoNewPrivs: 0, so it isn't the launcher.

Agent sessions running under app-t3code-agents.slice also have NoNewPrivs: 1, which seems intended for sandboxing agents. My guess is that the desktop app picked the flag up when it was relaunched from inside such a sandboxed context. The current instance started (02:27:18) in the same second a t3code-codex-*.scope agent session ended, and systemd then created app-com.t3tools.T3Code-33802.scope for it. I haven't confirmed the exact relaunch path (update-and-restart vs. something else). If the app sets the flag on purpose, the integrated terminal should run outside it.

Workaround

Starting the command through the user systemd manager, which doesn't have the flag, works and prompts for the password normally:

systemd-run --user --pty sudo <command>

Expected

The integrated terminal behaves like a normal terminal: sudo prompts for the password. Agent sandboxes can keep no_new_privs, but it shouldn't leak into the app's own process and from there into user terminals.

Environment

  • T3 Code desktop 0.1.4 (t3code-bin 0.1.4-1, AUR), server 0.1.4
  • Arch Linux (Omarchy), kernel 7.2.5, Hyprland 0.56.2, launched via uwsm (systemd-run --user --scope)
  • Reproduced from the desktop terminal and from the Android app's terminal
  1. Another symptom: snap-packaged CLIs can't run either, so T3 reports a snap-installed glab as not installed. snap-confine gets its permissions from file capabilities, and the kernel ignores those under no_new_privs:

    snap-confine is packaged without necessary permissions and cannot continue
    required permitted capability cap_dac_override not found in current capabilities

    #15387 fixes the relaunch path. Until it lands, fully quitting and reopening T3 Code clears the flag.

  2. raulferrodrigues(GitHub profile, opens in a new tab)commented

    Still reproduces on 0.1.9-nightly.20261109.4443 (.deb, Electron 44.10.1), and it also affects agent shells, not just the integrated terminal.

    After an in-app update, the relaunched instance has NoNewPrivs: 1 on the Electron main process, so the server, provider processes and every agent Bash shell inherit it. The instance I'd opened from the app menu earlier in the same boot had NoNewPrivs: 0, and agent sudo worked there.

    This breaks the sudo flow T3 recommends to agents (request_secret with delivery: "file", then sudo -S -p '' <cmd> < "$file"). It fails with The "no new privileges" flag is set, so agents can't do any admin work in an updater-relaunched instance.

    Agent shells have no TTY, so the --pty workaround above doesn't apply. This works:

    systemd-run --user --quiet --wait --pipe --same-dir sudo -S -p '' <cmd> < "$file"

    Until #15387 lands, the agent instructions could check NoNewPrivs in /proc/self/status and suggest this form, or say that quitting and reopening T3 Code clears it.

    Per Fable 5.2 high

  3. tanstack-source added labelsbug

  4. Still reproduces on desktop 0.1.13 (.deb, Ubuntu 26.04.1 LTS, XFCE on X11). #15387 was closed without being merged, so I don't think anything has fixed it yet.

    Another symptom: links can't open in the system browser when the default browser is a snap. On Ubuntu that means Brave, Chromium or Firefox (/usr/bin/firefox is only a snap shim there). From an agent shell, an integrated terminal or a dev server started by T3, xdg-open https://example.com exits 0, but the browser never starts:

    snap-confine is packaged without necessary permissions and cannot continue
    required permitted capability cap_dac_override not found in current capabilities:
      cap_wake_alarm=i: Argument list too long

    So agents and dev tools (BROWSER, open, Vite/Next "open browser") fail silently. E2E runners can't launch snap browsers either. A non-snap Chrome (/usr/bin/google-chrome from the .deb) works, and so do the built-in preview panel and Playwright with channel: 'chrome'.

    Evidence:

    t3code main process      NoNewPrivs: 1   (/opt/T3 Code (Beta)/t3code, PPid 1)
    xfce4-panel / Thunar     NoNewPrivs: 0
    scope: app-com.t3tools.T3Code-<pid>.scope (transient, no NoNewPrivileges= set)

    The flag is on the T3 process itself, not on the launcher. Per the earlier comment, fully quitting and reopening T3 Code is the workaround until the relaunch path is fixed.

Sign in to join this conversation.