Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(society): the creator's default seat is the first subscription, joined only once every answer is in

rubenluetke10-beepfb43db8c5e21
diff --git a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx
index af1c5207b7..96a7933427 100644
--- a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx
@@ -133,13 +133,14 @@ export function CreateAgentDialog({ open, onClose, onCreated }: CreateAgentDialo
staleTime: 60_000,
});
const seatsLoading = catalog.isLoading || connections.isLoading || societyProviders.isLoading;
+ // Joined only once all three answers are in (each query settles to [] on
+ // a failure): a join over a catalog without the credential rows would call
+ // every API seat unconnected, list the local rows alone, and the default
+ // pick would land on one of them before the keys arrive.
const seats = useMemo<BrainSeat[]>(() => {
const providers = catalog.data?.providers ?? [];
- if (!providers.length) return [];
- return brainSeats(
- joinProviderOptions(providers, connections.data ?? []),
- societyProviders.data ?? [],
- );
+ if (!providers.length || !connections.data || !societyProviders.data) return [];
+ return brainSeats(joinProviderOptions(providers, connections.data), societyProviders.data);
}, [catalog.data, connections.data, societyProviders.data]);
const seat = seats.find((s) => s.provider.id === providerId) ?? null;
const accounts = accountChoice(seat);
diff --git a/jarvis/ui/web/frontend/src/components/society/create/brainPicker.test.ts b/jarvis/ui/web/frontend/src/components/society/create/brainPicker.test.ts
index 3b4db9f2d1..7d63086fb3 100644
--- a/jarvis/ui/web/frontend/src/components/society/create/brainPicker.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/create/brainPicker.test.ts
@@ -93,12 +93,20 @@ describe("brainSeats", () => {
expect(accountChoice(single)).toEqual([]);
});
- it("starts on the active brain, else the first seat", () => {
+ it("starts on a subscription, else the active brain, else the first seat", () => {
const seats = brainSeats(
[option({ id: "openai" }), option({ id: "grok", label: "xAI Grok", active: true })],
[],
);
expect(defaultSeat(seats)?.provider.id).toBe("grok");
+ const withSeat = brainSeats(
+ [
+ option({ id: "grok", label: "xAI Grok", active: true }),
+ option({ id: "openai-codex", label: "Codex", runner: "codex-cli", cli_installed: true }),
+ ],
+ [],
+ );
+ expect(defaultSeat(withSeat)?.provider.id).toBe("openai-codex");
expect(defaultSeat(brainSeats([option({ id: "openai" })], []))?.provider.id).toBe("openai");
expect(defaultSeat([])).toBeNull();
});
diff --git a/jarvis/ui/web/frontend/src/components/society/create/brainPicker.ts b/jarvis/ui/web/frontend/src/components/society/create/brainPicker.ts
index 8d3c0c7354..048bdabecf 100644
--- a/jarvis/ui/web/frontend/src/components/society/create/brainPicker.ts
+++ b/jarvis/ui/web/frontend/src/components/society/create/brainPicker.ts
@@ -56,9 +56,18 @@ export function brainSeats(
);
}
-/** The seat a fresh agent starts on: the brain marked active, else the first listed. */
+/**
+ * The seat a fresh agent starts on: the first subscription (a plan already
+ * paid for beats a metered key — the maintainer's stated preference), else
+ * the brain marked active, else the first listed.
+ */
export function defaultSeat(seats: BrainSeat[]): BrainSeat | null {
- return seats.find((s) => s.provider.active) ?? seats[0] ?? null;
+ return (
+ seats.find((s) => s.kind === "subscription") ??
+ seats.find((s) => s.provider.active) ??
+ seats[0] ??
+ null
+ );
}
/** The models this seat offers; empty means "type one" (a live list not yet fetched). */