Skip to content

fix(server): Nushell worktree setup wrapper leaves T3CODE_WORKTREE_PATH unquoted #42345

Not planned

Description

@AymanKhan9

In apps/server/src/project/ProjectSetupScriptRunner.ts (wrapCommandForCompletion, case "nushell"), the worktree setup wrapper runs:

^$nu.current-exe --login --commands $"cd $env.T3CODE_WORKTREE_PATH; source ($__t3f | to nuon)"

While $__t3f is properly quoted via | to nuon, $env.T3CODE_WORKTREE_PATH is interpolated raw into the --commands string parsed by the child Nushell process. Any worktree path containing spaces splits cd into extra positional arguments (nu::parser::extra_positional), and paths containing Nushell syntax characters (;, (, #, quotes) break parsing or execute unintended commands.

Quoting it as ($env.T3CODE_WORKTREE_PATH | to nuon) matches ($__t3f | to nuon) on the same line and preserves spaces and special characters across POSIX and Windows paths.

Activity

  1. juliusmarminge commented on Nov 24, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Commit origin/main 902d369. Downloaded Nushell 0.117.0 (x86_64 Linux release). Took the exact wrapper string main's wrapCommandForCompletion emits for the nushell case (the existing test pins it byte for byte). The setup command was print "setup ran in"; pwd. Ran it (a) as a script with nu --no-config-file and (b) typed into an interactive nu on a PTY after bracketed paste turned on, which is how the server submits it. T3CODE_WORKTREE_PATH was set to worktree dirs named wt dir/feat, a b, a;b, a#b, a(b), a'b, a"b, a$b and x;print PWNED;y. Every run printed the correct full path from pwd and ended with exit code 0; PWNED never printed and there was no parse error. print $"cd $env.T3CODE_WORKTREE_PATH; source ($f | to nuon)" prints cd $env.T3CODE_WORKTREE_PATH; source "/tmp/a b.nu": Nushell interpolation only expands ( ), so the child nu gets the variable reference and resolves it from its inherited environment as one argument. The reported nu::parser::extra_positional only appears when a spaced path is written literally after cd, which the wrapper never does. The full app flow with Nushell as the terminal shell was not driven.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions