Skip to content

cmux NEXT: the Chief's cmux-tui owner hands off to this build once an update replaced it - #28314

Merged
teamleaderleo merged 17 commits into
feat-cmux-nextfrom
lane/chief-owner-update-handoff
Nov 1, 2026
Merged

teamleaderleo merged 17 commits into
feat-cmux-nextfrom
lane/chief-owner-update-handoff

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Leo: "HOW THE F*** IS THIS STILL NOT FING CHANGED IT'S LITERALLY "STOP SHOWING FING NONSENSE ON LOAD" + "JUST FING REMOVE THE FING OLD DAMEMONS WHAT THE F*** ARE YOU GUYS FU CKING DOING""

Problem

The Chief home's cmux-tui conversation owner (ChiefConversationOwner) was never handed off to the connecting binary (its doc said so on purpose). So after an update it kept running the old build until it exited on its own. The reason it was never handed off: two builds that share NIGHTLY's Chief home (or one set by CMUX_NEXT_CHIEF_HOME) would each restart the other's owner on every launch.

Change

The owner is now handed off when its binary is no live build's own. The app decides from what the owner reports about itself in identify (cli_path, daemon-build-v1; build_commit); cmux-next never inspects another process:

Owner's binary (cli_path) Decision
Gone (its app was deleted or moved away) hand off
This app's own bundled binary path, but the owner runs another build (an update wrote this build over it) hand off
Another install's binary that still exists keep, so no ping-pong between builds that share the home
Not reported (an owner from before daemon-build-v1), or same build, or this app runs an external CMUX_NEXT_TUI_BIN keep

The handoff takes the same path as the DEV install-key restart:

  • IdleOwnerRestart over OwnerIdleProbe: only while no Chief turn, other app, page or cmux chief chat is connected. A busy owner hands off on the event that ends the busy state.
  • DaemonLauncher.handOffForUpdate sends shutdown-daemon with the owner's pid and generation, and the next ensure starts this build's owner on the same home and state.
  • A replaced owner goes first. Its successor starts with the install key, so no second restart is needed.

DaemonIdentity now decodes cli_path, keeping it only when the path is absolute. The decision and its file checks run off the main actor, through FileManager.checked.

Tests

ChiefOwnerReplacedHandoffLiveTests (CmuxNextHomeEngineTests, a real owner) drives ChiefConversationOwner.restartIfReplaced itself:

  • an owner that reports its own existing binary and build → nil, never handed off;
  • the same owner with its cli_path gone → a restart that waits while a cmux chief chat is attached, then hands off once the chat detaches (new pid, same registry id).

ChiefOwnerUpdateHandoffTests (CmuxNextHomeEngineTests) covers:

  • an update wrote this build over the owner's binary → hand off;
  • the owner's binary is gone → hand off;
  • another install that exists → kept;
  • same or unknown build → kept;
  • no cli_path, or an external binary → kept;
  • identify carries cli_path, and a relative one is dropped.

The test commit 0bb04ce comes first and fails to compile without the fix.

Observed / Not run

  • Fresh-home launch on a fleet Mac at 90d24c5 (Chief rule 3): passed. Home was ready at 9.2 s, with no crash, and the Chief row and intro rendered. The cmux-ci/fresh-home status is posted at that commit.
  • End-to-end update handoff on a fleet Mac, run twice at 90d24c5:
    • An older build A left the Chief owner running. The app was then replaced in place with this PR's build B and relaunched.
    • The owner restarted on B's cmux-tui (build_commit ec3b144), on the same session cmux-chief-… with a new pid. The old pid was gone within about 22 s, including B's roughly 6 s startup. No stall.
    • The same "Chief - Main - This Mac" conversation row and the on-disk chiefs.sqlite3 were kept.
  • Negative control: base to head, with the same cmux-tui build. The owner was correctly not handed off.
  • After 90d24c5, only test-only commits were added (the live handoff test, and its @testable import fix). The handoff check isn't repeated for it. A fresh-home rerun at the final head has been requested so the Chief rule's status covers the exact head.
  • Not run end to end: the busy-owner path (covered by the real-daemon test above) and the "owner's file gone" path (unit test only).
  • The Swift suites compile and run in this PR's CI, which is the red/green record.

No capture: no visible UI change. The handoff runs in the background, and the fresh-home launch above shows that Home and the Chief still render.

Changelog

  • Fixed: after an update, the Chief's background service restarts on the new build once it is idle, instead of running the old one until the next login.

risk:normal. This touches the Chief's conversation owner: Chief landing rules apply (independent review, every failing test compared by name with base, a fresh-home launch on a fleet Mac, area owner asked to review).

Agent session: agent session

🤖 Generated with Claude Code

teamleaderleo and others added 2 commits October 30, 2026 11:48
…nary

Red before the fix: there is no handsOffForUpdate and DaemonIdentity has no
cliPath (the owner was never handed off, so it ran the old build after
every update).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0208360f23a3700be142
… update replaced it

The Chief home's conversation owner was never handed off to the connecting
binary, so after an update it ran the old build until it exited on its own.
From what the owner says of itself in identify (cli_path, build_commit;
DaemonIdentity now decodes cli_path), the app hands it off once it is idle
(IdleOwnerRestart over OwnerIdleProbe, the install-key restart's path) with
DaemonLauncher.handOffForUpdate when its binary is gone, or is this app's
own bundled binary's path with another build (an update wrote this build
over it). An owner run by another install's existing binary is still kept,
so two builds sharing NIGHTLY's Chief home never restart each other's owner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0208360f23a3700be142
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

@lawrencecchen for awareness: this changes ChiefConversationOwner (you have most of its recent commits). The Chief owner now hands off to the bundled build once an update replaced its binary. The app decides from the owner's own identify cli_path and build_commit, and it hands off only while the owner is idle, through IdleOwnerRestart (the same path as the install-key restart). An owner run by another install's existing binary is still kept, so builds that share NIGHTLY's Chief home don't restart each other's owner. Not a wait gate; review welcome.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 4bb1cde: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr28314 -f ref=lane/chief-owner-update-handoff -f platform=macos -f backend_mode=local

web and size checks: green

Default changes

This pull request changes 1 default at d606b8b2b45a (what everyone gets without configuring anything):

  • tunable-source.CmuxNextControl/Diagnostics/CloudDiagnosticsReport.swift:identityFields: "1fcb4302e35fbf093ee53ff7d567a5bc79020dc156d596545d7c9ea8a49c8253" -> "e5d60b08d4d78c4244dcfa2c1d96a7a1d602207a0eb410087a0988b9b286449f"

Signed off on this commit by review (subagent claude-opus-5-5 medium, post-merge).

Merge receipt: merged as 4c51e9b41943 with these defaults changed, signed off by review (subagent claude-opus-5-5 medium, post-merge).

Regenerate the snapshot with python3 scripts/ci/defaults_guard.py snapshot.

Shipped in:

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 30, 2026
@blacksmith-sh

blacksmith-sh Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Found 6 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmp993kpeba/summary-missing.json (live):/summary-missing.json (live): View Logs
/tmp/tmpoyznhr_q/summary-fail.json (live):/summary-fail.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs

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

…ched

A real daemon: IdleOwnerRestart over OwnerIdleProbe with
DaemonLauncher.handOffForUpdate (ChiefConversationOwner.restartIfReplaced's
restart) waits while a chief-chat client is attached, and hands the owner
off once it detaches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0208360f23a3700be142
Review of #28314 (P2): the real-daemon test built IdleOwnerRestart around
handOffForUpdate directly, so it would pass with restartIfReplaced always
nil. ChiefOwnerReplacedHandoffLiveTests (CmuxNextHomeEngineTests) now runs a
real owner through restartIfReplaced: as it is it is never handed off; with
its cli_path gone it waits under an open chief-chat client and hands off once
the chat detaches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0208360f23a3700be142
It uses the daemon's internal resourceRequest and ResourceRequestEnvelope,
as OwnerRestartWaitsForChatTests does from inside the daemon's own tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0208360f23a3700be142
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol high fast, subrouter): SHIP at b970cf1 (delta from the SHIP at ea00326: the live test's @testable import CmuxNextDaemon).

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Fresh-home launch of b970cf1d0743 on a fleet capture Mac (empty HOME, CFFIXED_USER_HOME, TMPDIR and defaults): PASS

Verdict PASS
Build fleet job 9f6e4a22476572ce80c41769 of b970cf1d0743
Validator scripts/ci/fresh_home_launch_smoke.py from feat-cmux-next at fe3152a7c46f
Home rendered 10.9s after launch
Up 30s
first_window_frame_committed 5533 ms
Crash reports / uncaught exceptions 0 / 0

Screenshot withheld: the pr-media privacy check or upload refused it.

cmux-ci fresh-home --job 9f6e4a22476572ce80c41769 --pr N (commit status cmux-ci/fresh-home on b970cf1d0743)

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · took over from an earlier session · session

The suite's enabled-if trait named ChiefOwnerReplacedHandoffLiveTests.binary,
the type it decorates, which Swift rejects as a circular reference resolving
the attached Suite macro. The binary is now a file-level private value; the
test itself is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-ede8863ae66def7a83aa
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Fresh-home launch of 41f7eeaf7a86 on a fleet capture Mac (empty HOME, CFFIXED_USER_HOME, TMPDIR and defaults): PASS

Verdict PASS
Build fleet job f42a3052f24d501198aeea63 of 41f7eeaf7a86
Validator scripts/ci/fresh_home_launch_smoke.py from feat-cmux-next at 4ab956c56200
Home rendered 9.3s after launch
Up 30s
first_window_frame_committed 5696 ms
Crash reports / uncaught exceptions 0 / 0

Screenshot withheld: the pr-media privacy check or upload refused it.

cmux-ci fresh-home --job f42a3052f24d501198aeea63 --pr N (commit status cmux-ci/fresh-home on 41f7eeaf7a86)

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6-astra high, next-review): SHIP at 41f7eea

