Skip to content

fix(web): Run on cloud row shows connect progress and failure instead of hanging - #378

Merged
johnnyelwailer merged 7 commits into
mainfrom
fix/run-on-cloud-row-connecting-feedback
Oct 9, 2026
Merged

johnnyelwailer merged 7 commits into
mainfrom
fix/run-on-cloud-row-connecting-feedback

Conversation

@johnnyelwailer

Copy link
Copy Markdown
Owner

Clicking a ready cloud machine in "Run on" left the row on "Connecting…" with no sign of life. If the connect failed (e.g. the token lacked `relay:write`), only a toast appeared and the row never left that state.

Fix — the connect failure now reaches the row:

  • `useCloudSessionConnect` records why a connect ended without connecting (register failure, session no longer ready, still starting, machine not visible yet) and the controller hands it to the selector.
  • The selector stops waiting on that failure and the row shows `Couldn't connect: Click to retry.`
  • While connecting the row shows `Connecting… 12s`, adds "taking longer than usual" after 20s, and has a Cancel button.

Scope: no change to relay scope minting, auth, or server-side session start.

Tests: 4 new cases in `t3team-BranchToolbarEnvironmentSelector.test.tsx` (elapsed ticks, failure leaves Connecting and retries, foreign-session failure ignored, cancel). 23 files / 142 tests pass across `src/cloud`, `src/components/cloud` and the selector; `tsc --noEmit` clean; t3team additive guard passes.

🤖 Generated with Claude Code

… of hanging

Clicking a ready cloud machine left the row on "Connecting…" until the
environment registered. A failed or dropped connect only raised a toast, so the
row never left that state. The row now counts elapsed seconds, flags a slow
connect, offers Cancel, and shows the real connect error with a retry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for de3efc8.

This comment will update automatically after the next completed run.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab7bd1a797

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// The connect itself failed (the toast says so too): stop waiting and say why on the row.
const handledConnectFailure = useRef(cloudSessionConnectFailure);
useEffect(() => {
if (selectWhenConnected === null || !cloudSessionConnectFailure) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve feedback for sessions without environment IDs

When a ready t3_connect session omits environmentId—which the contract explicitly permits for older servers and providers—the click handler never sets selectWhenConnected, so this guard discards the controller's new failure and the progress/cancel UI never activates. resolveCloudSessionEnvironment can still resolve and register these sessions through relay discovery, leaving affected users with the original toast-only behavior and an immediately re-clickable row. Track the attempt by sessionId and separately retain the resolved target environment rather than requiring the session field.

AGENTS.md reference: AGENTS.md:L51-L56

Useful? React with 👍 / 👎.

Comment on lines +385 to +388
connectError={
connectFailure?.sessionId === row.session.sessionId
? connectFailure.message
: null

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add Storybook coverage for the new connect states

This adds user-visible connecting, slow, cancel, failure, and retry states, but the existing t3team-BranchToolbarEnvironmentSelector.stories.tsx still covers only unchanged, create, and provisioning variants. The repository requires every changed public UI state to update its stories in the same change, including error/retry and loading states, so these states currently ship without the required interactive Storybook coverage.

AGENTS.md reference: AGENTS.md:L104-L108

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T11:05:46.017251Z ab7bd1a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

relay:write is admin-only because starting a cloud session spends compute; a
standard paired session holds relay:read only, so the create always failed
after being offered. The cloud controller now reports unavailable (and refuses
onCreate) without the scope, which hides the Run on cloud entries and the
welcome panel. Scopes are read the way Settings reads canManageRelay.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@johnnyelwailer

Copy link
Copy Markdown
Owner Author

Review note from the cloud-session work (fork #376/#377):

  1. fix(cloud): the next session in a workspace is reachable and selectable; New thread survives an ended machine #377 is merged (6d0f222) and already fixes the stuck Connecting… row differently: one 60 s deadline per click (CONNECT_AND_SYNC_DEADLINE_MS) that then refuses or re-enables the row; a fresh machine's project sync is awaited; attach follows a workspace's live session by environmentId (the ended-session 409 / endless reconnecting bug); New thread skips projects on dead environments. This PR now conflicts on the same files. Please rebase on main and keep what fix(cloud): the next session in a workspace is reachable and selectable; New thread survives an ended machine #377 lacks: the real connect failure shown in the row (+ retry), elapsed seconds, Cancel. Drop the separate stuck-state logic in favour of the merged deadline.
  2. The scope gate is incomplete. relay:write gates create/cancel (RpcAuthorization.ts:114-115) and connect: /api/t3team/cloud-broker/attach and /pairing are AuthRelayWriteScope (t3team-cloud-broker-routes.ts). A relay:read-only client that lists machines would offer a Connect that fails the same way. Gate the whole cloud section for such clients and say why in one line rather than hiding it silently.
  3. The dev test-drive that hit the error was paired with a standard token. Testing cloud sessions there needs the dev server's startup pairing URL (admin scopes), not a pair-minted one.

🤖 Generated with Claude Code

@johnnyelwailer

Copy link
Copy Markdown
Owner Author

Update: PJ decided a minted pairing link gets the same cloud capabilities as the desktop app — #379 moves relay:write into the standard client scopes. So the scope gate in this PR is no longer needed; please drop it when rebasing and keep only the row feedback (real error + retry, elapsed, Cancel). The dev test-drive needs one re-pair after #379 lands (old pairings keep their old scopes).

Phil J and others added 5 commits October 9, 2026 14:27
…int passes

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Conflicts resolved keeping both sides: main's useCloudSessionCreate hook now carries the relay:write gate; the Run on cloud row keeps connect progress/failure feedback.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@johnnyelwailer
johnnyelwailer merged commit 7344ff1 into main Oct 9, 2026
31 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant