Skip to content

feat(wsl): bridge fish panes report their folder (OSC 7) at every prompt - #35517

Merged
nwparker merged 1 commit into
mainfrom
nwparker/wsl-fish-osc7
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/wsl-fish-osc7

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​119 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​119
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​22 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21

Flag-off: applies on the default bridge, with the flag on or off. It only changes WSL panes whose login shell is fish.
User-risk: Low. A fish pane in WSL now sends one extra cwd report (OSC 7) at each prompt. The user's config.fish, prompt and hooks still run unchanged. Our hook runs after their config and adds to it; it never replaces anything.

ELI5

Orca learns which folder a terminal is in from a small message the shell prints at each prompt (OSC 7). That message is what Orca uses to restore the terminal in the same folder. #35385 made bash and zsh print it in WSL panes; fish was left out. Now fish prints it too.

What Changed

  • Before: a WSL bridge pane whose login shell is fish gets no Orca shell wrapper, only a -C init command that defines claude.
    • fish 3.x sends its own OSC 7 only to a few named terminals (VTE, Apple Terminal, iTerm, WezTerm), so the daemon never saw the pane's folder. Restore fell back to the folder the pane started in.
    • fish 4 does send one, but only when PWD changes, so nothing corrects a foreign report (say, from an ssh session) at the next prompt.
  • After: the same -C (getWslFishInitCommand()) also defines __orca_wsl_cwd_report --on-event fish_prompt. At every prompt it sends ESC ] 7 ; file://<path> BEL, only when WSL_DISTRO_NAME is set.
    • The path is percent-encoded with string escape --style=url (fish 3.0+). That keeps the same unreserved set as the bash and zsh blocks, and is only recomputed when PWD changes.
    • fish runs -C after reading the user's config, so their fish_prompt and their own prompt-event hooks keep working.
  • New src/shared/fish-wsl-cwd-report.ts holds the fish function. wsl-login-shell-command.ts appends it to the fish -C.

Why

  • Use the existing -C rather than add a fish wrapper or an XDG handoff for bridge panes. It is the one place Orca already injects into bridge fish, and it runs after user config by design.
  • Hook fish_prompt, not --on-variable PWD. This matches bash and zsh: re-sending at every prompt corrects a foreign report. fish also fires fish_prompt only with a terminal, which is exactly when a report matters.
  • Send no host, like bash and zsh. The daemon reads WSL pane URIs with the distro, and ignores the host. On fish 4 the native report (with a host) and ours both arrive and agree.

Linked Issue

Follow-up to #35385 (WSL bridge live cwd, bash and zsh).

Visual Proof

N/A: no UI change. The effect is the folder a restored terminal reopens in.

Testing

  • New real-fish test src/shared/fish-wsl-cwd-report.node-pty.test.ts. It runs node-pty, with fish 3+, and isolated HOME and XDG dirs.

    • It runs fish with the exact -l -C <getWslFishInitCommand()> the launcher passes, under a config.fish with its own fish_prompt and prompt hook.
    • The commands are cd into deep er/déjà a%b#c, then cd ., then a foreign OSC 7 report, then exit.
    • Expected: host-less reports [home, deep, deep, /elsewhere, deep] (the same sequence as the bash and zsh tests), and the user hook still prints. Without WSL_DISTRO_NAME, only the foreign report appears.
    • It fails with the hook removed from the -C. It passed 4 runs in a row locally (fish 4.7.1).
  • Added the test to the shell contracts CI lane, which requires fish 4+. The src/shared/fish- path prefix already triggers that lane.

  • wsl-login-shell-command and windows-shell-args tests pass.

  • Load rule: pnpm tc, typecheck:ci, check:code-quality:changed, the anti-slop lint, and the ast-grep gates.

  • Not run inside a real WSL distro.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Compatibility: string escape --style=url needs fish 3.0+. Ubuntu 20.04 ships fish 3.1.
  • Wire: the host builds the launch command, so there is no wire change for paired clients.
  • Scope: native (non-WSL) fish and SSH are unaffected.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

The bridge fish launch's -C now also defines a fish_prompt hook that
sends the same percent-encoded OSC 7 as bash and zsh, only inside WSL,
after the user's config.fish.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The change is limited to folder tracking in WSL bridge fish panes.

The PR appears safe to merge, with a non-blocking cleanup issue in the new test helper.

Findings

  1. P2 Failed tests leave fish running ▶

Summary

Adds an OSC 7 folder report at every prompt in WSL bridge fish panes.

  • WSL fish panes report their folder at every prompt.

Reviews (1) · Last reviewed commit: "feat(wsl): bridge fish panes report thei..." · Reviewed by Greptile

Comment on lines +92 to +98
await vi.waitFor(() => expect(prompts()).toBe(1), { timeout: 15_000 })
await command(`cd ${JSON.stringify(deep)}`)
await command('cd .')
// A foreign report (an ssh session that set its own) lands between prompts.
await command(String.raw`printf '\e]7;file:///elsewhere\a'`)
term.write('exit\r')
await vi.waitFor(() => expect(exited).toBe(true), { timeout: 10_000 })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Failed tests leave fish running

runFish only sends exit after every prompt check succeeds. If an earlier vi.waitFor times out, the child fish process and its terminal stay open while afterEach removes its home directory. Wrap the session in try/finally and kill the child during cleanup, as the neighboring fish tests do.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a924ce06-41b4-41c4-a4ad-d9a5f7bf449e
Commits

Reviewing files that changed from the base of the PR and between 33d57df and 1c7f3e0.

Files selected for processing: 4
  • .github/workflows/pr.yml
  • src/shared/fish-wsl-cwd-report.node-pty.test.ts
  • src/shared/fish-wsl-cwd-report.ts
  • src/shared/wsl-login-shell-command.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

The change adds a fish prompt handler that emits a URL-encoded OSC 7 directory report in WSL when the directory changes. The WSL fish startup command combines this handler with the existing fish Claude shell function. A PTY test checks WSL reports, user hook execution, and non-WSL behavior. The shell contract workflow now runs the test.

Priority: Normal

Merge Risk: Minimal · up to 1c7f3

WSL fish prompts report their directory, with no merge-blocking issue established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: WSL fish bridge panes report their current folder through OSC 7 at each prompt.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, testing, compatibility, and scope. It references issue #35385 without providing a direct issue link, and several chec…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, testing, compatibility, and scope. It references issue #35385 without providing a direct issue link, and several checklist items remain unchecked, but the description is otherwise substantially complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 5616230 into main Oct 29, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant