[Bug]: On systemd before 250, every terminal shell keeps a pkttyagent child, so worktree setup can wait forever
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 84/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- linux, typescript
Piste de recherche
Commence par packages/shared/src/AgentScope.ts, en particulier agentScopeCommand, qui construit le lancement avec systemd-run --user --scope décrit dans le ticket. Examine l’invocation existante de loginctl enable-linger pour repérer le modèle de flag suggéré, puis exécute les tests serveur pertinents pour la construction de la commande du périmètre de l’agent. La tâche est terminée lorsque le périmètre utilisateur généré inclut --no-ask-password et que la régression est couverte par un test.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
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
On Linux with systemd older than 250 (tested on 241), systemd-run started from a tty leaves a polkit agent running as a child of the command:
for extra in "" --no-ask-password; do
echo "== systemd-run --user --scope $extra"
script -qc "systemd-run --user --scope --quiet $extra -- sh -c 'sleep 1; ps -o pid=,comm= --ppid \$\$'" /dev/null
done
== systemd-run --user --scope
785322 pkttyagent
785772 ps
== systemd-run --user --scope --no-ask-password
786016 ps
systemd-run forks pkttyagent --notify-fd 5 --fallback and then execs the command, so the agent stays a child of the shell until the shell exits. systemd stopped starting it in --user mode in systemd/systemd@966f3a246c, which first shipped in v250.
In T3:
- Run the server on such a host under a systemd user manager, so agent scopes are on. Terminals then start as
systemd-run --user --scope … -- <shell>without--no-ask-password(AgentScope.ts), and every terminal shell has apkttyagentchild. - Make the shell stop for input before its line editor starts, for example with this as the first line of
~/.zshrc:print -n 'Continue? [y/N] '; read -k 1. We hit it with oh-my-zsh's default update check,[oh-my-zsh] Would you like to update? [Y/n], which comes up every 13 days. - Give the project a setup script that runs on worktree creation, and start a thread in a new worktree.
Expected behavior
A terminal shell whose only child is the idle pkttyagent counts as not busy. The setup script then behaves as it does when the same shell starts without systemd-run: the quiet fallback runs it, and its terminal closes after it succeeds.
Actual behavior
The thread stays on "Preparing workspace", with no timeout. In our case a workflow stage's worktree setup (a git submodule init script that normally finishes in under a minute) waited 80 minutes, until a server restart cancelled it. That terminal's output was lost when the cancelled worktree was removed; the oh-my-zsh update check was due that day, and its lock directory was last touched the moment the terminal closed.
watchShellReadiness types the command when the line editor turns bracketed paste on, or after 3 seconds of quiet while the shell is not busy (ProjectSetupScriptRunner.ts). deriveSubprocessInspectResult counts any child whose name differs from the shell's as a running subprocess (Manager.ts). With pkttyagent attached, every scoped shell looks busy for its whole life, so T3 treats it as a startup prompt running in a child process and waits for someone to answer it.
The script commands above only show the extra child. To check the readiness effect, we replayed these rules in a pty: a real systemd-run --user --scope running zsh -o nopromptsp, with the setup command typed only on bracketed paste or after 3 quiet seconds with no non-shell child. With the one-line prompt above, the command was never typed within 30 seconds; the only child was pkttyagent. With --no-ask-password added, the quiet fallback fired at 3.5 seconds and the setup command exited 0. The oh-my-zsh prompt gave the same two results.
The same busy state keeps closeIdle from closing a setup terminal after its script succeeds (Manager.ts), so setup terminals stay open with a pkttyagent child. Auto-settle reads it through hasActiveSubprocess (Manager.ts). We found that from the code and have not observed it.
Impact
Major degradation or frequent failure
Version or commit
0.1.14-nightly.20261129.5438. The code linked above is unchanged on main @ c0b79173ab.
Environment
Linux x86_64, systemd 241, zsh 5.7.1 with oh-my-zsh, T3 server running as a systemd user service
Logs or stack traces
# process tree of a setup terminal
zsh -o nopromptsp
└─ /usr/bin/pkttyagent --notify-fd 5 --fallback
Workaround
- Upgrade to systemd 250 or newer.
- Keep rc files from prompting before the line editor starts. For oh-my-zsh, set
zstyle ':omz:update' mode reminder.
Suggested fix
Pass --no-ask-password in the scope launch built by agentScopeCommand. A --user scope never needs a polkit prompt, systemd 250 and newer already behave this way, and T3 already passes the flag to loginctl enable-linger. I can send a small PR.
Separately, waiting for the setup shell to become ready has no timeout (see also #32556 and #33017), so any stall like this becomes an indefinite hang. That is a different problem and is not part of this fix.
- Langage dominant
- TypeScript
- Étoiles
- 24.8k
- Forks
- 6.4k
- Merge moyen
- 59 min
- PR mergées (30 j)
- 613
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de pingdotgg/t3code
-
via-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Les mainteneurs répondent en général sous 1 jour
-
Sidebar thread rows dialog closes after dragging a layout item and clicking inside the dialogOuvertevia-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
via-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de pingdotgg/t3code
Issues similaires
-
needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
EPPIcenter/sampledb3#162 ·
-
Particle-1 modelOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
tashfeenahmed/freellmapi#2169 ·
Les mainteneurs répondent en général sous 1 jour
-
🎙️ task - feat(mechanic): pave git.pull.close, a close of a superseded pull with its why on recordOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
ehmpathy/rhachet-roles-ehmpathy#1576 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
vercel-labs/ui#1563 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
521xueweihan/HelloGitHub#4618 ·