Skip to content

fix(terminal): close completed setup shells safely - #896

Merged
rynfar merged 3 commits into
pylonfrom
codex/settle-idle-shells
Sep 27, 2026
Merged

rynfar merged 3 commits into
pylonfrom
codex/settle-idle-shells

Conversation

@rynfar

@rynfar rynfar commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

A successfully completed worktree setup script leaves a terminal shell open even when its command has finished. This closes that setup terminal when Pylon has observed its success sentinel and can safely confirm that the launched shell remains at the PTY PID, no child command is running, and no other input or output arrived during inspection. Its output stays in setup history. Failed, reused, active, and uncertain terminals stay open.

Terminal writes and setup cleanup now share the per-thread lock. A write accepted while process inspection is in progress waits until cleanup finishes; if the shell was closed, the write receives the existing terminal lookup error instead of being sent to a process that is about to be killed. A deterministic regression holds inspection open while a write is queued and checks that no extra input reaches the PTY. PTY output arriving during inspection still prevents closure.

This is a partial adaptation of frozen T3 source 1a0c915c41024ddb47e16befd9fc730c1173af02 (#13673). Arbitrary terminals are not closed when a thread settles: a process tree with no children cannot distinguish an idle prompt from an in-process shell command such as read or PowerShell Start-Sleep. That settlement cleanup remains deferred until Pylon has a reliable prompt or command-completion signal. The provider session settlement behavior is unchanged.

Focused verification: terminal manager and setup runner tests passed (94 cases); server t3 typecheck, scoped lint, changed-file format, and diff checks passed. Scoped lint reported one pre-existing warning. No browser or mobile surface change.

Implemented by GPT-6 Codex in the Pylon harness.

@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
pylon-marketing Ignored Ignored Preview Sep 27, 2026 5:12pm UTC

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 14.0 KiB 14.0 KiB +33 B (+0.2%) 15.1 KiB ✅
Codex Thread snapshot wire 7.3 KiB 7.3 KiB −1 B (−0.0%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.7 KiB 6.8 KiB +34 B (+0.5%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 58.0 KiB 58.0 KiB +44 B (+0.1%) 66.4 KiB ✅
Codex Live turn messages 9 10 +1 (+11.1%) 21 ✅
Claude Total thread wire 14.0 KiB 14.0 KiB +39 B (+0.3%) 15.1 KiB ✅
Claude Thread snapshot wire 7.3 KiB 7.2 KiB −6 B (−0.1%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.7 KiB 6.8 KiB +45 B (+0.7%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 58.9 KiB 58.9 KiB +44 B (+0.1%) 66.4 KiB ✅
Claude Live turn messages 9 10 +1 (+11.1%) 21 ✅

Baseline: a247895 · PR result: 1e059cb · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 115.7 KiB
  • Claude decoded thread snapshot: 116.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@rynfar
rynfar force-pushed the codex/settle-idle-shells branch from b15b162 to 472f5ea Compare September 27, 2026 16:45
@rynfar rynfar changed the title fix(terminal): close idle shells when threads settle fix(terminal): close completed setup shells safely Sep 27, 2026
@rynfar
rynfar merged commit 6972697 into pylon Sep 27, 2026
29 of 30 checks passed
@rynfar
rynfar deleted the codex/settle-idle-shells branch September 27, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant