fix(agent-pane): show Cloud sign-in in signed-out picker

Merged
TE
6d ago
+355-19

Problem and fix

Defect, verbatim: "Signed out, the destination picker shows no Cloud machines and no sign-in row."

Dry-run runbook, verbatim: "The picker's "This Mac" section lists the Mac by its name ("Studio Mac") with no "This Mac" row text, and offers "SSH..." and "New Cloud Machine" but no existing Cloud machine when signed out, with no "Sign in for Cloud" row."

New Agent Chat now offers Sign in for Cloud in both the plain computer picker and the preview environment picker. The row runs Sign In (palette.auth.signIn) through its own connect kind, cloudSignIn, gated on the person's click like the other connect actions; it does not go through New Cloud Machine, which would create a machine once sign-in finished. Existing actions and This Mac naming stay intact; no Labs setting or default changes.

Root cause

The webview discarded cloudMachine.list's account state. The plain picker used by a fresh home also has its own action rows, separate from the preview environment picker. Both now consume the account state: an explicit signed-in reply hides the sign-in row; signed-out or unknown state offers it.

A refused revalidation previously retained the last account's signed-in state and machines. It now clears both snapshots. A signed-out reply also removes the old machines. The existing generation guard prevents an obsolete request from clearing newer state.

An independent review at 44c1712d found the row ran onConnect("cloud") (New Cloud Machine), which cannot sign in from this path. Both pickers now call onConnect("cloudSignIn"); CONNECT_ACTIONS.cloudSignIn maps to palette.auth.signIn, and the agent pane allows that action on a gesture (AgentPaneModel+Actions.swift).

A Cloud list read with no app bridge (native.not_connected: outside the app, or while the bridge reconnects) now leaves the list as it was. Only a read the app refused clears it.

Risk

Small, confined to picker account state and one added action. A failed Cloud list request now hides cached account machines and offers sign-in until a successful refresh. Successful signed-in replies retain the existing rows and actions. The existing menu refresh timer and its cleanup are unchanged.

Tests

  • Regression coverage for both picker variants, preserved actions, and the existing sign-in entry point.
  • Native-bridge regressions for signed-in → failed refresh and signed-in → signed-out reply: the old machine disappears and the sign-in row appears.
  • Remote red/green run at 44c1712d10700440373aee5860268e1177216ddc: restoring the original failed-read handler makes the new regression fail because build box remains listed; restoring the fix gives 16 passed, 0 failed across the picker test file. The signed-out and failed-refresh cases both remove the old machines and show sign-in.
  • prepush-gate.py and git diff --check pass.
  • Both pickers' sign-in rows call cloudSignIn, not cloud. CONNECT_ACTIONS.cloudSignIn is palette.auth.signIn, and AgentPaneConnectActionTests.cloudSignInRunsSignInOnAGesture checks that the agent pane runs it only on a gesture. The picker tests run with a signed-in account, so their action rows stay the same. Remote Linux run at 15915b07: 78 pass, 0 fail across environment-picker*.test.tsx; vp fmt --check, vp lint and vp check are clean.
  • Fleet fresh-home captures use no Labs flags. Base b4253e646d6 has no sign-in row; 5a8e7ea9a006a9ccbabb5d5c87412866728ddc51 shows it. The subsequent change only clears stale state after failed revalidation and adds regression coverage.

Changelog

Fixed: Cloud sign-in is available from the signed-out New Agent Chat destination picker.

Before / After

Fresh-home captures at 2x on a fleet Mac, cropped to the picker, with no Labs flags. Before is base 5587de5f; after is head 15915b07. On the current base the destination menu stays closed while a folder trust question is open, so both captures trust /tmp first.

AppearanceBeforeAfter
LightBefore: no Cloud sign-in rowAfter: Sign in for Cloud
DarkBefore: no Cloud sign-in rowAfter: Sign in for Cloud

Viewed after image: yes
Visual verdict: One plain "Sign in for Cloud" row sits between Add a computer… and New Cloud Machine… in the existing menu style, with no new chrome, and fits on screen in light and dark.

Agent session: agent session (original)

Agent session: agent session