Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ import { InferenceProviderAccounts } from "./InferenceProviderAccounts";
import { serverEnvironment } from "../../state/server";

const host = EnvironmentId.make("account-host");
const workAccountName = "codex-work@example.com.json";
function setup() {
state.run.mockReset();
state.query.mockReset().mockReturnValue({
data: {
enabled: true,
accounts: [
{
name: "work.json",
name: workAccountName,
provider: "codex",
status: "error",
availability: "rateLimited",
Expand Down Expand Up @@ -55,13 +56,19 @@ describe("inference provider accounts", () => {
await using screen = await render(
<InferenceProviderAccounts environmentId={host} driver="codex" />,
);
await expect.element(screen.getByText("work.json")).toBeVisible();
const accountNames = screen.getByRole("button", { name: "Toggle account name visibility" });
expect(accountNames.all()).toHaveLength(2);
const workAccount = accountNames.first();
await expect.element(screen.getByText(workAccountName)).not.toBeInTheDocument();
await userEvent.click(workAccount);
await expect.element(screen.getByText(workAccountName)).toBeVisible();
await userEvent.click(workAccount);
await expect.element(screen.getByText(workAccountName)).not.toBeInTheDocument();
await expect.element(screen.getByText("codex · Rate limited")).toBeVisible();
await expect
.element(screen.getByText("codex · Authentication or access rejected"))
.toBeVisible();
await expect.element(screen.getByText(/Retry after/)).toBeVisible();
await expect.element(screen.getByText("personal.json")).not.toBeInTheDocument();
await userEvent.click(screen.getByRole("button", { name: "Codex", exact: true }));
expect(state.run).toHaveBeenLastCalledWith({
environmentId: host,
Expand Down
11 changes: 10 additions & 1 deletion apps/web/src/components/settings/InferenceProviderAccounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useEnvironmentQuery } from "../../state/query";
import { useAtomCommand } from "../../state/use-atom-command";
import { Button } from "../ui/button";
import { Input } from "../ui/input";
import { RedactedSensitiveText } from "./RedactedSensitiveText";
import { SettingsRow } from "./settingsLayout";

const { inferenceProxy } = serverEnvironment;
Expand Down Expand Up @@ -112,7 +113,15 @@ export function InferenceProviderAccounts({
return (
<SettingsRow
key={account.name}
title={account.name}
title={
<RedactedSensitiveText
value={account.name}
ariaLabel="Toggle account name visibility"
revealTooltip="Click to reveal account name"
hideTooltip="Click to hide account name"
className="max-w-full wrap-anywhere text-left"
/>
}
description={`${account.provider} · ${inferenceAccountStatus(account)}`}
status={
retryAfter ? (
Expand Down
Loading