Skip to content

fix(server): setup scripts complete with shell line editors - #25472

Merged
juliusmarminge merged 3 commits into
mainfrom
maria/takeover-pr-17817
Nov 14, 2026
Merged

juliusmarminge merged 3 commits into
mainfrom
maria/takeover-pr-17817

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Bash line editors can treat carriage-return-separated setup wrappers as unfinished multiline input. Worktree setup then never reports completion and the waiting agent cannot start.

Change

Submit complete POSIX commands with encoded script text, preserve trailing newlines, and evaluate in a subshell before reporting exit status. Long scripts use bounded, independently complete assignments. Preserve Fish, PowerShell, and main's startup-readiness handling. Reuse the existing test harness instead of adding another mock runner.

Scope and approval

This is an obvious, focused bug fix under the small-fix contribution exception. It only repairs POSIX completion-observed setup and settle delivery, preserving the original intent and all other shell paths. Maintainer takeover was already recorded on https://git.cafe/pingdotgg/t3code/pulls/17817, and Maria explicitly requested this replacement after the archived fork rejected pushes.

Verification

  • vp run check:changed passed through Blacksmith: format, lint, both knip passes, GraphQL generation, affected typechecks, and all 12 adjacent tests. The six shell cases include literals/heredocs, long input, stdin, trailing backslash-newline, explicit exit, and syntax error. Two fail against current main before the fix.
  • Real dev client with Bash 5.2 and ble.sh: main remains in MULTILINE with setup waiting; this branch completes the same setup and the Codex agent replies setup verified.
  • Additional real node-pty checks pass with plain Bash and ble.sh: multiline/heredoc, trailing backslash-newline, explicit exit 7, syntax error 2, and 120-line Unicode script.
  • Two independent GPT-6.1-Sol static reviews found no blockers. The replacement's file contents are identical to the reviewed merge candidate.
  • Unverified: native zsh, Fish, PowerShell, macOS/Windows, mobile/Electron, relay/tunnel. Long-input byte limits are tested; the long case was not repeated through the browser. Existing cosmetic limit: line-editor redraws can show internal assignments for long scripts.

main waits in ble.sh multiline input

replacement completes setup and starts the agent

worktree setup completes and starts the agent

Takeover

Replaces https://git.cafe/pingdotgg/t3code/pulls/17817, with thanks to @sgaabdu4 for the original implementation.

The contributor fork is archived and rejects maintainer pushes. Compared with the original PR's current diff, this retains its production wrapper and all six shell regression cases, replaces the duplicate test harness with main's harness, and preserves main's startup-readiness tests. No behavior was dropped. The commit credits Abid A Gafoor.

Built with GPT-6.1-Sol in the Codex harness on T3 Code.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Oct 26, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d1c9df2

Macroscope's review found this PR approvable — POSIX setup and settle scripts now use complete, size-bounded shell commands so line editors can execute them and report completion. The change preserves existing script selection and execution authority, with no product-default changes.

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

@github-actions

github-actions Bot commented Oct 26, 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 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 2f2730c · PR result: d1c9df2 · 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: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

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

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The POSIX completion wrapper now encodes setup commands, splits long commands into terminal-sized lines, evaluates them in a subshell, and appends a status sentinel. Tests check command submission, multiline syntax, literal text, long scripts, trailing backslash-newline behavior, and exit codes.

Changes: POSIX setup command delivery

Layer / File(s) Summary
POSIX wrapper and execution validation
apps/server/src/project/ProjectSetupScriptRunner.ts, apps/server/src/project/ProjectSetupScriptRunner.test.ts
The wrapper encodes commands for printf %b and splits encoded wrappers that exceed 1,023 UTF-8 bytes. It evaluates the command in a subshell and appends a sentinel with the exit status. Tests run submitted commands through Bash and check multiline syntax, literal text, long scripts, trailing backslash-newline behavior, and exit codes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: t3dotgg, juliusmarminge

Merge Risk: Minimal · up to d1c9d

This change makes setup scripts submit as complete commands so Bash line editors no longer leave them waiting, and it keeps exit-status reporting intact. No concrete defect was found, so it looks ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: setup scripts now complete when a shell line editor (Bash with ble.sh) is active. The raw summary shows the POSIX completion wrapper was rewritten to submit complete c…
Description check Passed The description follows the repository template in substance. It has Problem, Change, Scope, and Verification sections. The Problem section explains the bug and its effect. The Change section describe…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: setup scripts now complete when a shell line editor (Bash with ble.sh) is active. The raw summary shows the POSIX completion wrapper was rewritten to submit complete commands and append a sentinel, which matches the title. The title is specific and follows conventional commit style.

Full details: Description check

Explanation

The description follows the repository template in substance. It has Problem, Change, Scope, and Verification sections. The Problem section explains the bug and its effect. The Change section describes the fix. The Scope section explains why no issue is linked and cites the maintainer request. The Verification section lists focused shell tests, real-client checks, and what was not verified. The description does not link a bug issue in the usual format. It links an earlier PR and a fork, which is not the same as an issue. It also includes a takeover section that the template does not require. These gaps are minor, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • 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 8c07e7f and d1c9df2.

Files selected for processing: 2

  • apps/server/src/project/ProjectSetupScriptRunner.test.ts
  • apps/server/src/project/ProjectSetupScriptRunner.ts

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

