Skip to content

Cloud: a Codex chat's start runs the Mac's broker before the first prompt - #33881

Merged
teamleaderleo merged 4 commits into
feat-cmux-nextfrom
fix-codex-cloud-first-chat
Nov 3, 2026
Merged

teamleaderleo merged 4 commits into
feat-cmux-nextfrom
fix-codex-cloud-first-chat

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #33489.

When a chat starts, the credential transfer skips Codex, and failed-turn recovery only knows about Claude. So the first Codex prompt on a Cloud machine fails until the person goes through the turn card's broker login.

What changed

  • Rules (Rust, cmux-cloud-start-core harness_login): a Codex start no longer stops at no-transfer-for-harness. It goes through the same checks as Claude's (build gate, signed in, the caller owns the machine, the none choice) on an owner guest only: a team guest keeps its team login, since acpmux's Codex bridge refuses broker access there) and answers install (codex-broker). It reads no Claude login probe and asks no confirm of its own: the broker shows its own device-code sign-in (with Cancel and its scope disclosure) only when the Mac holds no Codex login for this account, and otherwise delivers short-lived access silently. Release keeps Codex out, as the Account wizard already does (the broker is DEV and dogfood only; the Release consent covers the Claude login alone). --login machine keeps the machine's own sign-in, and a run that can show no prompt passes nothing rather than refusing the start.
  • App (thin forwarding): CloudStartChat.passHarnessLogin reads the guest kind for Codex too, skips the Claude-only machine login probe for it, and forwards the install to CloudCodexBrokerAdapter.run (the same call the turn card's recovery and the Account wizard make). CloudHarnessLoginDecision.Reason gains codex-broker. A machine the broker already serves for this account is left alone (CloudCodexBrokerAdapter.delivers), so a failed repeat transfer can never revoke the access its other Codex chats use. cmux cloud start-session passes no device-code prompt: a scripted run never waits on one, and with no broker login on the Mac it opens the session as before. CmuxNextApp lines: -1.
  • Test: a_codex_start_runs_the_broker_before_the_first_prompt fails on base (Codex was skip (no-transfer-for-harness)) and passes here; the existing tests that pinned the old Codex skip are updated.

Automatic failed-turn recovery for Codex (the turn card's silent path, which stays Claude-only) is not changed here: with the start delivering access, the first prompt no longer needs it.

Overlap: #30171 (capture-only integration PR) touches CloudStartChat+Login.swift; nothing here conflicts with its intent. The quit/update revoke path (#33482) is not touched.

Risk: low-medium. DEV and dogfood builds only; a Codex start on the person's own machine may now show the broker's device-code dialog before the chat opens when the Mac has no Codex login yet (Cancel opens the chat as before). Release is unchanged.

Agent session: agent session

🤖 Generated with Claude Code


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


Summary by cubic

Fixes #33489: a Codex chat's start now runs the Mac's broker before the first prompt, so the first Codex prompt on a Cloud machine no longer fails when no login has been transferred.

  • The harness login rules now let a Codex start through the same checks as Claude's and return install (codex-broker), with no Claude login probe and no extra confirm.
  • The app forwards the install to the broker adapter; a run that may show no prompt passes nothing instead of refusing, and Release builds keep Codex out.

Written for commit 1da462b. Summary will update on new commits.

View guided diff Turn on auto-fix

…ompt

A cloud.startChat start passed a login only for Claude: Codex was skipped
as no-transfer-for-harness, so the first Codex prompt on a Cloud machine
failed until the turn card's broker sign-in (cmux#33489).

The harness login rules (cmux-cloud-start-core) now let a Codex start
through the same checks as Claude's (gate, signed in, the caller owns the
machine, an owner or team guest) and answer install (codex-broker), with
no Claude login probe and no confirm of their own: the broker shows its
device-code sign-in, with Cancel, only when the Mac holds no Codex login
for the account. Release keeps Codex out (the broker is DEV and dogfood
only); a run that may show no prompt passes nothing instead of refusing.
The app forwards the install to CloudCodexBrokerAdapter.run.

Fixes #33489

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

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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

Review 83d15fb: 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=pr33881 -f ref=fix-codex-cloud-first-chat -f platform=macos -f backend_mode=local

red: cmux-next checks (god files, concurrency, crash safety, l10n); no finished base run on 33dc4e8 to compare; do not merge until green; see lane-rules

Shipped in:

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@blacksmith-sh

blacksmith-sh Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Found 8 test failures on Blacksmith runners:

Failures

Test View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='pull_request', path='
skills/cmux-customization/SKILL.md')
View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='pull_request', path='
skills/cmux-customization/references/examples.md')
View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='pull_request', path='
skills/cmux-customization/references/local-app-views.md')
View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='pull_request', path='
skills/cmux-customization/references/viewer-types.md')
View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='push', path='skills/
cmux-customization/SKILL.md')
View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='push', path='skills/
cmux-customization/references/examples.md')
View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='push', path='skills/
cmux-customization/references/local-app-views.md')
View Logs
test_the_workflow_runs_for_every_included_file_outside_cmux_tui (main.Scope.test_th
e_workflow_runs_for_every_included_file_outside_cmux_tui) (event='push', path='skills/
cmux-customization/references/viewer-types.md')
View Logs

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

@github-actions github-actions Bot added the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol xhigh, router-review): BLOCK at 5bb7a89

BLOCK at 5bb7a89
Visual verdict: no images; Leo tries the build

  1. [P1] [blocking] harness_login.rs:339: let choice = choice(d) at line 319 shadows the function with an Option<Choice>. Calling choice(d) here and at line 341 produces Rust error E0618, preventing the crate and its tests from compiling. Use the existing choice value in both places.

  2. [P2] [follow-up] CloudStartChat+Login.swift:57: Supply an after screenshot of the device-code dialog during chat start; none was available to assess the newly introduced presentation path.

@teamleaderleo teamleaderleo removed the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
…orce (E0618 fix)

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

cursor Bot commented Nov 3, 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.

@github-actions github-actions Bot added the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol xhigh, router-review): BLOCK at 1da462b

