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
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 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
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 app/tests/organization-held-actions.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
4 changes: 2 additions & 2 deletions app/src/components/admin/controls/computer-sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
type NetworkPolicy,
type NetworkScopeKind,
} from "@/lib/enterprise/queries";
import { loadFailure, failureSaid } from "@/lib/load-failure";
import { failureSaid, loadFailure } 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 @@ -535,7 +535,7 @@ function NetworkDialog({
</form>
{(save.error ?? remove.error) ? (
<p className="text-destructive text-sm" role="alert">
{(save.error ?? remove.error)?.message}
{failureSaid(save.error ?? remove.error)}
</p>
) : null}
</DialogBody>
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/admin/controls/controls-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type EnterpriseSettings,
enterpriseOverviewQueryOptions,
} from "@/lib/enterprise/queries";
import { loadFailure } from "@/lib/load-failure";
import { failureSaid, 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 @@ -102,7 +102,7 @@ export function ControlsSection({
>
{failure ? (
<p className="mt-4 text-destructive text-sm" role="alert">
{failure.message}
{failureSaid(failure)}
</p>
) : null}
{children({
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/admin/controls/describe-capabilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ import type {
CapabilityChange,
CapabilityChangeProblem,
} from "@/lib/capability-changes/translate";
import { failureSaid } from "@/lib/load-failure";
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 @@ -133,7 +133,7 @@ export function ChangeRows({
<ItemDescription>{scopeWords(change, teams)}</ItemDescription>
{wrong.map((problem) => (
<p className="text-destructive text-sm" key={problem.field}>
{problem.message}
{failureSaid(problem)}
</p>
))}
</ItemContent>
Expand Down
37 changes: 23 additions & 14 deletions app/src/components/agents/new-bot-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ import { isComposing } from "@/lib/composing";
import { ALWAYS_ON_APP } from "@/lib/connections/rows";
import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
import { myCapabilitiesQueryOptions } from "@/lib/enterprise/queries";
import { failureSaid, loadFailure } from "@/lib/load-failure";
import {
type Failure,
failureOf,
failureSaid,
loadFailure,
} from "@/lib/load-failure";
import { useOrganizationAudience } from "@/lib/organizations/queries";
import { type PluginServer, pluginKeys } from "@/lib/plugins/queries";
import { cn } from "@/lib/utils";
Expand Down Expand Up @@ -234,8 +239,11 @@ function NewBotFlow({ onCreated }: { onCreated: (agentId: string) => void }) {
const [tried, setTried] = useState(false);
/** Continue on the address is dialling it, before anything is created. */
const [checking, setChecking] = useState(false);
/** Why the server could not reach the address on the last Continue, in its own words. */
const [unreachable, setUnreachable] = useState<string>();
/**
* Why the server could not reach the address on the last Continue, in its own words. The refusal
* itself, not its words: a hold is drawn calmly (lib/load-failure.tsx).
*/
const [unreachable, setUnreachable] = useState<Failure>();
/** The Bot just made, held for the moment the sheet spends saying so before it hands over. */
const [createdId, setCreatedId] = useState<string>();
/**
Expand Down Expand Up @@ -391,11 +399,7 @@ function NewBotFlow({ onCreated }: { onCreated: (agentId: string) => void }) {
await create(runtime);
} catch (error) {
createAgent.reset();
setUnreachable(
error instanceof Error && error.message
? error.message
: MASTRA_UNREACHABLE,
);
setUnreachable(failureOf(error, MASTRA_UNREACHABLE));
focusAddress();
}
return;
Expand Down Expand Up @@ -526,7 +530,13 @@ function NewBotFlow({ onCreated }: { onCreated: (agentId: string) => void }) {
) : (
<EndpointStep
endpoint={endpoint}
endpointError={tried ? endpointIssue : unreachable}
endpointError={
tried
? endpointIssue === undefined
? undefined
: { message: endpointIssue }
: unreachable
}
harness={runtime?.kind === "managed" ? runtime.harness : null}
onEndpoint={(value) => {
setEndpoint(value);
Expand Down Expand Up @@ -1060,7 +1070,7 @@ export function EndpointStep({
harness: string | null;
endpoint: string;
secret: string;
endpointError?: string;
endpointError?: Failure;
onEndpoint: (value: string) => void;
onKey: (value: string) => void;
}) {
Expand Down Expand Up @@ -1099,10 +1109,9 @@ export function EndpointStep({
value={endpoint}
/>
{endpointError ? (
<FieldError
className="text-pretty"
errors={[{ message: endpointError }]}
/>
<FieldError className="text-pretty">
{failureSaid(endpointError)}
</FieldError>
) : mastra ? (
<FieldDescription>
Give the address of your Mastra server. It needs to run one agent,
Expand Down
10 changes: 5 additions & 5 deletions app/src/components/agents/proposed-bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type ProposedBot,
wasCreated,
} from "@/lib/agents/proposal";
import { type Failure, failureOf, failureSaid } from "@/lib/load-failure";

/**
* The coworker a Bot has written, put in front of the person before it exists.
Expand Down Expand Up @@ -71,7 +72,7 @@ export function ProposedBotCard({
* after whatever the refusal named has been dealt with, or declining. Answering the tool with the
* error would end the turn and leave the person retyping their request.
*/
const [refusal, setRefusal] = useState<string | null>(null);
const [refusal, setRefusal] = useState<Failure | null>(null);

if (result !== undefined) {
/*
Expand Down Expand Up @@ -115,9 +116,8 @@ export function ProposedBotCard({
} catch (cause) {
// Left on the card with the buttons still live. See `refusal` above.
setSending(null);
setRefusal(
cause instanceof Error ? cause.message : "The Bot wasn't created.",
);
// The refusal itself, not its words: a hold is drawn calmly (lib/load-failure.tsx).
setRefusal(failureOf(cause, "The Bot wasn't created."));
return;
}
/*
Expand Down Expand Up @@ -177,7 +177,7 @@ export function ProposedBotCard({

{refusal ? (
<p className="mt-3 text-destructive text-sm" role="alert">
{refusal}
{failureSaid(refusal)}
</p>
) : null}

Expand Down
7 changes: 4 additions & 3 deletions app/src/components/app-sidebar/channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ContextMenuTrigger,
} from "@/components/ui/context-menu";
import { setChannelPinnedMutationOptions } from "@/lib/channels/mutations";
import { type Failure, failureSaid } from "@/lib/load-failure";
import type { ConversationView } from "@/lib/settings/conversation-view";
import type { MessageListEmphasis } from "@/lib/settings/message-list";
import { useTypedReveal } from "@/lib/typed-reveal";
Expand Down Expand Up @@ -90,7 +91,7 @@ export const Channel = memo(function Channel({
* app, and the row is where the person was looking, so the sentence goes here and is replaced by
* the next attempt.
*/
const [pinProblem, setPinProblem] = useState<string | null>(null);
const [pinProblem, setPinProblem] = useState<Failure | null>(null);

return (
<>
Expand Down Expand Up @@ -138,7 +139,7 @@ export const Channel = memo(function Channel({
setPinProblem(null);
setPinned.mutate(
{ channelId, pinned: !pinned },
{ onError: (thrown) => setPinProblem(thrown.message) },
{ onError: (thrown) => setPinProblem(thrown) },
);
}}
>
Expand All @@ -162,7 +163,7 @@ export const Channel = memo(function Channel({
</ContextMenu>
{pinProblem ? (
<p className="px-2 pb-1 text-destructive text-xs" role="alert">
{pinProblem}
{failureSaid(pinProblem)}
</p>
) : null}
<RenameConversationDialog
Expand Down
4 changes: 3 additions & 1 deletion app/src/components/app-sidebar/use-sign-out.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { toast } from "@/components/ui/toast";
import { signOutMutationOptions } from "@/lib/auth/mutations";
import { failureToastType } from "@/lib/load-failure";

/** The one toast a sign-out that did not finish says itself in. */
const SIGN_OUT_TOAST = "sign-out-unfinished";
Expand Down Expand Up @@ -31,7 +32,8 @@ export function useSignOut() {
// One at a time: a second refusal replaces the first rather than stacking under it.
id: SIGN_OUT_TOAST,
title: error.message,
type: "error",
// OpenBot holding off for now is news, not a failure (lib/load-failure.tsx).
type: failureToastType(error),
priority: "high",
}),
});
Expand Down
5 changes: 3 additions & 2 deletions app/src/components/approvals/inline-approval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
decideApproval,
} from "@/lib/approvals";
import { noteAnswered } from "@/lib/computers/activity";
import { failureSaid } from "@/lib/load-failure";
import { EASE_OUT } from "@/lib/motion";

/**
Expand Down Expand Up @@ -149,7 +150,7 @@ export function InlineApproval({
share?.caption ??
(handOff ? "This one is yours to do." : undefined)
}
error={decision.error?.message ?? null}
error={decision.error}
onSubmit={(value) => decision.mutate(value as ApprovalDecision)}
options={choices.map((choice) => ({
value: choice,
Expand Down Expand Up @@ -199,7 +200,7 @@ export function InlineApproval({
data-testid="approval-left"
role={request.left.done ? "status" : "alert"}
>
{request.left.message}
{failureSaid(request.left)}
</p>
) : null}
</>
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/approvals/question-notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import {
approvalInboxOptions,
dismissPersonQuestionMutationOptions,
} from "@/lib/approvals";
import { type Failure, failureSaid } from "@/lib/load-failure";
import { queryClient } from "@/query-client";
import { failureSaid } from "@/lib/load-failure";

export type WaitingQuestion = ApprovalInboxData["questions"][number];

Expand Down Expand Up @@ -145,7 +145,7 @@ function QuestionParts({
onAnswered: (answer: string) => Promise<void>;
}) {
const [sending, setSending] = useState(false);
const [error, setError] = useState<string | null>(null);
const [error, setError] = useState<Failure | null>(null);
const several = parts.length > 1;
return (
<Questionnaire
Expand All @@ -160,7 +160,7 @@ function QuestionParts({
setSending(true);
setError(null);
onAnswered(partsAnswer(parts, new FormData(event.currentTarget)))
.catch((failure: Error) => setError(failure.message))
.catch((failure: Error) => setError(failure))
.finally(() => setSending(false));
}}
shortcuts="numbers"
Expand Down Expand Up @@ -212,7 +212,7 @@ function QuestionParts({
</QuestionnaireActions>
{error ? (
<p className="text-destructive text-sm" role="alert">
{error}
{failureSaid(error)}
</p>
) : null}
</Questionnaire>
Expand Down
7 changes: 4 additions & 3 deletions app/src/components/audit/ask-the-trail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "@/components/ui/input-group";
import { type AuditAnswer, askAuditTrail } from "@/lib/audit/ask";
import { isComposing } from "@/lib/composing";
import { type Failure, failureOf, failureSaid } from "@/lib/load-failure";

/** The longest question the server takes. */
const QUESTION_LIMIT = 500;
Expand All @@ -31,7 +32,7 @@ export function AskTheTrail({
}) {
const [text, setText] = useState("");
const [asking, setAsking] = useState(false);
const [problem, setProblem] = useState<string | null>(null);
const [problem, setProblem] = useState<Failure | null>(null);
const question = text.trim();

const ask = async () => {
Expand All @@ -41,7 +42,7 @@ export function AskTheTrail({
try {
onAnswer({ ...(await askAuditTrail(question)), question });
} catch (thrown) {
setProblem((thrown as Error).message);
setProblem(failureOf(thrown, String(thrown)));
} finally {
setAsking(false);
}
Expand Down Expand Up @@ -89,7 +90,7 @@ export function AskTheTrail({
data-audit-ask-problem
role="alert"
>
{problem}
{failureSaid(problem)}
</p>
) : null}
</form>
Expand Down
9 changes: 4 additions & 5 deletions app/src/components/auth/link-company-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState } from "react";
import { Button } from "@/components/ui/button";
import type { CompanySignInProvidersItem } from "@/lib/api/generated/model";
import { linkCompanyAccount } from "@/lib/auth/client";
import { type Failure, failureOf, failureSaid } from "@/lib/load-failure";
import { cn } from "@/lib/utils";

export const LINK_COMPANY_ACCOUNT = "Link your company account";
Expand All @@ -23,7 +24,7 @@ export function LinkCompanyAccount({
className?: string;
}) {
const [linking, setLinking] = useState<string | null>(null);
const [problem, setProblem] = useState<string | null>(null);
const [problem, setProblem] = useState<Failure | null>(null);
if (providers.length === 0) return null;

const link = async (providerId: string) => {
Expand All @@ -34,9 +35,7 @@ export function LinkCompanyAccount({
await linkCompanyAccount(providerId);
} catch (error) {
setProblem(
error instanceof Error
? error.message
: "Couldn't start signing in with your company.",
failureOf(error, "Couldn't start signing in with your company."),
);
setLinking(null);
}
Expand All @@ -61,7 +60,7 @@ export function LinkCompanyAccount({
))}
{problem ? (
<p className="text-destructive text-sm" role="alert">
{problem}
{failureSaid(problem)}
</p>
) : null}
</div>
Expand Down
Loading
Loading