Fix Dock terminal working-directory inheritance

Merged
AU
3mo ago
+462-91

Summary

  • make Dock terminal tabs and panes inherit the focused/source Dock terminal working directory
  • route buttons, shortcuts, Bonsplit interactive splits, and surface.create / pane.create --placement dock through the same Dock cwd policy
  • honor app.workspaceInheritWorkingDirectory, preserve explicit cwd overrides, and keep remote-only paths out of new local terminals
  • leave browser creation unchanged

Architecture

  • add an injected TerminalWorkingDirectoryResolver for normalized candidate selection and live foreground-process cwd lookup
  • resolve Dock terminal cwd once at the DockSplitStore.newSurface / newSplit boundary: explicit request, inherited live/cached local source directory, then workspace root
  • reuse the resolver from the main Workspace process-cwd path, Dock link opening, and Dock surface transfer
  • keep remote-aware link resolution separate from local terminal startup inheritance
  • carry the original selected panel explicitly through Bonsplit interactive split creation

Testing

  • focused final Actions run: https://github.com/manaflow-ai/cmux/actions/runs/29968202373 — 7/7 tests passed
  • focused remote-cwd red proof: https://github.com/manaflow-ai/cmux/actions/runs/29967543508 — failed on the regression test before the guard fix
  • coverage includes selected-tab creation, programmatic pane creation, interactive Bonsplit splits, setting-disabled fallback, explicit override, live cwd precedence, and remote cwd isolation
  • the initial test-only run https://github.com/manaflow-ai/cmux/actions/runs/29963371278 could not provide behavioral red proof because current main's test target first hit the unrelated AgentResumeLivenessTests.swift compile regression; this branch includes the exact four-line prerequisite from upstream PR #8651
  • local xcodebuild / XCUITests were intentionally not run per issue instructions
  • changed Swift files parse; pbxproj normalization/checks pass; the 567-file test-wiring guard, workspace package grouping, Package.resolved policy, and diff checks pass
  • final canonical autoreview is clean; Greptile is 5/5; no unresolved review threads remain
  • localization audit: no user-facing strings or localization catalogs changed

Closes #8686