Skip to content

fix(next): prepare Cloud remote approvals before first chat - #31904

Merged
cmux-bot[bot] merged 3 commits into
feat-cmux-nextfrom
lane/cloud-approvals-prepare
Nov 2, 2026
Merged

cmux-bot[bot] merged 3 commits into
feat-cmux-nextfrom
lane/cloud-approvals-prepare

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

A fresh Cloud machine now prepares the app's person key before the first chat starts, so a tool permission Allow can be relayed immediately instead of being refused until the user finds Restart with approvals.

Leo asked for Cloud to work this way: "I want us to be able to do this too." Before this change, a fresh Cloud chat's first start had no prepare callback. The keyed agent-session handshake therefore fell through to an unkeyed start, and the daemon rejected the first relayed Allow.

The Cloud path now mirrors SSH: the remote daemon's safe-to-restart decision triggers one serialized keyed restart per machine, while older daemons use a bounded status read and restart only when idle. Busy machines, shared/team machines, and keyed-start failures quietly fall back to the existing unkeyed start and its normal restart notice.

The person key still travels only through the existing keyed-start request body stream to the provider's stdin. It is never placed in the image, cloud-init, environment, argv, or a file. Team machines are not retried and do not surface a new error card.

Tests cover an idle keyed start, a busy machine with no restart, and a not-single-owner failure that returns the unkeyed fallback. The app compile is green at the merged head. The Swift test compile also exposed a missing Foundation import in the new test fixture; follow-up PR #31976 carries that one-line fix.

agent-identity footer --repo manaflow-ai/cmux

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

blacksmith-sh Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Found 2 test failures on Blacksmith runners:

Failures

Test View Logs
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)/
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)
View Logs
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)/
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)
View Logs

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

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

web and size checks: green

Shipped in:

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol high, sweep, via the review router; full diff from merge base 947bb5e to this head): SHIP at dd44420

[P2] [follow-up] Packages/macOS/CmuxNext/Sources/CmuxNextApp/Cloud/CloudService+PersonKey.swift:68 - The classic /api/vm exec can run as root while the daemon lives under /home/cmux; $HOME/.cmux/bin/cmux-tui then fails, so idle Cloud approval preparation is skipped on those machines. Resolve the daemon user/home (with a root fallback) and run status through that path.

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 2, 2026 07:05 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 2, 2026 07:05 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 2, 2026 07:07 Inactive
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

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

The independent SHIP at dd44420 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 (17e33df476c5a019) 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 merged commit a799d97 into feat-cmux-next Nov 2, 2026
159 of 166 checks passed
@cmux-bot
cmux-bot Bot deleted the lane/cloud-approvals-prepare branch November 2, 2026 07:26
@lawrencecchen

Copy link
Copy Markdown
Contributor

The test file CloudApprovalsPrepareTests.swift from this PR uses UUID without import Foundation, so CmuxNextAppTests does not compile at the feat-cmux-next tip (CloudApprovalsPrepareTests.swift:18:47: error: cannot find 'UUID' in scope, tip watcher job af03529fb153139d9943b2e0). Fix: #31976 (adds the import, no other change).

Copy link
Copy Markdown
Collaborator Author

Brief 13 follow-up to this merged first-Cloud-turn approval work: source review found a client-side owner boundary after key preparation. AcpmuxRemotePersonKeys caches the verified person key by machine+daemon instance; AgentPaneTransport+RelayedAllow uses it to sign a clicked Allow. Cloud account teardown previously disconnected sessions without evicting that key, and restartWithApprovals could bind it after an awaited call even if the account had changed. The shared-team creator remains properly gated at key issuance by platform #512; the Mac signer needs its own lifecycle fence.

I opened draft cmux #34105: revoke cached key on CloudMachineSession.disconnect, epoch-fence async result binding, and add negative changed-account / old-epoch / disconnected-session regression tests. HQ brief-13 evidence and reproduction plan. Mac tests and live two-account Cloud walkthrough still required. The prior idle/busy fallback from this PR is unchanged; its three tests were inspected.

@lawrencecchen

Copy link
Copy Markdown
Contributor

Swift logic follow-up (tip watcher swift-logic row, STATUS 13027 "SWIFT LOGIC CULPRITS"; lead order).

This PR raised swift_logic_lines by +47 at its merge commit a799d97: scripts/cmux-next/swift-logic-lines.py before and after the merge, with the same table (the tip's, c6be943). The largest declarations of the rise:

  • extension CloudService in Packages/macOS/CmuxNext/Sources/CmuxNextApp/Cloud/CloudService+PersonKey.swift: +47 lines counted as Swift logic (its row counts it as logic)

plans/cmux-next/layer-ownership.md says Rust owns every state, list and rule and Swift is the platform shell. Please move the new logic of this PR in a follow-up: to Rust (the crate that owns the area; the owner lists in STATUS 12147-12165 name the target per area), or at least out of the app into its package. If a declaration above is platform code (AppKit, Core Animation, OS calls, strings, tokens, DEBUG tooling), reply here and the table gets a PLATFORM row with your reason instead.

The swift-logic row is a report, not a gate: nothing blocks on this comment.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — c74dff24 Deployed Nov 2, 2026 by teamleaderleo via wait for same-key tree publisher #99979
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.

2 participants