cmux NEXT: workspaces name themselves after their front tab (hq#1957)

Closed
TE
19d ago
+1118-137

Summary

A workspace never renamed itself as you worked: it stayed workspace-N unless its front tab was a browser (the only derived sidebar label, cx-e32b). Agent chat titles only named their tab.

Now, while a workspace keeps the daemon's default name and has no title, it takes a name from its front tab:

  • an agent chat: its chat title (an untitled chat is skipped)
  • a terminal: its live title, unless that's a bare shell name like zsh; else the folder name
  • a browser: the page title, as before

A name you give a workspace always wins.

Variants (DEV/NIGHTLY Debug Settings, workspaces.autoName.variant). live ships as the default: it writes nothing to the daemon and can't race a rename you make. Leo can switch variants after dogfood:

  • live (default, recommended): a sidebar label that follows the front tab. The daemon keeps workspace-N.
  • persist (alternative): the first time a default-named workspace gets a derived name, it's renamed once through Rename Workspace's command, so the CLI, window title and search see it. It never renames that workspace again, and never one you named. This is event-driven, with no polling and no focus change.

Setting: workspaces.autoName (default on, Leo's call), in Settings > General > Sidebar and in cmux.json. It's documented in docs/configuration.md, with the schema and MDM exports regenerated.

Where it lives: a new CmuxNextWorkspaceNaming target (it depends on Bridge, Compat, Daemon and Design), with tests in CmuxNextWorkspaceNamingTests. NewWorkspaceName moved there too. CmuxNextApp keeps one wiring file, WorkspaceAutoNameWiring.swift, and drops to 113,744 lines, under its 113,801 cap. Package.swift is a SW14 freeze path, so this needs a PKG slot token from the coordinator.

Testing

  • WorkspaceAutoNameTests: 20 pure tests of the derivation and the rename-once rule. Run in Packages/macOS/CmuxNext with Xcode 26.6: swift build --build-tests && swift test --skip-build --filter WorkspaceAutoNameTests.
    • Red on 237b0c0 (stub): 12 failed, 8 passed (the cases that expect no name).
    • Green on e537825: 20 of 20 passed.
  • Review fixes for persist (it had saved first prompts and cwd placeholders, renamed remote daemons' workspaces, and had no re-check before renaming): persist now saves only a chat's generated title, reads only this Mac's daemon, re-checks that the name is still the default right before renaming, and leaves terminals and browsers as live labels.
    • Red on 396a848: 22 tests, 5 failed (first prompt only, tab's own name, remote machine, terminal/browser front tab, user rename landing first).
    • Green on 1e37967: 22 of 22 passed, plus 54 related tests (AgentTurnState, Sidebar, settings).
    • Remaining race: rename-workspace has no expected-old-name parameter, so a user rename sent in the same instant as the re-check can still be overwritten. Closing that needs a daemon change.
  • WorkspaceAutoNameSettingTests (default matches docs), the schema/MDM export tests, and a Settings/Sidebar/Tunable filter (80 tests) passed.
  • Not yet verified: neither variant has been checked live in a tagged build. A dogfood build for Leo comes next.
  • Known: AppDelegate.swift was already 402 lines (over the 400 local god-file limit) before this change; this adds one line to start the namer, and it's within CI's slack. The defaults guard will ask for a call-owner approval for the new true default: Leo approved default-on in chat.

Recording

Tagged DEV build, base c5ed56723f3 vs head d73aa470221.

  • Before: a new unnamed workspace with an agent chat stays "workspace-2".
  • After: it takes the chat's name about 1 s after the first prompt is sent. A workspace the user renamed ("My release notes") keeps its name.
    before after
    after clip
  • Caveat: Claude chats run through acpmux never get a generated title (Claude Code writes ai-title only for interactive CLI sessions), so in live the label is the first prompt. The persist variant writes only generated titles.
  • Oddity: after a New Tab page opened in a terminal workspace, the row kept the terminal's folder name ("cmux") until the terminal tab closed.

Changelog

Added: Workspaces name themselves after their front tab (chat title, terminal title or folder) until you rename them

Proof

Screenshots of both variants will follow from a tagged dogfood build.

🤖 Generated with Claude Code