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 reports quiet when the shell is not busy after the quiet-period fallback. For a ready POSIX shell, it sends multiline commands with bracketed-paste markers and converts carriage returns to newlines. Tests cover shell-specific submissions and marker-free input handling.
The runner reports quiet when the shell is not busy after the quiet-period fallback. For ready POSIX shells, it converts carriage returns to newlines and wraps multiline commands in bracketed-paste markers. Tests cover PowerShell and quiet-shell submissions, marker-free shell input, and long-script formatting.
This change makes long multiline setup scripts run reliably in macOS zsh by sending them as a single bracketed paste once the shell is ready. Short scripts and the other shell paths behave as before. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: long multiline setup scripts now complete in macOS zsh. The raw summary shows the transport change that sends long POSIX wrappers as one bracketed paste after readines…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections, and each section is filled with specific content. It links issue #37817, lists the review notes and thei…
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 current head is 9c99be4, a merge of origin/main into the f…
Out of Scope Changes check
The supplied change summary for the current head lists only apps/server/src/project/ProjectSetupScriptRunner.ts and its test file. The runner change is limited to the readiness-gated bracketed-paste b…
Full details: Title check
Explanation
The title names the main change: long multiline setup scripts now complete in macOS zsh. The raw summary shows the transport change that sends long POSIX wrappers as one bracketed paste after readiness, which targets that outcome. The title follows the conventional commit format, is specific, and is not misleading.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections, and each section is filled with specific content. It links issue #37817, lists the review notes and their disposition, and reports verification with commands, environments, and observed results. It also states limits, such as unverified Linux behavior and the failing Bash 3.2 syntax-error test. The template's agent-model line is present at the end. One gap: the description says the 'Scope' section should link the issue, and it does (Fixes #37817). The description is long, but it covers every required section with concrete information.
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 current head is 9c99be4, a merge of origin/main into the fix branch. The whole-PR diff against merge base d63b9c4 could not be read because changed blobs are missing from the checkout. The current-head conclusion therefore relies on the supplied change summary and the previous assessment. That summary states that runForThread sends a POSIX command containing carriage returns as \x1b[200~ + the command with CR replaced by LF + \x1b[201~ when the shell is ready. The final Enter is kept. watchShellReadiness returns "quiet" instead of "ready" for the quiet fallback, which keeps unbracketed input. The test changes assert the long-script envelope and the absence of the envelope for PowerShell, quiet-shell, and short-script paths. 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.
Full details: Out of Scope Changes check
Explanation
The supplied change summary for the current head lists only apps/server/src/project/ProjectSetupScriptRunner.ts and its test file. The runner change is limited to the readiness-gated bracketed-paste branch and the quiet-fallback return value. The test changes support those behaviors. The PR states that client, contract, Fish, Nushell, PowerShell submission, and unrelated shell-status code are unchanged. The merge with origin/main adds no file the summary attributes to this PR. Residual uncertainty: the whole-PR file list could not be verified from repository diff because changed blobs are missing from the checkout, and call sites of watchShellReadiness were not checked for dependence on the old "ready" value. No demonstrated out-of-scope change exists.
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; 9 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.
Proven on macOS with /bin/zsh: scenarios:prove exited 0. Both sides used identical fresh synthetic data, UI steps, light theme, and 1280×800 captures at 1x.
Steps: paste the literal 120-line printf script into a synchronous worktree-creation action; create a new worktree thread from main; submit the same Replay prompt; inspect the setup terminal.
Head verified exactly 120 ordered output lines, once each, the :0 completion sentinel, and the waiting agent's reply. Pairing startup was removed from recordings; workspace paths were visibly redacted.
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).vouch: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.