Skip to content

fix(server): terminals on systemd before 250 no longer look busy forever - #45633

Open
mtunique wants to merge 2 commits into
pingdotgg:mainfrom
mtunique:fix/terminal-scope-no-ask-password
Open

mtunique wants to merge 2 commits into
pingdotgg:mainfrom
mtunique:fix/terminal-scope-no-ask-password

Conversation

@mtunique

Copy link
Copy Markdown
Contributor

Problem

On systemd before 250, every scoped terminal shell keeps a pkttyagent child for its whole life, so T3 counts the terminal as busy until it closes. Worktree setup then never takes its quiet fallback past an rc-file prompt, and closeIdle never closes the setup terminal. #45605 has the details and a repro.

Change

Pass --no-ask-password in the scope launch built by agentScopeCommand. A --user scope never needs a polkit prompt, and systemd 250 and newer already behave this way in --user mode. systemd-run has accepted the flag since 226, and T3 already passes it to loginctl enable-linger.

Agents and the preview browser use the same launcher and get the flag too. It only matters when stdin is a tty, so terminals need no separate code path.

Scope

Fixes #45605.

Verification

  • vp test run apps/server/src/process/agentScope.test.ts packages/shared/src/AgentScope.test.ts: 20 tests passed. With the flag removed, the extended case fails with expected [ '-c', …(14) ] to include '--no-ask-password'.
  • systemd 241, real systemd-run: I ran the terminal argv from agentScopeCommand in a pty, with zsh reading the one-line prompt rc from [Bug]: On systemd before 250, every terminal shell keeps a pkttyagent child, so worktree setup can wait forever #45605. Without the flag, the shell's only child is pkttyagent. With it, the shell has no children. Both runs had the same scope, slice, TimeoutStopSec=10s, Delegate=yes, collect mode and oom_score_adj. In both, the unit unloaded after exit and left nothing behind.
  • An isolated dev:server on the same host, with ZDOTDIR pointing at that rc and a runOnWorktreeCreate setup script, started through t3 thread start --worktree main --provider devReplay:
    • Without the flag: after 40 s, the terminal log still ended at Continue? [y/N] , and the setup command was never typed.
    • With the flag, 3 runs: each time the setup command exited 0, about 5.5 s after the shell started. The terminal closed in 1 of the 3 runs. In a logged miss, closeIdle read the terminal as not busy, but its activity mark changed during the check (8 → 9), so it skipped the close. This PR leaves that check unchanged.
  • vp run check:changed: format, lint, knip and the nearby tests passed. The GraphQL generation and typecheck steps hit the 900 s timeout. Typecheck cannot run on this host, because the tsrs binary needs glibc 2.34 and the host has 2.28. As a stand-in, tsc 6.0.3 passed on packages/shared. On apps/server it reported errors only in files this PR does not touch.
  • Not checked: systemd 250 or newer.

Development model/harness: Claude Opus 5.5 / Claude Code.

systemd-run before 250 forks pkttyagent when stdin is a tty and leaves
it as the command's child, so every scoped terminal shell counted as
busy. Pass --no-ask-password: a --user scope never needs polkit, and
systemd 250+ already turns the agent off in --user mode.

Fixes pingdotgg#45605
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 29, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at a537a84

Macroscope's review found this PR approvable — Prevents older systemd versions from leaving an unnecessary helper process that makes terminals appear permanently busy. The change is confined to user-scope launches and leaves unscoped execution unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a537a84 and d34b2c7.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change documents why agentScopeCommand passes --no-ask-password and updates the delegation test to assert that the flag appears in agent, Codex, and terminal scope launches. The command behavior is unchanged.

Changes: Scope launch flag coverage

Layer / File(s) Summary
Document and assert the scope launch flag
packages/shared/src/AgentScope.ts, apps/server/src/process/agentScope.test.ts
A comment describes the systemd TTY case for versions below 250. The delegation test asserts that all three scope launch types include --no-ask-password.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · previous review a537a

This change documents the systemd scope flag and adds test coverage that it is passed for agent, Codex, and terminal launches. Runtime behavior does not change, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: terminals on systemd before 250 no longer stay busy. The PR adds --no-ask-password to the scope launch in agentScopeCommand, which addresses the pkttyagent child that …
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the systemd pre-250 pkttyagent behavior and links #45605. The Change sectio…
Linked Issues check Passed [#45605] The linked issue asks for --no-ask-password in the scope launch built by agentScopeCommand. At the reviewed head, packages/shared/src/AgentScope.ts passes --no-ask-password to `system…
Out of Scope Changes check Passed The changes at head are the --no-ask-password flag in the shared agentScopeCommand launcher, a test assertion for it, and a code comment. The launcher is the one the issue names as the fix point. …
Full details: Title check

Explanation

The title names the main change: terminals on systemd before 250 no longer stay busy. The PR adds --no-ask-password to the scope launch in agentScopeCommand, which addresses the pkttyagent child that kept terminals busy. The title follows the conventional commit form and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the systemd pre-250 pkttyagent behavior and links #45605. The Change section explains the --no-ask-password flag and its effect on agents and the preview browser. The Scope section links the issue as a bug fix. The Verification section lists focused tests, a manual systemd 241 check, and the untested systemd 250+ case, and it names the model and harness. The Scope section does not say why a fix needs no issue, but it does link one, so this gap is minor.

Full details: Linked Issues check

Explanation

[#45605] The linked issue asks for --no-ask-password in the scope launch built by agentScopeCommand. At the reviewed head, packages/shared/src/AgentScope.ts passes --no-ask-password to systemd-run in the scoped launch args, with a comment on systemd < 250 and pkttyagent. The test change in apps/server/src/process/agentScope.test.ts asserts the flag for agent, Codex, and terminal scope launches. The PR evidence reports that the extended test fails without the flag, and that a systemd 241 pty run leaves no shell child with the flag. Limits: the base blob could not be read (git cat-file failed for 58a4e599...), so this review cannot confirm whether this PR added the flag or it already existed at base. The requirement holds at head either way. The issue's expected behavior also says the setup terminal closes after success. The PR reports 1 close in 3 runs, with one miss caused by an activity-mark change during the closeIdle check. The issue does not name that race as part of the fix, and the PR leaves that check unchanged. This residual gap is noted, not counted as a failure. The setup-shell readiness timeout is excluded by the issue.

Full details: Out of Scope Changes check

Explanation

The changes at head are the --no-ask-password flag in the shared agentScopeCommand launcher, a test assertion for it, and a code comment. The launcher is the one the issue names as the fix point. Agents and the preview browser share that launcher, so they also receive the flag. The PR states that terminals need no separate path. The raw summary reports no declaration changes. No unrelated change was found in the reviewed files. The base blob could not be read, so changes in files not covered by the summary remain unverified.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 58a4e59 and a537a84.

Files selected for processing: 2

  • apps/server/src/process/agentScope.test.ts
  • packages/shared/src/AgentScope.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 29, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

the fix is written and reviewed, but proving it needs something no worker has:

  • Permanent blocker: a Linux environment running systemd before 250 with a working systemd user manager is required; the supplied Linux VM runs systemd 255.4, and no older-systemd worker is provided. The persistent pkttyagent child, stalled Preparing workspace state, quiet fallback completing setup, and idle cleanup were not verified on either commit.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: On systemd before 250, every terminal shell keeps a pkttyagent child, so worktree setup can wait forever

2 participants