Copy link
Copy Markdown
Collaborator Author

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified unchanged head 301c1a1a30b00a7ef3bae145ef3c6c310a0f8ff7 on this linux boat vm. git.cafe and github both use https://git.cafe/pingdotgg/t3code/pulls/25472. the pr is open; its sole commit has no authors from the excluded maintainer accounts.

  • installed dependencies with vp i in a separate github/main worktree (4914cdd98f) and on the exact pr head. ran both dev environments in the background with separate state. used repository playwright and /usr/bin/google-chrome.
  • created a project pointing at a real git repository through the client. configured a synchronous worktree setup action through the action editor. used bash 5.2.21 with ble.sh cb9c2c3.
  • on main, the multiline script with an apostrophe, quoted heredoc, unicode, and a trailing comment stays in ble.sh's MULTILINE state. setup waits and the provider does not start.
  • on this head, the same script completes, creates setup-proof.txt, and starts a real codex gpt-6.1-sol turn through the local proxy. codex runs cat setup-proof.txt and returns setup verified.
  • neighboring behavior: a 120-line unicode/quoted/backslash script completes through the same worktree flow, then codex reads its proof file. exit 7 reports exactly that status in the client and prevents the agent from starting.
  • blacksmith vp run check:changed 071239804e375078dd3fae3b14704b4def57e048 passed format, lint, both knip passes, graphql generation, affected typechecks, and all 12 adjacent tests. an explicit pr base was needed because the worker has shallow history. the pr currently has 29 successful checks, none failing or pending.

short runtime transcript:

$ git rev-parse HEAD
301c1a1a30b00a7ef3bae145ef3c6c310a0f8ff7
$ cat .t3/worktrees/setup-verification/t3-795aa242/setup-proof.txt
setup verified
$ cat .t3/worktrees/setup-verification/t3-d20de44d/setup-proof.txt
setup verified
client, exit-7 scenario: Setup script exited with 7.
blacksmith adjacent tests: 12 passed

main: ble.sh multiline setup blocks agent startup

pr: codex reads the file created by the same setup

pr: setup completes and the real codex turn reads its proof file

pr: exit 7 is reported and agent startup is blocked

Not verified

native ios/android and electron clients, macos/windows, zsh/fish/powershell, relay/tunnel connections, other providers, and the settle-trigger path were not exercised on this linux web-client pass. interactive stdin and trailing backslash-newline have passing adjacent automated coverage, but were not repeated through the browser. no performance claim is made; ble.sh redraws expose internal assignments during long scripts.

GigaZoro pushed a commit to GigaZoro/CodeShip that referenced this pull request Oct 30, 2026
…ingdotgg#25472)

Cherry-picked from pingdotgg#25472

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GigaZoro pushed a commit to GigaZoro/CodeShip that referenced this pull request Oct 30, 2026
Upstream pingdotgg#25472 runs setup scripts through eval so shell line editors complete them. macOS /bin/bash 3.2 exits 1 for a syntax error inside eval where bash 4+ exits 2; both still report a failed setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 31, 2026
@AkiVonAkira

Copy link
Copy Markdown
Contributor

Note

🤖 Claude Opus 5.5 responding on behalf of Kayzel

Reproduced on T3 Code 0.1.7-nightly.20261102.4061 (server on Linux, Bash 5.3.9, ble.sh 0.4.0-nightly+fb1811e). A worktree setup script stayed in ble.sh's -- MULTILINE -- (RET or C-m: insert a newline, C-j: run) state, the step sat on "Seed Unity Library" for several minutes, and the agent never started. The script itself runs in about 10 ms when invoked directly.

Typing the current POSIX wrapper (( cmd\r); printf '\n__T3_SETUP_DONE__%s\n' "$?"\r) into an interactive Bash with ble.sh attached reproduces it. With ble.sh left detached, the same input prints the sentinel. I'm working around it by skipping ble-attach when NO_COLOR=1 and FORCE_COLOR=0, which only setup terminals set. I'd like to drop that once this lands.

Co-authored-by: Abid A Gafoor <40262245+sgaabdu4@users.noreply.github.com>
@maria-rcks
maria-rcks force-pushed the maria/takeover-pr-17817 branch from 4e318cc to 8c07e7f Compare November 6, 2026 04:43
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 14, 2026
juliusmarminge and others added 2 commits November 14, 2026 08:41
# Conflicts:
#	apps/server/src/project/ProjectSetupScriptRunner.ts
Drops the stdin test: a pipe into bash -c does not model a terminal's
stdin, so it could not catch the regression it named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review November 14, 2026 08:44

Dismissing prior approval to re-evaluate d1c9df2

@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Created a fresh demo repository and configured the reported multiline Setup action in the UI with automatic worktree execution and waiting enabled. Started the same worktree thread through the CLI on both commits. Environment: Linux, Chromium 1280×800, light theme, Bash 5.2 with ble.sh attached, fresh databases, replay agent.

Proven: base remains in MULTILINE with Setup running and Start agent pending after 60 seconds; head completes setup and releases the agent, which finishes its reply. scenarios:prove exited 0.

Before After
Commit 2f2730c113 d1c9df20f9
Result Before: Setup blocked in ble.sh MULTILINE After: waiting agent completed its reply
Recording Before recording After recording

Scenario source · Shell fixture driver · Runner report

Not shown:

  • Nonzero-exit reporting, long chunked commands, stdin-reading scripts, and other shells were not exercised; this proof covers the reported synchronous ble.sh success hang.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 14, 2026
@juliusmarminge
juliusmarminge merged commit 83a276d into main Nov 14, 2026
52 checks passed
@juliusmarminge
juliusmarminge deleted the maria/takeover-pr-17817 branch November 14, 2026 09:09
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 14, 2026
Pipyakas pushed a commit to Pipyakas/t3code that referenced this pull request Nov 15, 2026
…g#25472)

Co-authored-by: Abid A Gafoor <40262245+sgaabdu4@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 83a276d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants