Skip to content

cmux-tui: agent-session-adopt binds another chat of this machine to an agent tab (1/3 of #22871) - #24554

Closed
teamleaderleo wants to merge 4 commits into
feat-cmux-nextfrom
cmux/agent-session-adopt-daemon
Closed

teamleaderleo wants to merge 4 commits into
feat-cmux-nextfrom
cmux/agent-session-adopt-daemon

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

HOLD: sidebar change under Lawrence's sidebar hold; open for dogfooding, never ready-to-land.

Split out of #22871, part 1 of 4 (the adopt verb). #22871's intent: "Open a chat that already runs on another machine (cmux16, huge-blue; for example one cmux agent open huge-blue/NAME started) as a sidebar workspace bound to that machine's daemon." Stack: this PR, then #24559 (mode reads), then #24555 (bypass badge), then #24556 (the app's adopt workspace).

Summary

  • agent-session-adopt {surface, session} binds a session of this machine's own acpmux to an unbound agent tab of this store.
    • Same gates as agent-session-start: a trusted local non-remote client, the host gate that refuses team VMs and unverified Cloud VMs, and a tab of this store with no session yet.
    • It refuses with agent_session.unknown_session any id that this machine's _acpmux/sessions does not list as its own: a peer's mirrored chat, the Home Chief's, or an unknown id. It never starts acpmux.
    • It answers {surface, session, conversation, family, mode, asking}.
  • Policy (b): a chat in a mode that does not ask (bypass) is adopted, but only on enrolled or trusted hosts (the start's host gate), and the answer says asking: false so the app can warn.
  • is_chief moves to agent_session_start and is shared with agent_update, using base's panic-free JsonFields::field.
  • The capability is not advertised yet. agent-session-adopt-v1 goes into identify in cmux-tui: agent-session-mode and the attach mode reads for adopted chats #24559, together with the mode reads. An app that sees the capability sends mode_events and agent-session-mode, which this PR does not serve, so this PR alone is dark.
  • Review round 1 at fcd4f27 found three issues in the mode reads. They are fixed with CLI tests in cmux-tui: agent-session-mode and the attach mode reads for adopted chats #24559, which now holds that code, so each PR stays under about 800 lines.
  • Size: 413 changed lines.

Risk: high. This adds a socket verb that binds sessions and lets a non-asking session open on a trusted host.

Changelog

none (the app half, #24556, carries the user-visible line)

Observed / Not run

Fleet runs at this head are listed in the comments below with their job ids.

Base red, not this PR's: cmux-tui::cli agent_session_start::* (for example a_peer_session_makes_the_keyed_restart_unsafe) fails under load with "acpmux did not answer in time" (agent_session.timeout). Base e1429af1bbc4 with the same --arg test --arg agent_session step is red the same way (step 38542d4ae54759f6fd6129a0). The narrower agent_session_start run is green on #22871's head (step a4dcf8dcc08856d309bd0f8b, 34/34).

Not run: no live adopt of a real remote chat end to end.

🤖 Generated with Claude Code

Agent session: cosmic-gray

…pmux to an agent tab

Split out of #22871 (the daemon half). agent-session-adopt {surface, session}
(agent-session-adopt-v1) binds a session of this machine's own acpmux to an
unbound agent tab of this store, with agent-session-start's gates (a trusted
local non-remote client, the host gate that refuses team VMs and unverified
Cloud VMs, a tab of this store with no session yet). It refuses with
agent_session.unknown_session any id this machine's _acpmux/sessions does not
list as its own (a peer's mirror, the Home Chief's, an unknown id), and answers
{surface, session, conversation, family, mode, asking}. A new agent-session-mode
verb reads a bound tab's mode; the attach reply carries it, and an attachment
with mode_events hears agent-session-mode pushes when it changes (one read at a
time, released with an AcqRel swap so a change during a read is never lost).
is_chief moves to agent_session_start and is shared with agent_update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16040-fd0b-7dd0-9487-1a3a198d9f5c&host=cosmic-gray
@teamleaderleo teamleaderleo added hold cmux-next batch queue: keep this PR out of the batch (docs/ci/cmux-next-batch.md) risk:high Risk tier (docs/ci/risk-tiers.md) labels Oct 23, 2026
@teamleaderleo
teamleaderleo temporarily deployed to cmux-tui-merge-tree October 23, 2026 16:07 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Review d07af2f: 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=pr24554 -f ref=cmux/agent-session-adopt-daemon -f platform=macos -f backend_mode=local

red: cmux-next checks (god files, concurrency, crash safety, l10n); NEW: red check: Checks job structure (+4 more) is not red on the base e6048d7; do not merge until green; see lane-rules

@teamleaderleo

teamleaderleo commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Owned by p0-machines on air-blue · session

@blacksmith-sh

blacksmith-sh Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Found 11 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmprddsac9j/summary-missing.json (live):/summary-missing.json (live): View Logs
/tmp/tmpuuq64x92/summary-fail.json (live):/summary-fail.json (live): View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
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
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
convention violations found (ERROR lines above)./
convention violations found (ERROR lines above).
View Logs
test_base_passes (main.NoticesPairTests.test_base_passes)/
test_base_passes (main.NoticesPairTests.test_base_passes)
View Logs
test_targets_outside_the_app_go_to_the_mac_canary (main.SwiftCanaryFleetCoverage.te
st_targets_outside_the_app_go_to_the_mac_canary)/
test_targets_outside_the_app_go_to_the_mac_canary (main.SwiftCanaryFleetCoverage.te
st_targets_outside_the_app_go_to_the_mac_canary)
View Logs
test_wrong_event_stream_is_rejected (main.LiveSchemaTests.test_wrong_event_stream_i
s_rejected)/
test_wrong_event_stream_is_rejected (main.LiveSchemaTests.test_wrong_event_stream_i
s_rejected)
View Logs

...and 1 more test failures. View all on Blacksmith

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

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Fleet at head fcd4f270b133ba661d9fce16fed42e89ce9537e6:

  • cmux-tui-rust-check.sh test agent_session, step b836f0378032b93ec56e74b8: green, 5 crates, 0 red, 0 flaky.
  • cmux-tui-rust-check.sh clippy, step d9bd3ab55ecee9482fa45769: green.
  • cmux-tui-rust-check.sh fmt, step 29a51367f0de6d26e31635d5: green.

@github-actions github-actions Bot added risk:normal Risk tier (docs/ci/risk-tiers.md) and removed risk:high Risk tier (docs/ci/risk-tiers.md) labels Oct 23, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-7wt10 created for this PR by the cmux coordinator.

teamleaderleo and others added 3 commits October 23, 2026 10:17
…nscript kinds, and a record's full name

Review (codex xhigh) at fcd4f27: a re-attach on the same connection left out
agentMode; mode_events missed current_mode_update when the attach's kinds were
transcript plus config_option_update (acpmux filters it out of transcript);
agent-session-mode refused a tab whose record holds the chat's full name.

The re-attach reads the mode as the first attach does. An attach with
mode_events subscribes to the mode record kinds its kinds leave out and keeps
them out of the client's page and stream. Mode facts are read for the record's
value (an id, or a full name acpmux lists for the resolved id) and keyed by it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16040-fd0b-7dd0-9487-1a3a198d9f5c&host=cosmic-gray
… their own PR

The adopt verb alone stays here; agent-session-mode, the attach reply's
agentMode and the mode_events pushes land in a PR stacked on this one, so
each stays under about 800 changed lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16040-fd0b-7dd0-9487-1a3a198d9f5c&host=cosmic-gray
An app that sees the capability sends mode_events and agent-session-mode,
which this PR does not serve yet; the stacked mode PR advertises it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16040-fd0b-7dd0-9487-1a3a198d9f5c&host=cosmic-gray
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex xhigh, correctness first): SHIP at d07af2f

No blocking findings.

Checked:

  • Exact parent-to-head diff and pinned source files.
  • Adopt routing, Unix/non-remote trust gate, host gate, tab ownership, and shared concurrency limits.
  • Own-session filtering for peer and Chief sessions; no acpmux startup path.
  • Capability references and identify non-advertisement.
  • is_chief sharing, conversation-tab restrictions, spec, and CLI coverage.
  • Read-only review; no builds or tests run.

Reviewer: Codex xhigh (acpmux session sr-rev-split-a-d07af2f), read-only, pinned to parent 949df892e507 and this head.

Fleet at this head d07af2f19224e9a0587bf34e6e09566529cd1f1c:

  • cmux-tui-rust-check.sh test agent_session, step e1622772763d28994173e3ff: green, 5 crates, 0 red, 0 flaky.
  • cmux-tui-rust-check.sh clippy, step 442e18207ec31958cc808149: green.
  • cmux-tui-rust-check.sh fmt, step ea5bd8237d9c87898c5a8b02: green.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Closing: feat-cmux-next now reaches this PR's goal another way, so this verb would land with nothing to call it.

#22871's goal was to show a chat running on another machine (cmux16, huge-blue) in this Mac's sidebar and open it. Base does that through acpmux peer mirroring, with the tab bound on this Mac:

  • cmux NEXT: agent.openSessionTab --host <peer> opens that machine's chat (as this Mac's acpmux mirrors it) #25027 (d62504b): agent.openSessionTab --host <peer> resolves the peer's chat to the session this Mac's acpmux mirrors, by id, qualified id or name, and binds the tab here. Its stated rule (AgentPeerSession.swift) is "A tab never binds to another machine's daemon (cx-k21v); it binds to the mirrored session on this Mac's acpmux, which forwards to the peer".
  • db98601 (Lawrence): every reachable machine's live chats are plain sidebar rows with a machine caption (RemoteMachinesSidebar.mergedRows). A click opens the mirrored lane (host?.open(lane)).

agent-session-adopt does the opposite: it binds the chat into a tab of the remote machine's own daemon. Its only consumer is the app half, #24556, and that path overlaps --host, which #25027 now gives to the mirror. Nothing on base and no other open PR sends agent-session-adopt. This PR alone does not advertise the capability. Landing it would add a risk:high socket verb with no consumer.

The is_chief share and the asks extraction were only refactors serving adopt, so nothing here needs to be kept. The stacked #24559 closes for the same reason.

Agent session: Air-Blue

This branch had an error being deployed

1 failed and 3 inactive deployments
ci-routing-agent — d07af2f1 Deployed Oct 23, 2026 by github-actions[bot] via cmux-next macOS placement #32053
sentry-dsyms — d07af2f1 Deployed Oct 23, 2026 by teamleaderleo via upload cmux-tui dSYMs to Sentry #46350
artifacts — d07af2f1 Deployed Oct 23, 2026 by teamleaderleo via publish to R2 #46350
cmux-tui-merge-tree — d07af2f1 Deployed Oct 23, 2026 by teamleaderleo via publish the merge tree #5222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold cmux-next batch queue: keep this PR out of the batch (docs/ci/cmux-next-batch.md) risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant