Skip to content

Keep a named Cloud machine's prompt name instead of flipping to its slug - #15288

Merged
teamleaderleo merged 3 commits into
manaflow-ai:mainfrom
teamleaderleo:fix/cloud-prompt-name-flip
Sep 28, 2026
Merged

teamleaderleo merged 3 commits into
manaflow-ai:mainfrom
teamleaderleo:fix/cloud-prompt-name-flip

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A Cloud machine created or renamed with a display name shows cmux@<that name> in its prompt at first. Within about 30 seconds the prompt switches to the generated slug (cmux@hardy-pink-jay).

Cause: two writers of /etc/cmux/vm-name disagree.

  • Create and rename write vmPromptIdentity(row).name, which is the display name as a slug, falling back to the generated slug.
  • The guest's cmux-prompt-sync re-fetches GET /api/vm/reflection/name every 30 s and writes that answer. The route returned reflectionMachineName(vm), which is always the generated slug.

Both now use one function, vmPromptName. The change is server-side only, so it reaches running machines without a guest upgrade. Machines without a display name are unchanged: they still get their slug.

Evidence

Found by the Cloud dogfood journey on staging (run 36402933616). The same terminal, captured before pause and after resume:

cmux@dogfood-d8e45d in ~ λ echo dogfood-14578b34-$((1+1))
dogfood-14578b34-2
cmux@hardy-pink-jay in ~ λ echo dogfood-14578b34-$((1+2))
dogfood-14578b34-3

Testing

  • New web/tests/vm-reflection-name-route.test.ts, committed first and red: the route answered hardy-pink-jay for a machine named "Dogfood Box". It is green after the fix. The unnamed case still answers the slug.
  • bun test passes across the new route test and tests/vm-guest-prompt.test.ts and tests/vm-reflection.test.ts (32 tests).
  • bun run typecheck and bun run lint:complexity are clean. eslint on the touched files is clean.
  • After merge and deploy, the staging journey rerun should show one name before and after resume.

Changelog

Fixed: a named Cloud machine's terminal prompt no longer switches back to its generated name after about 30 seconds.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Keeps a named Cloud machine's prompt (cmux@<name>) stable instead of flipping to its generated slug after about 30 seconds.

  • The guest's cmux-prompt-sync re-fetches /api/vm/reflection/name every 30 seconds, and that route answered the slug while create and rename write the display name. Both writers now use vmPromptName(vm).
  • vmPromptName lives in its own module so the polled route no longer loads guestPrompt's bashrc and prompt assets.
  • Server-side only, so existing machines pick up the fix without a guest upgrade; unnamed machines are unchanged.
  • Adds a route test covering named and unnamed cases.

Written for commit 9e7035c. Summary will update on new commits.

Review in cubic

teamleaderleo and others added 2 commits September 28, 2026 02:28
Red: /api/vm/reflection/name answers the slug while create and rename
write the display-name form, so a named machine's prompt flips back.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The guest's cmux-prompt-sync re-fetches /api/vm/reflection/name every
30 s and writes it to /etc/cmux/vm-name. That route answered the
generated slug while create and rename write the display-name form, so
a named machine's prompt flipped back to its slug. Both now use
vmPromptName.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 53538130-e6bf-4420-ba2c-d2ee1b1cc702

📥 Commits

Reviewing files that changed from the base of the PR and between b36339a and 9e7035c.

📒 Files selected for processing (4)
  • web/app/api/vm/reflection/name/route.ts
  • web/services/vms/guestPrompt.ts
  • web/services/vms/promptName.ts
  • web/tests/vm-reflection-name-route.test.ts

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.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

vmPromptName moves to services/vms/promptName.ts, so the route every VM
polls each 30 s no longer loads guestPrompt's bashrc and prompt assets.
guestPrompt re-exports it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (subagent, correctness first): nothing serious.

Checked:

  • Only one reader of this route: cmux-prompt-sync, which only writes vm-name. Hostnames, routing and peers still use reflectionMachineName (reflection index, /machine, the machines list), unchanged.
  • The name always passes the guest's NAME regex: [a-z0-9-], at most 63 characters, cmux when empty.
  • Rename still pushes the same name. It uses vmPromptIdentity, which now shares vmPromptName. A guest fetch that races a rename heals within 30 s.
  • The test is isolated: its mock delegates to the real function when inactive.

Fixed:

  • Optional tidy-up: vmPromptName now lives in services/vms/promptName.ts, so the route every VM polls each 30 s does not read the bashrc and prompt assets at cold start. guestPrompt.ts re-exports it.

Left:

  • Rows with no slug: the route now answers cmux, the same as create and rename write, where it used to answer the provider id. This is intended.
  • Stale wording: cmux@<slug> in a workflows.ts comment is a nit and left as is.

After the change: route and prompt tests pass (17), bun run typecheck and eslint are clean, and the complexity gate is unchanged.

@teamleaderleo
teamleaderleo merged commit cd030e9 into manaflow-ai:main Sep 28, 2026
65 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Merge receipt for 9e7035c808: every check was green at merge (21 verified; 16 skipped by policy). Full suite runs on main after merge.

rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 28, 2026
0e298fb ci: wait for the product's canonical root instead of compiling beside it (manaflow-ai#15379)
3088273 ci: UI test runs adopt compile admission's product, skip the re-upload, and report progress (manaflow-ai#15331)
b681e7e Keep a pending banner quiet once its pane is focused (manaflow-ai#15357)
03a2f6e Record that cloud_vm_sessions.attachment_count is cumulative (manaflow-ai#15321)
48258b4 fix(iroh-v2): check the team socket cap before opening the session (manaflow-ai#15340)
2638d56 Agent activity reorder follow-ups: group on-top check, search, subtitle (manaflow-ai#15362)
9ed83fd Dogfood journey: record whether a paused Cloud machine is asleep (manaflow-ai#15293)
7171ea8 Add app.tabBarVisibility to hide the pane tab bar when a pane has one tab (manaflow-ai#15294)
8743ec8 test: stop Computer Use onboarding tests waiting out the helper status deadline (manaflow-ai#15329)
6e4f1da ci: drain the snapshot's owned queue by what the machines finished since (manaflow-ai#15374)
9373164 ci: queue a pull request's admission for a root runner when Blacksmith's wait is longer (manaflow-ai#15376)
634a155 test: expect injected pane attention accent (manaflow-ai#15370)
cd030e9 Keep a named Cloud machine's prompt name instead of flipping to its slug (manaflow-ai#15288)
24ee0ee Exit 1 when cmux terminal screen wait times out (manaflow-ai#15282)
1b857ac test: cover a live Codex turn owner keeping its turn on SessionStart (manaflow-ai#13588)
56ec600 PR media: prune media of long-closed pull requests (manaflow-ai#15364)
4898cde ci: bound the SwiftPM scratch holder and cache scratch sizes (manaflow-ai#15366)

# Conflicts:
#	.github/workflows/ci-guards.yml
#	.github/workflows/ci.yml
#	.github/workflows/test-e2e.yml
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