Skip to content

Path completion keeps the old directory after cd when overlay use runs inside a block (if/try) #19449

Open

Description

@luccahuguet

Describe the bug

When overlay use runs inside a nested block, such as if true { overlay use m.nu } or try { overlay use m.nu }, Tab path completion keeps resolving against the directory the shell was in when the overlay was activated. $env.PWD, pwd, ls and external commands all see the new directory correctly; only completion is stale. The same overlay use at the top level works. Adding as x does not help inside a block.

This hits configs that load an overlay conditionally, such as a Starship init file inside try.

How to reproduce

mkdir repro/start-only repro/sub/inner
cd repro
"" | save test.nu
if true { overlay use test.nu }   # also: try { overlay use test.nu }
cd sub
cd in<Tab>      # expected: inner/   actual: nothing
cd st<Tab>      # expected: nothing  actual: start-only/ (from repro/)

With overlay use test.nu at the top level, both completions are correct. Every later cd is affected too.

Expected behavior

Completion follows $env.PWD.

Configuration

Reproduced on 0.116.1 (nixpkgs, x86_64-linux) and 0.113.1.

Additional context

Possibly the same family as #15859 (overlay from a symlink), whose repro no longer reproduces for me on 0.116.1, and #6522 (overlay activated through an alias).

Activity

  1. fdncred commented on Nov 5, 2026

    @fdncred
    Contributor

    Does this one fix it? #19458

  2. luccahuguet commented on Nov 5, 2026

    @luccahuguet
    Author

    Does this one fix it? #19458

    yes! I just tested it

  3. fdncred commented on Nov 5, 2026

    @fdncred
    Contributor

    good. it'll be in 0.118.0 - we're too close to 0.117.0 to make it in

  4. luccahuguet commented on Nov 5, 2026

    @luccahuguet
    Author

    good. it'll be in 0.118.0 - we're too close to 0.117.0 to make it in

    very awesome.

    I already have a workaround in the meanwhile, so I wont even feel the wait

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