Reproduced on macOS as well (T3 Code desktop v0.1.6, Nushell 0.116.1 as the login shell). On current main (edc37c96c), a sync worktree setup action echo setup-ok prints __T3_SETUP_DONE___<token>:$? and thread start never proceeds. Before and after #23576, every shell other than fish/PowerShell/cmd gets the POSIX printf … "$?" wrapper, so this appears whenever the setup terminal runs nu.
A Nushell wrapper fixes it:
| 1 | let __t3c = try { |
| 2 | <command> |
| 3 | 0 } catch {|e| if $e.exit_code? == null { print -e $e.rendered }; $e.exit_code? | default 1 }; print $"\n<sentinel>($__t3c)" |
try is required because nu skips the rest of the input after a failing command. Failing externals report $e.exit_code; other errors (command not found, error make) are printed, since catch would hide them, and report 1.
Verified with real nu 0.116.1 in a PTY: success → 0, a command exiting 7 → 7, command not found → 1 with the error shown; multi-line commands and trailing comments work; stdout stays a TTY. End to end via t3 thread start --worktree on a dev server: before, it hangs at :$?; after, setup reports 0 and the agent starts, and a setup command exiting 3 stops the thread with "Setup script exited with 3."
Limitation: actions must be valid Nushell. POSIX-only syntax such as a && b fails to parse, so no status is printed, the same class as a syntax error in a POSIX shell.