No blocking findings.

cmux-bot[bot]
cmux-bot Bot previously approved these changes Oct 30, 2026

@cmux-bot cmux-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmux-bot approves 41f7eea: an independent review passed this exact head (next-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (independent Codex gpt-6.1-sol, high, via the review router; full diff from merge base ec3b144 to this head): SHIP at 41f7eea.

No P1/P2 findings.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Fresh-home launch of 41f7eeaf7a86 on a fleet capture Mac (empty HOME, CFFIXED_USER_HOME, TMPDIR and defaults): PASS

Verdict PASS
Build fleet job f42a3052f24d501198aeea63 of 41f7eeaf7a86
Validator scripts/ci/fresh_home_launch_smoke.py from feat-cmux-next at bba1983ad892
Home rendered 7.4s after launch
Up 30s
first_window_frame_committed 5370 ms
Crash reports / uncaught exceptions 0 / 0

Screenshot withheld: the pr-media privacy check or upload refused it.

cmux-ci fresh-home --job f42a3052f24d501198aeea63 --pr N (commit status cmux-ci/fresh-home on 41f7eeaf7a86)

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent October 31, 2026 17:11 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent October 31, 2026 17:11 Inactive
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (next-review patch-id; carried): SHIP at 1a4b580

The independent SHIP at bb393ca carries to this head: the PR's own change (git diff $(git merge-base feat-cmux-next HEAD) HEAD) has the same git patch-id --verbatim (ffbcc2edf742f196) at both heads, and no merge between them was resolved by hand. Nothing new to review. A newer BLOCK, or any change to the PR's own diff, ends the carry.

@teamleaderleo teamleaderleo removed the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 31, 2026
@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 31, 2026
@cursor

cursor Bot commented Oct 31, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent October 31, 2026 19:56 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent October 31, 2026 19:56 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent October 31, 2026 19:57 Inactive
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (next-review patch-id; carried): SHIP at bbdf2cc

The independent SHIP at bb393ca carries to this head: the PR's own change (git diff $(git merge-base feat-cmux-next HEAD) HEAD) has the same git patch-id --verbatim (ffbcc2edf742f196) at both heads, and no merge between them was resolved by hand. Nothing new to review. A newer BLOCK, or any change to the PR's own diff, ends the carry.

@teamleaderleo teamleaderleo removed the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 31, 2026
@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 31, 2026
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent October 31, 2026 21:59 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent October 31, 2026 21:59 Inactive
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (next-review patch-id; carried): SHIP at 3651938

The independent SHIP at bb393ca carries to this head: the PR's own change (git diff $(git merge-base feat-cmux-next HEAD) HEAD) has the same git patch-id --verbatim (ffbcc2edf742f196) at both heads, and no merge between them was resolved by hand. Nothing new to review. A newer BLOCK, or any change to the PR's own diff, ends the carry.

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 1, 2026 00:05 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 1, 2026 00:05 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 1, 2026 00:07 Inactive
@teamleaderleo
teamleaderleo merged commit 4c51e9b into feat-cmux-next Nov 1, 2026
160 of 163 checks passed
@teamleaderleo
teamleaderleo deleted the lane/chief-owner-update-handoff branch November 1, 2026 00:17
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (subagent claude-opus-5-5 medium, post-merge): SHIP at d606b8b

This PR merged with no review at its head, so this is an after-the-fact review. No blocking findings.

Follow-ups:

  • [follow-up] ChiefConversationOwner+Update.swift:26 / ChiefConversationOwner.swift:132: bundledBuildCommit() launches cmux-tui --version (5 s timeout) before every attach. Cache it per launcher, shared with handOffIfStale and isStale, or run the replaced-owner check after attach.
  • [follow-up] ChiefConversationOwner.swift:131-138: when the replaced handoff is refused, restartIfUnverified was already skipped, so a DEV build's keyless owner gets no install-key restart. Fall back to it on .refused.
  • [follow-up] ChiefOwnerReplacedHandoffLiveTests.swift:24: the real-daemon test skips in CI because no cmux-tui binary is available. Have the lane set CMUX_NEXT_TUI_TREE_PATH.
  • [follow-up] ChiefConversationOwner+Update.swift:24: a gone cli_path (App Translocation, a deleted dev binary) hands off to whichever bundled build connects first. Note it in the doc comment.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — d606b8b2 Deployed Nov 1, 2026 by cmux-bot[bot] via wait for same-key tree publisher #92174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant