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
11 changes: 11 additions & 0 deletions .claude/skills/openbot-data-access/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,17 @@ factories already hold.
being signed in is an answer there rather than a failure.
- **The server returns no `error` field**: `client` falls back to the `fallback` option. Name the
entity in it ("Learning settings could not be loaded."). Do not print a status code to a person.
- **A screen's own load-failure sentence**: pass it through `loadFailure(query.error, "Couldn't load
your …")` (`lib/load-failure.ts`). A 503 that carries the server's sentence and a `Retry-After`
("OpenBot is moving this organization. Try again in a moment.") is shown in its words, drawn as
muted text and never in the destructive red (a move isn't a failure), and the query client asks the
read again once by itself after that long. A place that wraps the sentence in a red box or border
draws that calm too when `unavailableSaid(error)` says so. Any other failure, a 503 without
`Retry-After` included, keeps the screen's sentence.
- **A refusal that may mean the person left the organization** (404 `ORGANIZATION_NOT_FOUND`, or a 403
with no code): handled once for the whole app. The query client reads their organizations again, and
when the one they work in is gone the app moves them to another with a notice
(`lib/organizations/left.ts`). A screen adds nothing for it.
- **A refusal arrives as a thrown `Error` instead of a value**: the call site used `client` where it
needed `tryClient`. The gateway declining is the product working, not a fault.
- **The server rejects a body it should accept, or reads it as a string**: something stringified
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ jobs:
--volume "$(command -v bun):/usr/local/bin/bun:ro" \
--env OPENBOT_APP_BROWSER=1 --env OPENBOT_APP_ENGINES=chromium,webkit \
"$PLAYWRIGHT_IMAGE" \
bun test app/tests/chunk-recovery.test.tsx app/tests/composer-dictation-language.test.tsx app/tests/sidebar-zoom-drag.test.tsx app/tests/service-terms.test.tsx app/tests/move-to-cloud-settings.test.tsx app/tests/moved-elsewhere.test.tsx app/tests/home-no-answer.test.tsx app/tests/section-strip-routines.test.tsx app/tests/organization-members-remove.test.tsx app/tests/settings-tool-cards-admin-layout.test.tsx app/tests/settings-tool-cards-personal.test.tsx app/tests/settings-tool-cards-core.test.tsx app/tests/one-press-connect-layout.test.tsx app/tests/admin-notion-one-press-layout.test.tsx app/tests/team-connections-directory-layout.test.tsx app/tests/conversation-switch.test.tsx app/tests/member-rows-long-names.test.tsx app/tests/people-lists.test.tsx
bun test app/tests/chunk-recovery.test.tsx app/tests/composer-dictation-language.test.tsx app/tests/sidebar-zoom-drag.test.tsx app/tests/service-terms.test.tsx app/tests/move-to-cloud-settings.test.tsx app/tests/moved-elsewhere.test.tsx app/tests/home-no-answer.test.tsx app/tests/section-strip-routines.test.tsx app/tests/organization-members-remove.test.tsx app/tests/settings-tool-cards-admin-layout.test.tsx app/tests/settings-tool-cards-personal.test.tsx app/tests/settings-tool-cards-core.test.tsx app/tests/one-press-connect-layout.test.tsx app/tests/admin-notion-one-press-layout.test.tsx app/tests/team-connections-directory-layout.test.tsx app/tests/conversation-switch.test.tsx app/tests/member-rows-long-names.test.tsx app/tests/people-lists.test.tsx app/tests/organization-moving.test.tsx app/tests/organization-removed.test.tsx app/tests/organization-held-reload.test.tsx app/tests/organization-unavailable-pages.test.tsx
# Connect your AI's sign-in code, copied with one press and read back from WebKit's clipboard.
# Only that test: the rest of the file runs in Chromium in the job above.
- run: |
Expand Down
8 changes: 6 additions & 2 deletions app/src/components/admin/controls/capabilities-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import type {
CapabilitySetting,
EnterpriseOverview,
} from "@/lib/enterprise/queries";
import { loadFailure, failureSaid } from "@/lib/load-failure";
import { MISSING_TEAM } from "@/lib/teams/names";
import { teamListQueryOptions } from "@/lib/teams/queries";
import { queryClient } from "@/query-client";
Expand Down Expand Up @@ -285,7 +286,10 @@ function OverridesDialog({
</Select>
{teams.error ? (
<p className="text-destructive text-sm" role="alert">
Couldn't load teams. Try again in a moment.
{loadFailure(
teams.error,
"Couldn't load teams. Try again in a moment.",
)}
</p>
) : null}
<p className="text-muted-foreground text-xs">
Expand Down Expand Up @@ -349,7 +353,7 @@ function OverridesDialog({
: null}
{setCapability.error ? (
<p className="text-destructive text-sm" role="alert">
{setCapability.error.message}
{failureSaid(setCapability.error)}
</p>
) : null}
</DialogBody>
Expand Down
8 changes: 6 additions & 2 deletions app/src/components/admin/controls/computer-sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
type NetworkPolicy,
type NetworkScopeKind,
} from "@/lib/enterprise/queries";
import { loadFailure, failureSaid } from "@/lib/load-failure";
import { MISSING_TEAM, teamName } from "@/lib/teams/names";
import { type TeamSummary, teamListQueryOptions } from "@/lib/teams/queries";
import { queryClient } from "@/query-client";
Expand Down Expand Up @@ -266,7 +267,10 @@ function NetworkPolicies({ data }: { data: EnterpriseOverview }) {
</PageRows>
{teams.error ? (
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load teams. Try again in a moment.
{loadFailure(
teams.error,
"Couldn't load teams. Try again in a moment.",
)}
</p>
) : null}
{known.some(
Expand Down Expand Up @@ -315,7 +319,7 @@ function SweepNow() {
) : null}
{sweep.error ? (
<span className="text-destructive text-sm" role="alert">
{sweep.error.message}
{failureSaid(sweep.error)}
</span>
) : null}
</div>
Expand Down
6 changes: 5 additions & 1 deletion app/src/components/admin/controls/controls-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
type EnterpriseSettings,
enterpriseOverviewQueryOptions,
} from "@/lib/enterprise/queries";
import { loadFailure } from "@/lib/load-failure";
import { queryClient } from "@/query-client";

/** What a section of the admin's controls reads and changes. */
Expand Down Expand Up @@ -82,7 +83,10 @@ export function ControlsSection({
return (
<PageSection title={title}>
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load these settings. Try again in a moment.
{loadFailure(
overview.error,
"Couldn't load these settings. Try again in a moment.",
)}
</p>
</PageSection>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import type {
import { MISSING_TEAM, teamName } from "@/lib/teams/names";
import type { TeamSummary } from "@/lib/teams/queries";
import { cn } from "@/lib/utils";
import { failureSaid } from "@/lib/load-failure";

/** The organization's teams, by which a change's or an answer's team id is given its name. */
type Teams = readonly Pick<TeamSummary, "id" | "name">[];
Expand Down Expand Up @@ -274,7 +275,7 @@ export function PermissionsPreview({
<Field>
<FieldLabel>Who it changes</FieldLabel>
<p className="text-destructive text-sm" role="alert">
{preview.error.message}
{failureSaid(preview.error)}
</p>
</Field>
);
Expand Down
33 changes: 25 additions & 8 deletions app/src/components/admin/controls/model-sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
enterpriseOverviewQueryOptions,
modelUsageQueryOptions,
} from "@/lib/enterprise/queries";
import { loadFailure, failureSaid } from "@/lib/load-failure";
import { markFor } from "@/lib/marks";
import { effortLabel } from "@/lib/models/effort";
import { modelLabel, modelNamer } from "@/lib/models/names";
Expand Down Expand Up @@ -127,7 +128,10 @@ export function ProviderSection() {
>
{connection.error ? (
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load the AI connection. Try again in a moment.
{loadFailure(
connection.error,
"Couldn't load the AI connection. Try again in a moment.",
)}
</p>
) : connection.data === null ? (
// An OpenBot older than the AI connection: what the model listing says serves it.
Expand Down Expand Up @@ -248,7 +252,10 @@ function CatalogueProviderRow() {
if (available.error)
return (
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load the provider. Try again in a moment.
{loadFailure(
available.error,
"Couldn't load the provider. Try again in a moment.",
)}
</p>
);
return <ProviderRow listing={available.data} />;
Expand Down Expand Up @@ -344,7 +351,7 @@ export function ModelChoiceSection() {
allowed={
allowlist && allowlistNarrows(allowlist) ? allowlist.models : null
}
failed={overview.error !== null}
failed={overview.error}
/>
);
// Open unless an admin narrowed it: one person, or a team whose allowlist narrows nothing.
Expand Down Expand Up @@ -373,7 +380,10 @@ export function ModelChoiceSection() {
>
{overview.error ? (
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load these settings. Try again in a moment.
{loadFailure(
overview.error,
"Couldn't load these settings. Try again in a moment.",
)}
</p>
) : (
<PageRows>
Expand Down Expand Up @@ -415,7 +425,8 @@ function OwnModelsChoice({
}: {
/** The models an admin allowed, when the allowlist narrows anything. Null while it is open. */
allowed: readonly string[] | null;
failed: boolean;
/** Why the settings couldn't be read, or null when they were. */
failed: unknown;
}) {
return (
<PageSection
Expand All @@ -428,7 +439,10 @@ function OwnModelsChoice({
>
{failed ? (
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load these settings. Try again in a moment.
{loadFailure(
failed,
"Couldn't load these settings. Try again in a moment.",
)}
</p>
) : (
<PageRows>
Expand Down Expand Up @@ -720,7 +734,7 @@ export function AllowedModelsDialog({
</p>
) : available.isPending ? null : available.error ? (
<p className="text-destructive text-sm" role="alert">
{available.error.message}
{failureSaid(available.error)}
</p>
) : !available.data.listed ? (
<p className="text-muted-foreground text-sm">
Expand Down Expand Up @@ -889,7 +903,10 @@ export function ModelUsageSection({ team }: { team: boolean }) {
>
{usage.isPending ? null : usage.error ? (
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load model usage. Try again in a moment.
{loadFailure(
usage.error,
"Couldn't load model usage. Try again in a moment.",
)}
</p>
) : usage.data.summary.length === 0 ? (
<PageEmpty icon={IconChartBar} title="No recent runs">
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/admin/controls/network-describe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
type NetworkReplayReport,
networkReplayQueryOptions,
} from "@/lib/enterprise/queries";
import { failureSaid } from "@/lib/load-failure";

/** What came back for one description, kept beside the words it came from. */
export type WrittenAllowlist = NetworkAllowlistTranslation & { text: string };
Expand Down Expand Up @@ -138,7 +139,7 @@ export function AllowlistPreview({
<FieldLabel id="network-preview">On recent page visits</FieldLabel>
{preview.error ? (
<p className="text-destructive text-sm" role="alert">
{preview.error.message}
{failureSaid(preview.error)}
</p>
) : (
<ReplayAnswer report={preview.data} />
Expand Down
19 changes: 10 additions & 9 deletions app/src/components/admin/controls/people-learning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IconUserCheck,
} from "@tabler/icons-react";
import { useMutation, useQuery } from "@tanstack/react-query";
import { Fragment, useState } from "react";
import { Fragment, type ReactNode, useState } from "react";
import {
PageEmpty,
PageRows,
Expand Down Expand Up @@ -47,6 +47,7 @@ import {
sharingRequestsQueryOptions,
} from "@/lib/learning/queries";
import { queryClient } from "@/query-client";
import { failureSaid } from "@/lib/load-failure";

const CHOICES: {
value: LearningPersonalReview;
Expand All @@ -68,7 +69,7 @@ const CHOICES: {
];

/** What a section says when the settings it depends on did not load. */
function SettingsError({ message }: { message?: string }) {
function SettingsError({ message }: { message?: ReactNode }) {
return (
<p className="mt-4 text-destructive text-sm" role="alert">
{message ?? "Couldn't load Learning settings. Try again in a moment."}
Expand All @@ -86,7 +87,7 @@ export function WhoApprovesSection() {
if (settings.error || !settings.data)
return (
<PageSection title="Approval">
<SettingsError message={settings.error?.message} />
<SettingsError message={failureSaid(settings.error)} />
</PageSection>
);
const current = settings.data.personalReview ?? "admins";
Expand Down Expand Up @@ -173,7 +174,7 @@ function WhoApprovesDialog({
</PageRows>
{save.error ? (
<p className="mt-3 text-destructive text-sm" role="alert">
{save.error.message}
{failureSaid(save.error)}
</p>
) : null}
</DialogBody>
Expand Down Expand Up @@ -220,7 +221,7 @@ export function PeopleProposalsSection() {
if (settings.error)
return (
<PageSection title="From people's recordings">
<SettingsError message={settings.error.message} />
<SettingsError message={failureSaid(settings.error)} />
</PageSection>
);
if (!admins) return null;
Expand All @@ -239,7 +240,7 @@ export function PeopleProposalsSection() {
>
{people.isPending ? null : people.error ? (
<p className="mt-4 text-destructive text-sm" role="alert">
{people.error.message}
{failureSaid(people.error)}
</p>
) : (
<>
Expand Down Expand Up @@ -367,11 +368,11 @@ export function SharingRequestsSection() {
description="Approve a request to open a skill to every Bot."
>
{settings.error ? (
<SettingsError message={settings.error.message} />
<SettingsError message={failureSaid(settings.error)} />
) : null}
{requests.isPending ? null : requests.error ? (
<p className="mt-4 text-destructive text-sm" role="alert">
{requests.error.message}
{failureSaid(requests.error)}
</p>
) : rows.length === 0 ? (
<PageEmpty icon={IconShare} title="No requests to share">
Expand Down Expand Up @@ -419,7 +420,7 @@ export function SharingRequestsSection() {
<>
{decide.error ? (
<p className="mr-auto text-destructive text-sm" role="alert">
{decide.error.message}
{failureSaid(decide.error)}
</p>
) : null}
<Button
Expand Down
6 changes: 5 additions & 1 deletion app/src/components/admin/controls/recording-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { Separator } from "@/components/ui/separator";
import { Switch } from "@/components/ui/switch";
import { actionRecordsQueryOptions } from "@/lib/enterprise/queries";
import { loadFailure } from "@/lib/load-failure";
import { ControlsSection } from "./controls-section";

/** Admin, Audit: Action Recording, its recent commands, and the OpenTelemetry export. */
Expand Down Expand Up @@ -80,7 +81,10 @@ function RecordedActions() {
if (actions.error)
return (
<p className="mt-4 text-destructive text-sm" role="alert">
Couldn't load recorded actions. Try again in a moment.
{loadFailure(
actions.error,
"Couldn't load recorded actions. Try again in a moment.",
)}
</p>
);
if (actions.data.length === 0)
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/agents/agent-profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Separator } from "@/components/ui/separator";
import { Skeleton } from "@/components/ui/skeleton";
import { agentQueryOptions } from "@/lib/agents/queries";
import { shownSubtitle } from "@/lib/agents/subtitle";
import { loadFailure } from "@/lib/load-failure";

function Tag({ children }: { children: ReactNode }) {
return (
Expand Down Expand Up @@ -66,7 +67,7 @@ export function AgentProfile({
if (agent.error || !agent.data) {
return (
<p className="p-8 text-sm text-destructive" role="alert">
Couldn't load this Bot.
{loadFailure(agent.error, "Couldn't load this Bot.")}
</p>
);
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/agents/callback-token-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
issueCallbackTokenMutationOptions,
revokeCallbackTokenMutationOptions,
} from "@/lib/agents/mutations";
import { failureSaid } from "@/lib/load-failure";

/**
* The credential this coworker presents when it calls a tool back.
Expand Down Expand Up @@ -116,7 +117,7 @@ export function CallbackTokenPanel({

{error ? (
<p className="text-destructive text-sm" role="alert">
{error.message}
{failureSaid(error)}
</p>
) : null}
</section>
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/agents/handoff-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
agentListQueryOptions,
} from "@/lib/agents/queries";
import { queryClient } from "@/query-client";
import { failureSaid } from "@/lib/load-failure";

/**
* Which Bots this one may hand work to.
Expand Down Expand Up @@ -97,7 +98,7 @@ export function HandoffPanel({ agentId }: { agentId: string }) {

{setGrant.error ? (
<p className="mt-4 text-destructive text-sm" role="alert">
{setGrant.error.message}
{failureSaid(setGrant.error)}
</p>
) : null}

Expand Down
Loading
Loading