[#12975] Keep Cloud workspace cwd and machine identity current

Merged
AU
2mo ago
+1655-138

A remote cd could leave the left workspace row showing an old directory, while its Cloud icon exposed only a machine ID on hover. This change presents the machine's friendly name and stable ID beside remote directory metadata, and updates that metadata from the accepted Cloud graph without changing custom workspace titles.

The trace found two breaks: cmux-tui's public terminal snapshot exported the launch cwd without publishing OSC cwd changes; the Mac projected directory changes only when a delta also changed workspace/tab names. Terminal cwd now commits through the existing ordered resource journal. Catalog transactions independently project directory and machine metadata to workspace snapshots, including background terminals, machine rename, projection changes, reconnect and restore. Missing/stale directories show a localized unavailable state, and local renderer reports cannot override the Cloud graph.

Validation in progress:

  • Regression-only commit 23a66c1ebf, followed by implementation d22b388cc9.
  • Hosted suites: CloudDirectoryLifecycleTests, CloudSidebarSurfaceRegressionTests, CloudWorkspaceRestoreNamesTests, CloudSidebarConsistencyTests.
  • Added daemon regressions for cwd snapshots, ordered terminal deltas, invalid reports and live OSC 7.
  • Passed Swift file-length budget, Swift parse checks, Xcode project normalization/test wiring, Package.resolved policy, and localization parity (nine macOS locales).
  • Tagged Mac build/authenticated GCP handoff is in progress. Beta and runtime Cloud gates must both be verified before dogfood handoff.
  • Rust verification is pending: the required approved Blacksmith Testbox CLI is unavailable on this Mac. Live-cd end-to-end verification requires the updated guest daemon as well as the Mac client. No production deployment is part of this PR.

The presentation adds machine text to the existing directory metadata space. Hover and accessibility retain the friendly name plus stable ID; narrow candidates retain the stable ID. A restored/offline cwd is withheld until remote confirmation rather than presented as current. The daemon journals only actual cwd changes, preserving the existing revision fence and avoiding a second unordered cwd channel.

No new socket method, relay allowlist entry, or ID parameter is introduced. The existing renderer/report path is narrowed for Cloud provenance. Cloud tree geometry, pinning, creation, workspace deletion and other command paths are unchanged.

Fixes #12975. Related: #12347, #12515, #12575/#12743.


Summary by cubic

Fixes #12975 so Cloud workspace sidebar rows follow remote cd instead of keeping the launch directory, and hover/accessibility show the machine's friendly name with its stable ID instead of the ID alone. New terminals created from a selected hosted terminal start in its reported cwd, and unconfirmed or stale directories show localized “Directory unavailable”.

Changes

  • The devbox prompt hook emits OSC 7 cwd reports, so remote cd changes reach the daemon; explicit clears remove the directory.
  • Terminal cwd updates apply to focused, background, and non-terminal-focused panels without changing selection or custom titles.
  • The daemon snapshot shows the launch directory until the shell reports a cwd, then the reported path.
  • A shell that hasn't reported a cwd yet doesn't advance the resource revision.
  • Directory and machine metadata come only from the accepted Cloud graph; local renderer/launcher reports can no longer override it.
  • No new socket method, relay allowlist entry, or ID parameter was introduced.
  • Manual artifact publishes can choose a macOS runner label, and CI provisions rustup when that runner doesn't ship it.

Migration

  • Requires a rebuilt Mac client and the updated guest daemon; existing VMs pick up the new prompt hook on next attach without a new image.
  • New machines boot with the promoted devbox bake; previous bake rows stay listed for rollback.
  • No deployment is part of this PR.

Summary by CodeRabbit

  • New Features

    • Cloud workspace sidebars now show current terminal directories, machine names, and helpful directory details.
    • Added localized “Directory unavailable” messaging in nine languages.
    • Accessibility labels now include cloud workspace directory information.
    • Terminal directory changes are reflected in workspace snapshots and event updates.
    • Working-directory changes are reported automatically, including paths with spaces or international characters.
  • Bug Fixes

    • Prevented stale or untrusted cloud directory data from being presented as current.
    • Improved directory handling when cloud projections change, reconnect, or lose their reported location.