Skip to content

Reimplement workspace auto-naming with default-language support - #6764

Closed
austinywang wants to merge 47 commits into
mainfrom
feat-autorename-rewrite
Closed

austinywang wants to merge 47 commits into
mainfrom
feat-autorename-rewrite

Conversation

@austinywang

@austinywang austinywang commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reimplements workspace auto-naming around a deterministic language path and a more reliable naming pipeline.

Default-language behavior

  • Adds automation.autoNamingLanguage, defaulting to auto.
  • auto resolves in the app from the user's first system preferred language (NSLocale.preferredLanguages) with Locale.current as fallback, producing both a human language name and a BCP-47 tag.
  • Explicit overrides currently expose English and Japanese in Settings, and cmux.json can store any resolvable BCP-47 tag such as en, ja, or fr-FR.
  • The app returns the resolved language on the existing workspace.set_auto_title probe response as auto_naming_language_name and auto_naming_language_tag.
  • Hook subprocesses pass that resolved language into the prompt as an explicit instruction: Write the title in <language> (<tag>) only. There is no longer any reliance on the model inferring the conversation language.
  • If an old or malformed probe omits language fields, the CLI falls back to English rather than making language implicit.

Pipeline rewrite

  • Centralizes transcript parsing helpers across Claude, Codex, Grok, and generic hook payloads, with diagnostics for malformed or unknown transcript formats.
  • Surfaces probe, extraction, LLM, and apply failures through the existing AutoNamingStatus setting store.
  • Bounds and content-dedupes the generic hook auto-name message cache.
  • Makes session throttling track consecutive failures with exponential backoff.
  • Serializes naming passes with per-pass IDs so stale completions cannot clear or overwrite newer passes.
  • Treats same-title model responses as successful no-ops instead of failed summarizer attempts.
  • Replaces the previous temp-file summarizer stdout path with the shared process runner, pipe draining, environment injection, and graceful termination before SIGKILL fallback.
  • Keeps the public socket method workspace.set_auto_title, default-off behavior, and .user titles winning over .auto titles.

Tests and validation

Added behavior coverage for:

  • Japanese and English prompt language instructions.
  • auto system-locale resolution and explicit override resolution.
  • probe language fields.
  • transcript parsing diagnostics.
  • failure backoff.
  • stale pass protection.
  • bounded/content-deduped hook message cache.
  • socket-level transcript -> mocked summarizer -> sanitize -> apply path in Japanese.
  • .user title rejection over .auto.
  • cmux.json import and settings search behavior for automation.autoNamingLanguage.

Local validation run:

  • python3 -m json.tool Resources/Localizable.xcstrings
  • python3 -m json.tool web/messages/en.json
  • python3 -m json.tool web/messages/ja.json
  • python3 -m json.tool web/data/cmux.schema.json
  • git diff --check HEAD~2..HEAD

No local build or test run was performed per instruction not to build until explicitly requested.

Localization

Updated EN and JA localization for the new Settings language picker, new auto-naming status messages, search aliases, and schema messages.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Reimplements workspace auto-naming with default-language support, a serialized pipeline, and a safer subprocess runner. Adds a “Naming Language” setting and hardens timeouts, idempotent no-op applies, and progress accounting for better reliability.

  • New Features

    • Adds automation.autoNamingLanguage (default auto) resolved from system; Settings offers “Follow System,” English, and Japanese; cmux.json and web/data/cmux.schema.json accept any BCP‑47 tag. The workspace.set_auto_title probe returns the resolved language name/tag; prompts enforce that language (English fallback for old probes).
    • Centralizes transcript parsing with diagnostics across Claude, Codex, Grok, and generic hooks; preserves XML‑like Codex prompt blocks.
    • Introduces a bounded, deduped recent‑message cache for hook sources.
    • Updates Settings UI, search aliases, and localization for the new “Naming Language.”
  • Bug Fixes

    • Reliability: serialized passes with per‑pass IDs; clearer status categories (probe_failed, extraction_failed, apply_failed); exponential backoff via failureCount capped by maxFailureBackoff.
    • No‑ops: unchanged titles apply idempotently (kept path so split workspaces still trigger title side effects); empty hook caches are no‑ops; repeated hook batches don’t re‑count progress.
    • Targeting: probe includes surfaceId; the app resolves the writable panel from a requested panel ID or tab surface ID and returns the correct current title to prevent misapplied titles.
    • Subprocess: summarizers run in a process group with configurable termination grace; stdin/stdout FDs are protected and moved above stdio; stdout is pipe‑captured with a live byte cap, briefly waits for descendant output, then closes; oversized output is rejected; Codex uses a file‑backed output path independent of the stdout cap; fixed timeout accounting and cleanup; preserves file‑backed summarizer exit status when stdout is discarded or EOF isn’t required.
    • Socket: avoid duplicate status reporting after a probe failure.
    • Web push: rate‑limit ID lookup falls back to CMUX_PUSH_RATE_LIMIT_ID from env or process.env with clearer not‑found logging.
    • Settings defaults: fix restore after defaults injection in the Settings file store.

Written for commit 02db824. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added a “Naming Language” setting for automatic workspace/tab names, with “Follow System” or explicit BCP-47 language codes. Updated settings UI and configuration schema/docs accordingly.
  • Bug Fixes

    • Improved auto-naming throttling with exponential backoff based on repeated failures (persisted per session) and clearer handling of unchanged vs unusable results.
    • Expanded failure diagnostics across probe, transcript extraction, and apply, including more accurate transcript parsing/skip reporting.
  • Chores

    • Increased auto-naming summarizer robustness by capping subprocess output and making termination grace configurable.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale-revisit Closed after 30+ days without activity; preserved for possible revisit or reopening.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants