You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): long setup scripts complete in macOS zsh - #37836
New-worktree setup can hang in macOS zsh when the setup command is long. Instead of finishing and starting the agent, the terminal repeats corrupted __t3_command assignments.
Reproduce with the self-contained 120-line Unicode/quoting/backslash script and PTY helper in #37817. The helper waits for the shell's bracketed-paste readiness signal before sending the command; the original delivery still hangs with /bin/zsh -f, without user shell configuration.
Change
Submit long, multiline POSIX wrappers as one bracketed paste after the shell actually signals readiness, converting internal carriage returns to newlines and retaining the final Enter. Keep the quiet fallback distinct from that readiness signal so shells without an active line editor receive the existing input format.
Extend the existing long-script and quiet-shell tests. Short scripts and Fish, Nushell, and PowerShell submission paths are unchanged.
One completion-tracked setup-input transport bug in the shared server runner, which also handles settle scripts. No client, contract, or unrelated shell-status changes.
Review notes and their disposition:
Review note
Disposition
Transport guards needed direct test coverage.
Extended existing cases to reject paste markers for PowerShell, quiet fallback, and short scripts, and to require the long-script envelope and LF-only interior.
Interactive Bash needed real readline verification.
Verified Bash 5.3.20 after live readiness: all 120 expected lines and completion exit code 0.
Unobserved scripts and quiet fallback are not fully covered by this fix.
Raw LF scripts and shells reaching the quiet fallback retain their pre-existing limitations. Raw CRLF scripts can also take the paste path. This PR does not claim to fix all unobserved scripts.
Shell redraw can leave wrapper fragments in the setup output tail.
Known cosmetic limitation. Output filtering is outside this transport fix.
The syntax-error test fails on macOS system Bash 3.2.
Confirmed on the unchanged upstream wrapper too: status 1 instead of the test's expected 2. No unrelated shell-status change included.
Runtime evidence has limits.
Native macOS PTY and isolated real-server setup verified. Browser inspection covers the after-fix terminal result, not a UI-created before/after scenario. Linux remains unverified.
Verification
The extended long-script test fails on upstream base b79d277cddaf65858418f29d73b87fcc3d1a19c5 for the missing paste envelope, then passes with this fix.
Native macOS zsh 5.9 PTY reproduction: original delivery sends the command but produces 0/120 expected output lines and no completion sentinel before the diagnostic's five-second watchdog. Bracketed delivery verifies all 120 lines byte-for-byte and completion exit code 0.
Interactive Homebrew Bash 5.3.20, with no profile or rc file: after live readline readiness, the same bracketed input verifies all 120 output lines and completion exit code 0. Terminal escape sequences are removed before comparing output lines.
Actual isolated development-server worktree setup: terminal history verifies all 120 Unicode/quoting/backslash lines, the final marker, and completion exit code 0; workspace preparation and the replay-provider turn complete. Opened that thread in the built-in Browser panel and inspected the terminal drawer showing the final output lines and exit-0 sentinel. No installed app or live user state is used.
vp test run apps/server/src/project/ProjectSetupScriptRunner.test.ts: 14 passed, 1 failed. The sole failure is the existing syntax-error test expecting status 2; macOS system Bash 3.2 returns 1. Independently extracting and executing the unchanged upstream wrapper produces the same status 1.
vp run check:changed 4b758f49ec52ab58a0bd9647e28c9e2911945c88: format, lint, knip, GraphQL validation, and all three affected-package typechecks pass. Adjacent tests: 16 passed, 1 failed, the same baseline Bash discrepancy.
Browser pairing initially failed to produce screenshot frames; it recovered after pairing and direct thread navigation. The thread was created through the real server CLI, not through the new-thread UI. No before/after scenarios:prove run or other-OS shell verification is claimed. Native PTY and actual server terminal transcripts provide the before/after and runtime proof.
Independent council reviews from GPT-6.1 Sol, Claude Opus 5.5, and Claude Fable 5.2 approved this scoped change. Non-blocking notes and verification limits are documented above.
Macroscope's review found this PR approvable — The change sends multiline POSIX setup commands as bracketed paste when the shell reports line-editor readiness, allowing long scripts to complete in macOS zsh. Script selection and execution permissions remain unchanged, with the existing input path retained for quiet-shell fallback.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review.
Walkthrough
The runner now reports quiet when shell activity remains unchanged and no subprocess is busy. For a ready POSIX shell, it sends multiline commands with bracketed-paste markers and converts carriage returns to newlines. Tests cover these submission formats and marker-free shell input.
The runner reports quiet when activity remains unchanged and the shell is not busy. For ready POSIX shells, it converts carriage returns to newlines and wraps multiline commands in bracketed-paste markers. Tests check quiet-shell and PowerShell submissions, marker-free shell input, and long-script formatting.
pingdotgg/t3code#24775: Changes the same runner’s shell-readiness wait and quiet-shell fallback.
pingdotgg/t3code#25472: Changes delivery of POSIX setup wrappers, including long scripts.
Suggested labels:bugfix
Suggested reviewers:t3dotgg, maria-rcks
Merge Risk: Minimal · up to 8f844
This change submits long multiline POSIX setup scripts as a single bracketed paste once the shell is ready, which targets the macOS zsh hang. No concrete regression remains after review, so the merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: long setup scripts now complete in macOS zsh. It matches the linked issue #37817 and the PR objectives, which describe readiness-gated bracketed-paste delivery for lon…
Description check
The description follows the repository template. It has Problem, Change, Scope, and Verification sections with substantive content. The Problem section gives reproduction steps and the environment (ma…
Linked Issues check
[#37817] The requirement is that long, multiline POSIX setup wrappers run once in macOS zsh, report exit status, and let the agent start. The whole-PR diff against merge base d6a28f4 shows the transpo…
Out of Scope Changes check
The whole-PR diff touches only ProjectSetupScriptRunner.ts and its test file. The runner change is limited to the readiness-gated bracketed-paste branch and the return value of watchShellReadiness. Th…
Full details: Title check
Explanation
The title names the main change: long setup scripts now complete in macOS zsh. It matches the linked issue #37817 and the PR objectives, which describe readiness-gated bracketed-paste delivery for long multiline POSIX wrappers. It uses the conventional commit format with a fix(server) scope and stays within the 53-character length. It does not name the bracketed-paste mechanism, but it does not need to cover every detail.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Change, Scope, and Verification sections with substantive content. The Problem section gives reproduction steps and the environment (macOS zsh, /bin/zsh -f, PTY helper in #37817). The Change section explains the bracketed-paste fix and the quiet fallback. The Scope section links issue #37817 and explains why the change stays limited to the shared server runner. The Verification section lists focused test results, native macOS PTY and Bash checks, and an isolated server setup run. It also states the known limits: the one failing syntax-error test on Bash 3.2, unverified Linux and other-OS shells, and the lack of a UI-created before/after scenario. The template's optional agent-model line is present at the end. Some details are dense, but the required information is present.
Full details: Linked Issues check
Explanation
[#37817] The requirement is that long, multiline POSIX setup wrappers run once in macOS zsh, report exit status, and let the agent start. The whole-PR diff against merge base d6a28f4 shows the transport change in apps/server/src/project/ProjectSetupScriptRunner.ts. When the shell is ready, the completion shell is POSIX, and the command contains "\r", runForThread sends \x1b[200~ + commandLine with "\r" replaced by "\n" + \x1b[201~. The final Enter is kept. The quiet fallback now returns "quiet" instead of "ready", so it keeps the unbracketed input. The test diff asserts the bracketed envelope for long scripts, asserts no envelope for PowerShell, quiet-shell, and short-script paths, and checks line lengths on the unwrapped shell input. The current head matches the previous assessment's conclusion for the code. I did not run the tests. The zsh PTY, Bash, and development-server results are author-reported and were not re-run here. Manual UI steps in the issue are non-coding and out of scope.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff touches only ProjectSetupScriptRunner.ts and its test file. The runner change is limited to the readiness-gated bracketed-paste branch and the return value of watchShellReadiness. The "quiet" return value separates the quiet fallback from the readiness signal, which the bracketed-paste condition requires. The test changes support those behaviors: envelope assertions, the shell-input unwrapping used when Bash runs the submitted script, and the quiet-shell and PowerShell guards. The PR states that client, contract, Fish, Nushell, PowerShell submission, and unrelated shell-status code are unchanged, and the diff shows no such edits. Residual uncertainty remains: I did not check other call sites of watchShellReadiness that might depend on the old "ready" value for quiet shells. This is not a demonstrated out-of-scope change.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
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 macOS host running the T3 Code server with /bin/zsh is required. This worker is Linux, and the brief prohibits reaching another machine. Base corruption, head completion with exit code 0, content preservation, single execution, and waiting-agent startup remain unverified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).takeover:blockedTakeover blocked; reason in the PR bodyvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
New-worktree setup can hang in macOS zsh when the setup command is long. Instead of finishing and starting the agent, the terminal repeats corrupted
__t3_commandassignments.Reproduce with the self-contained 120-line Unicode/quoting/backslash script and PTY helper in #37817. The helper waits for the shell's bracketed-paste readiness signal before sending the command; the original delivery still hangs with
/bin/zsh -f, without user shell configuration.Change
Submit long, multiline POSIX wrappers as one bracketed paste after the shell actually signals readiness, converting internal carriage returns to newlines and retaining the final Enter. Keep the quiet fallback distinct from that readiness signal so shells without an active line editor receive the existing input format.
Extend the existing long-script and quiet-shell tests. Short scripts and Fish, Nushell, and PowerShell submission paths are unchanged.
Scope
Fixes #37817.
One completion-tracked setup-input transport bug in the shared server runner, which also handles settle scripts. No client, contract, or unrelated shell-status changes.
Review notes and their disposition:
Verification
b79d277cddaf65858418f29d73b87fcc3d1a19c5for the missing paste envelope, then passes with this fix.vp test run apps/server/src/project/ProjectSetupScriptRunner.test.ts: 14 passed, 1 failed. The sole failure is the existing syntax-error test expecting status 2; macOS system Bash 3.2 returns 1. Independently extracting and executing the unchanged upstream wrapper produces the same status 1.vp run check:changed 4b758f49ec52ab58a0bd9647e28c9e2911945c88: format, lint, knip, GraphQL validation, and all three affected-package typechecks pass. Adjacent tests: 16 passed, 1 failed, the same baseline Bash discrepancy.scenarios:proverun or other-OS shell verification is claimed. Native PTY and actual server terminal transcripts provide the before/after and runtime proof.Independent council reviews from GPT-6.1 Sol, Claude Opus 5.5, and Claude Fable 5.2 approved this scoped change. Non-blocking notes and verification limits are documented above.
Created with GPT-6.1+ Sol in the Codex harness.