BLOCK at 1da462b
Visual verdict: no images; Leo tries the build

  1. [P1] [blocking] harness_login.rs:335 — Keep Codex broker installation off team guests. A team machine’s creator passes the ownership check, and the broker’s capability check permits delivery. However, codex_auth_file.rs:95 requires an owner guest and no /srv/team. Installing access.json therefore makes the Codex bridge fail closed, breaking chats that previously worked through the team login. Require an owner guest before installation and cover this with the guest reader.

  2. [P2] [follow-up] CloudStartChat+Login.swift:55 — Forward the caller’s headless context. CloudStartSession uses this method, but the Swift decision request never sends headless, so Rust always sees false. A CLI Codex start without a broker login now waits on the native device-code dialog; the tested headless skip is unreachable through the app.

  3. [P2] [follow-up] CloudStartChat+Login.swift:57 — Supply an after screenshot of the device-code dialog during the first Codex start; this newly automatic presentation has no visual evidence.

@teamleaderleo teamleaderleo removed the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
acpmux's Codex bridge refuses broker access on a team guest, so a team
machine keeps its team login (review at 1da462b).

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

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol xhigh, router-review): BLOCK at a2c678e

BLOCK at a2c678e

Visual verdict: no images; Leo tries the build

  1. [P1] [blocking] CloudStartChat+Login.swift:55: Preserve existing broker access when another chat starts. This automatic call repeats the transfer even when other Codex chats already use it. A transient capability or delivery failure invokes the adapter’s revokeAfterFailure, deleting the existing access file and stopping renewal. Existing chats then fail with “Codex broker unavailable.” Cleanup for a failed new start must preserve previously working access.

  2. [P1] [blocking] CloudStartChat+Login.swift:57: Forward the caller’s headless status before enabling this prompt. CloudStartSession also calls this method, but the Swift decision request never serializes headless, so Rust always defaults it to false. A scripted Codex start on an already signed-in VM can now wait indefinitely for a Mac device-code dialog when the broker lacks credentials; base opened the session directly. Wire prompt availability through to the Rust guard.

  3. [P2] [follow-up] CloudStartChat+Login.swift:57: Add a native capture of the newly triggered start-time device-code dialog, including Cancel.

Rust and Swift tests were not run because neither toolchain is installed.

@teamleaderleo teamleaderleo removed the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
@github-actions github-actions Bot added the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
…and a scripted start never waits on a device code

A failed repeat transfer would revoke the access the machine's other Codex
chats use, so a start on a machine the broker already delivers to keeps it
(CloudCodexBrokerAdapter.delivers). cmux cloud start-session passes no
device-code prompt: with no broker login on the Mac it opens the session as
before (review at a2c678e).

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

Copy link
Copy Markdown
Collaborator Author

Review (codex, router-review): SHIP at 83d15fb

Reviewer: codex gpt-6-astra high, fast tier.

Follow-ups: 2. Each lands as an issue in this repo that links this receipt; the lane that opened the PR fixes it forward.

SHIP at 83d15fb
Visual verdict: no images; Leo tries the build

  1. [P2] [follow-up] Packages/macOS/CmuxNext/Sources/CmuxNextCloud/Broker/CloudCodexBrokerAdapter.swift:118: Registration does not establish completed delivery. transfer registers the machine before requesting access, including while device-code sign-in is pending. A concurrent chat therefore skips the broker and sends its first prompt without credentials. Await the existing transfer and distinguish pending registration from successful delivery; cover concurrent starts on the same machine.

  2. [P2] [follow-up] Packages/macOS/CmuxNext/Sources/CmuxNextApp/Cloud/CloudStartChat+Login.swift:58: No after images cover the newly triggered device-code dialog. Verify its presentation and Cancel behavior in the build.

Follow-ups:

  • Make concurrent starts await completed credential delivery.
  • Visually verify the start-time device-code dialog.

@teamleaderleo teamleaderleo removed the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
@github-actions github-actions Bot added the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
@teamleaderleo
teamleaderleo merged commit 10a3380 into feat-cmux-next Nov 3, 2026
158 of 168 checks passed
@teamleaderleo
teamleaderleo deleted the fix-codex-cloud-first-chat branch November 3, 2026 13:58

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 83d15fbc Deployed Nov 3, 2026 by teamleaderleo via wait for same-key tree publisher #106333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant