Cloud agent sign-in dialog rework, gateway credentials brokered on the right host
Links
- Audit page (before/after, theirs vs ours, measurements): https://app.superset.sh/page/cloud-agent-sign-in-dialog-audit-wx4hcr
Summary
- Rework the cloud agent sign-in dialog (Settings › Agents): fixed header rows with a divided body so nothing nudges on method change, whole-card selection, masked stored credential with a pencil to replace it, ⋮ → confirm → toast for disconnect, reveal toggle on every secret field, Spinner in Save, all errors as toasts, accessible names and states, honest token copy.
- Broker agent credentials on the host the CLI actually calls. The sandbox firewall only swapped headers for
api.anthropic.com/api.openai.com, so Vercel AI Gateway (or any custom base URL) got the placeholder and a 401. Gateway defaults now follow Vercel's per-agent docs. - Replace the native
confirm()on environment variable deletion with our AlertDialog.
Why / Context
Two reported problems in the dialog: everything shifted slightly when switching Subscription / API key / Custom provider, and clicking a card did not select it. The audit found the rest: mismatched row heights (42/46/50 px), unlabeled inputs, disclosures without aria-expanded, default focus outlines, a "Sign in with your Claude account" sentence with no such flow, and Sign out / Remove with no confirmation. The structure now follows the reference dialog Satya shared.
While testing, saving a Vercel AI Gateway key succeeded but could never work in a box: the header rule was keyed on the provider's own host, and our default base URL (…/v1) did not match what Claude Code (/claude-code, bearer via ANTHROPIC_AUTH_TOKEN) and Codex (/codex/v1) expect.
How It Works
deriveSandboxCredentialskeys each provider's rule onnew URL(baseUrl).hostname, falling back to the provider host. A gateway key for Claude becomes a bearer rule plus theANTHROPIC_AUTH_TOKENplaceholder, and noANTHROPIC_API_KEYreaches the box (Claude Code would prefer it).agentCredentialToEnvis provider-aware;gatewayBaseUrl(agent)in@superset/sharedis the single source for the per-agent gateway endpoint, used by the API default, the validation probe (/v1/creditsfrom the gateway origin) and the dialog's Base URL field.- Dialog:
optionRowClass/optionBodyClassgive every card the same 58 px header and a bordered body; the Label spans the row so any click checks the radio. Helpers (SavedSecret,DisconnectMenu,SecretField,SaveButton, …) live inCloudAuthDialog/components/. - The row button's label follows stored state only (it used to track the dialog's unsaved radio).
Manual QA Checklist
Driven over CDP in the running dev app, both themes, screenshots on the page.
- Switching Subscription ↔ API key moves the title, Subscription row, Custom row and dialog by ≤0.3 px; only the selected card grows (76 px)
- Clicking card padding, middle or label selects the radio; arrow keys move selection; every Tab stop shows a ring
- Advanced and the gateway row toggle
aria-expanded; Base URL label bound to its input; Token / API key inputs have names - ⋮ → Disconnect → confirm dialog → Cancel leaves the credential
- Bogus API key → "OpenAI rejected this API key." toast; bogus gateway key → "Vercel AI Gateway rejected this key." toast; nothing stored, Spinner shown while in flight
- Gateway Base URL default reads
/claude-codefor Claude Code and/codex/v1for Codex - Environment variable ⋯ → Delete opens our AlertDialog; Cancel keeps the row; no console errors
- Not verified: a real gateway call from a cloud box (no gateway key at hand), a successful Save, the disconnect toast end to end (would delete the only dev credential)
Testing
bun run typecheck --filter=@superset/desktop --filter=@superset/trpc --filter=@superset/sharedbun run lintbun run check:i18n(10 new messages translated into all 16 locales)bun test packages/trpc/src/lib/sandbox/credentials.test.ts(2 new cases: gateway bearer rule on the gateway host, custom base URL moves the OpenAI rule)bun test packages/shared/src/agent-credentials.test.ts(new)
Design Decisions
- No eye on the stored value: the API never returns a stored secret (
agentCredential.listselects agent/kind/provider/label), so there is nothing to reveal; the pencil swaps in the paste flow instead. - Errors always toast, including the custom-provider form where the reference shows inline text.
- Rules keyed on the base URL host rather than a gateway allowlist: fixes every custom endpoint, not only Vercel.
Known Limitations
- Codex subscription still cannot be saved ("codex cannot be signed in this way yet").
CODEX_ACCESS_TOKENtakes a personal access token, notcodex logintokens; tracked in the sandbox-tagged workspace "Wire Codex subscription (personal access token) for cloud workspaces", which depends on the host-keyed rules here.
Risks / Rollout
- Risk: the firewall rule change touches every cloud box's credential brokering. Default hosts are unchanged when no base URL is set, covered by the existing tests.
- Rollback: revert the first commit (
fix(sandbox)) independently; the dialog commits do not depend on it except for the gateway default text.
Summary by cubic
Reworks the cloud agent sign-in dialog and fixes credential brokering so gateway and custom-endpoint keys reach cloud boxes instead of the placeholder followed by a 401.
Behavior changes
- Dialog now has fixed header rows, whole-card selection, masked stored credentials with a pencil to replace, disconnect behind a confirm dialog with a toast, reveal toggles on every secret field, a Spinner in Save, and all errors as toasts.
- Credential broker rules are keyed on the base URL's hostname instead of only provider hosts, so Vercel AI Gateway and custom endpoints get real credentials. Gateway defaults match Vercel's per-agent docs:
/claude-codewithANTHROPIC_AUTH_TOKEN,/codex/v1. - Environment variable deletion in Settings now confirms via our AlertDialog instead of the native
confirm().
Summary by CodeRabbit
- New Features
- Agent credential settings now show connection status more clearly and let you replace saved credentials, reveal secret values, and edit gateway base URLs under Advanced options.
- Disconnecting a credential includes a confirmation step and explains when workspaces need to restart for the change to take effect.
- Deleting an environment secret now uses an in-app confirmation dialog that explains its effect on workspaces.
- Custom gateway credentials can use configured base URLs when connecting to supported agents.