From e1df942430f3d4a2b2f23ce988bb893772f74f77 Mon Sep 17 00:00:00 2001
From: Bryant Derosier
Date: Tue, 27 Oct 2026 19:16:37 -0400
Subject: [PATCH 1/6] feat(contracts): a second allowlist for custom members'
reasoning levels (reasoning levels)
Co-Authored-By: Claude Sonnet 5.5
---
packages/contracts/src/j5.ts | 1 +
packages/contracts/src/j5/crewMemberModels.ts | 2 +-
.../src/j5/crewMemberReasoning.test.ts | 161 ++++++++++++++++++
.../contracts/src/j5/crewMemberReasoning.ts | 140 +++++++++++++++
packages/contracts/src/settings.ts | 6 +
packages/shared/src/projectSettings.test.ts | 25 +++
6 files changed, 334 insertions(+), 1 deletion(-)
create mode 100644 packages/contracts/src/j5/crewMemberReasoning.test.ts
create mode 100644 packages/contracts/src/j5/crewMemberReasoning.ts
diff --git a/packages/contracts/src/j5.ts b/packages/contracts/src/j5.ts
index 8ce683e93a29f..9a5f5f1c4cef7 100644
--- a/packages/contracts/src/j5.ts
+++ b/packages/contracts/src/j5.ts
@@ -8,6 +8,7 @@ export * from "./j5/peerPoll.ts";
export * from "./j5/playbook.ts";
export * from "./j5/access.ts";
export * from "./j5/crewMemberModels.ts";
+export * from "./j5/crewMemberReasoning.ts";
export * from "./j5/levels.ts";
export * from "./j5/people.ts";
export * from "./j5/sharedConversation.ts";
diff --git a/packages/contracts/src/j5/crewMemberModels.ts b/packages/contracts/src/j5/crewMemberModels.ts
index 12317b1c2ad6e..52457352a5c87 100644
--- a/packages/contracts/src/j5/crewMemberModels.ts
+++ b/packages/contracts/src/j5/crewMemberModels.ts
@@ -20,7 +20,7 @@ export type CrewMemberModel = typeof CrewMemberModel.Type;
export const CrewMemberModels = Schema.NullOr(Schema.Array(CrewMemberModel));
export type CrewMemberModels = typeof CrewMemberModels.Type;
-const CREW_MEMBER_MODELS_SETTING_LABEL = "Models for custom members in Agent Setup";
+export const CREW_MEMBER_MODELS_SETTING_LABEL = "Models for custom members in Agent Setup";
type ModelKey = Pick;
diff --git a/packages/contracts/src/j5/crewMemberReasoning.test.ts b/packages/contracts/src/j5/crewMemberReasoning.test.ts
new file mode 100644
index 0000000000000..d3b8f5ba5dc70
--- /dev/null
+++ b/packages/contracts/src/j5/crewMemberReasoning.test.ts
@@ -0,0 +1,161 @@
+import { describe, expect, it } from "vite-plus/test";
+
+import type { ProviderOptionDescriptor } from "../model.ts";
+import { ProviderInstanceId } from "../providerInstance.ts";
+import type { ServerProvider } from "../server.ts";
+import {
+ crewMemberLevelCounts,
+ crewMemberProviderLevels,
+ crewMemberReasoningRefusal,
+ crewMemberSelectionLevel,
+ eligibleCrewMemberLevels,
+ eligibleCrewMemberLevelsForModel,
+ isCrewMemberLevelChecked,
+} from "./crewMemberReasoning.ts";
+
+const effort = (
+ ids: ReadonlyArray,
+ input: { readonly id?: string; readonly defaultId?: string } = {},
+): ProviderOptionDescriptor => ({
+ id: input.id ?? "reasoningEffort",
+ label: "Reasoning",
+ type: "select",
+ options: ids.map((id) => ({
+ id,
+ label: id.toUpperCase(),
+ ...(id === input.defaultId ? { isDefault: true } : {}),
+ })),
+});
+
+const thinking: ProviderOptionDescriptor = { id: "thinking", label: "Thinking", type: "boolean" };
+
+const model = (slug: string, descriptors?: ReadonlyArray) => ({
+ slug,
+ name: slug.toUpperCase(),
+ capabilities: descriptors === undefined ? null : { optionDescriptors: [...descriptors] },
+});
+
+const provider = (
+ instanceId: string,
+ models: ReadonlyArray>,
+ overrides: Partial = {},
+) =>
+ ({
+ instanceId: ProviderInstanceId.make(instanceId),
+ driver: "codex",
+ enabled: true,
+ installed: true,
+ status: "ready",
+ availability: "available",
+ models,
+ ...overrides,
+ }) as unknown as ServerProvider;
+
+const codex = ProviderInstanceId.make("codex");
+const claude = ProviderInstanceId.make("claude");
+const checked = (...levels: ReadonlyArray) =>
+ levels.map((level) => ({ instanceId: codex, level }));
+
+describe("crew member reasoning levels", () => {
+ const providers = [
+ provider("codex", [
+ model("a", [effort(["low", "high"], { defaultId: "high" })]),
+ model("b", [effort(["medium", "high", "xhigh"])]),
+ model("plain"),
+ ]),
+ provider("claude", [model("x", [thinking, effort(["low", "max"], { id: "effort" })])]),
+ ];
+
+ it("derives a provider's levels as the union of its models' choices, in order of first appearance", () => {
+ expect(crewMemberProviderLevels(providers[0]!).map(({ level }) => level)).toEqual([
+ "low",
+ "high",
+ "medium",
+ "xhigh",
+ ]);
+ expect(crewMemberProviderLevels(providers[0]!)[0]).toEqual({ level: "low", label: "LOW" });
+ });
+
+ it("ignores boolean thinking options and options that are not reasoning", () => {
+ const onlyBoolean = provider("grok", [model("g", [thinking, effort(["a"], { id: "mode" })])]);
+ expect(crewMemberProviderLevels(onlyBoolean)).toEqual([]);
+ expect(crewMemberProviderLevels(providers[1]!).map(({ level }) => level)).toEqual([
+ "low",
+ "max",
+ ]);
+ });
+
+ it("makes every level eligible until a list is saved", () => {
+ expect(isCrewMemberLevelChecked(null, { instanceId: codex, level: "anything" })).toBe(true);
+ expect(eligibleCrewMemberLevels(null, providers)).toHaveLength(6);
+ expect(crewMemberLevelCounts(null, providers)).toEqual({ checked: 6, total: 6 });
+ });
+
+ it("makes only the checked levels eligible, per provider instance, so a new level starts unchecked", () => {
+ const list = checked("low", "high");
+ expect(isCrewMemberLevelChecked(list, { instanceId: codex, level: "xhigh" })).toBe(false);
+ // The same id on another instance is another level.
+ expect(isCrewMemberLevelChecked(list, { instanceId: claude, level: "low" })).toBe(false);
+ expect(crewMemberLevelCounts(list, providers)).toEqual({ checked: 2, total: 6 });
+ });
+
+ it("keeps stale entries out of the count and the eligible list", () => {
+ const list = checked("low", "retired");
+ expect(crewMemberLevelCounts(list, providers)).toEqual({ checked: 1, total: 6 });
+ expect(eligibleCrewMemberLevels(list, providers).map(({ level }) => level)).toEqual(["low"]);
+ });
+
+ it("treats a saved empty list as nothing eligible", () => {
+ expect(eligibleCrewMemberLevels([], providers)).toEqual([]);
+ expect(crewMemberLevelCounts([], providers)).toEqual({ checked: 0, total: 6 });
+ });
+
+ it("offers only levels of providers that are set up", () => {
+ const all = [
+ ...providers,
+ provider("cursor", [model("z", [effort(["q"])])], { status: "error" }),
+ ];
+ expect(crewMemberLevelCounts(null, all)).toEqual({ checked: 6, total: 6 });
+ });
+
+ it("lists the eligible levels of one model in its own order", () => {
+ expect(
+ eligibleCrewMemberLevelsForModel(checked("xhigh", "high"), providers[0]!, "b").map(
+ ({ level }) => level,
+ ),
+ ).toEqual(["high", "xhigh"]);
+ expect(eligibleCrewMemberLevelsForModel(null, providers[0]!, "plain")).toEqual([]);
+ });
+
+ it("reads a selection's level from its explicit value, else the model's default", () => {
+ const a = providers[0]!.models[0]!;
+ expect(crewMemberSelectionLevel(a, [{ id: "reasoningEffort", value: "low" }])).toBe("low");
+ expect(crewMemberSelectionLevel(a, undefined)).toBe("high");
+ expect(crewMemberSelectionLevel(a, [{ id: "other", value: "low" }])).toBe("high");
+ // No explicit value and no default: nothing to check.
+ expect(crewMemberSelectionLevel(providers[0]!.models[1]!, [])).toBeNull();
+ // A model with no reasoning option has no level.
+ expect(crewMemberSelectionLevel(providers[0]!.models[2]!, [])).toBeNull();
+ });
+
+ it("names the level, the model, the project, the setting and the levels to use instead", () => {
+ const message = crewMemberReasoningRefusal({
+ selection: { instanceId: "codex", model: "b", level: "xhigh" },
+ projectTitle: "Billing Migration",
+ eligible: eligibleCrewMemberLevelsForModel(checked("medium"), providers[0]!, "b"),
+ });
+ expect(message).toContain("Reasoning level xhigh of b on codex");
+ expect(message).toContain('"Billing Migration"');
+ expect(message).toContain("Models for custom members in Agent Setup");
+ expect(message).toContain("Eligible levels for b: medium.");
+ });
+
+ it("says when none of the model's levels is eligible", () => {
+ const message = crewMemberReasoningRefusal({
+ selection: { instanceId: "codex", model: "b", level: "xhigh" },
+ projectTitle: "P",
+ eligible: [],
+ });
+ expect(message).toContain("No reasoning level of b is eligible");
+ });
+});
diff --git a/packages/contracts/src/j5/crewMemberReasoning.ts b/packages/contracts/src/j5/crewMemberReasoning.ts
new file mode 100644
index 0000000000000..43b90cfa44b78
--- /dev/null
+++ b/packages/contracts/src/j5/crewMemberReasoning.ts
@@ -0,0 +1,140 @@
+import * as Schema from "effect/Schema";
+
+import { TrimmedNonEmptyString } from "../baseSchemas.ts";
+import type { ProviderOptionSelection } from "../model.ts";
+import { ProviderInstanceId } from "../providerInstance.ts";
+import type { ServerProvider, ServerProviderModel } from "../server.ts";
+import { agentPersonaReasoningDescriptor } from "./agentPersona.ts";
+import { CREW_MEMBER_MODELS_SETTING_LABEL, isCrewMemberProviderSetUp } from "./crewMemberModels.ts";
+
+/** One checked reasoning level: the choice id of a model's reasoning option, per provider instance. */
+export const CrewMemberReasoningLevel = Schema.Struct({
+ instanceId: ProviderInstanceId,
+ level: TrimmedNonEmptyString,
+});
+export type CrewMemberReasoningLevel = typeof CrewMemberReasoningLevel.Type;
+
+/**
+ * The reasoning levels custom Crew members and plain delegated or spawned agents may run at, with
+ * the same semantics as `CrewMemberModels`: `null` means no list was ever saved and every level is
+ * eligible, a saved list holds only the checked pairs, and an empty saved list makes none eligible.
+ */
+export const CrewMemberReasoning = Schema.NullOr(Schema.Array(CrewMemberReasoningLevel));
+export type CrewMemberReasoning = typeof CrewMemberReasoning.Type;
+
+type LevelKey = Pick;
+
+export interface CrewMemberLevel {
+ readonly level: string;
+ readonly label: string;
+}
+
+export interface CrewMemberLevelChoice extends CrewMemberLevel {
+ readonly instanceId: ServerProvider["instanceId"];
+}
+
+const modelLevels = (
+ model: Pick | undefined,
+): ReadonlyArray =>
+ agentPersonaReasoningDescriptor(model)?.options.map((choice) => ({
+ level: choice.id,
+ label: choice.label,
+ })) ?? [];
+
+/**
+ * A provider's levels: the choices of every model's reasoning option, each once, in order of first
+ * appearance. Boolean options such as a thinking switch are not levels.
+ */
+export const crewMemberProviderLevels = (
+ provider: Pick,
+): ReadonlyArray => {
+ const seen = new Map();
+ for (const model of provider.models)
+ for (const level of modelLevels(model))
+ if (!seen.has(level.level)) seen.set(level.level, level);
+ return [...seen.values()];
+};
+
+export const isCrewMemberLevelChecked = (
+ list: CrewMemberReasoning | undefined,
+ key: LevelKey,
+): boolean =>
+ list === null ||
+ list === undefined ||
+ list.some((entry) => entry.instanceId === key.instanceId && entry.level === key.level);
+
+/** The set-up providers' levels the list makes eligible, in provider order. Stale entries match nothing. */
+export const eligibleCrewMemberLevels = (
+ list: CrewMemberReasoning | undefined,
+ providers: ReadonlyArray,
+): ReadonlyArray =>
+ providers.filter(isCrewMemberProviderSetUp).flatMap((provider) =>
+ crewMemberProviderLevels(provider)
+ .filter((level) =>
+ isCrewMemberLevelChecked(list, { instanceId: provider.instanceId, level: level.level }),
+ )
+ .map((level) => ({ instanceId: provider.instanceId, ...level })),
+ );
+
+/** "3 of 4": checked levels that are in the catalog, over the catalog. */
+export const crewMemberLevelCounts = (
+ list: CrewMemberReasoning | undefined,
+ providers: ReadonlyArray,
+): { readonly checked: number; readonly total: number } => ({
+ checked: eligibleCrewMemberLevels(list, providers).length,
+ total: providers
+ .filter(isCrewMemberProviderSetUp)
+ .reduce((count, provider) => count + crewMemberProviderLevels(provider).length, 0),
+});
+
+/** The levels one model offers that the list makes eligible, in the model's own order. */
+export const eligibleCrewMemberLevelsForModel = (
+ list: CrewMemberReasoning | undefined,
+ provider: Pick,
+ modelSlug: string,
+): ReadonlyArray =>
+ modelLevels(provider.models.find((model) => model.slug === modelSlug)).filter((level) =>
+ isCrewMemberLevelChecked(list, { instanceId: provider.instanceId, level: level.level }),
+ );
+
+/**
+ * The level a selection runs at: its explicit reasoning value, or else the model's default for
+ * that option. Null when the model has no reasoning option or the selection names no level and the
+ * option has no default, so there is nothing to check.
+ */
+export const crewMemberSelectionLevel = (
+ model: Pick | undefined,
+ options: ReadonlyArray | undefined,
+): string | null => {
+ const descriptor = agentPersonaReasoningDescriptor(model);
+ if (descriptor === undefined) return null;
+ const explicit = options?.find((option) => option.id === descriptor.id)?.value;
+ if (typeof explicit === "string") return explicit;
+ return (
+ descriptor.currentValue ?? descriptor.options.find((choice) => choice.isDefault)?.id ?? null
+ );
+};
+
+const MAX_LISTED_LEVELS = 30;
+
+/**
+ * What a refused level tells the agent or the person: the level, the model and provider, the
+ * project, the setting that decided it, and the levels that model can run at instead.
+ */
+export const crewMemberReasoningRefusal = (input: {
+ readonly selection: {
+ readonly instanceId: string;
+ readonly model: string;
+ readonly level: string;
+ };
+ readonly projectTitle: string;
+ readonly eligible: ReadonlyArray;
+}): string => {
+ const listed = input.eligible.slice(0, MAX_LISTED_LEVELS).map((choice) => choice.level);
+ const more = input.eligible.length - listed.length;
+ const alternatives =
+ input.eligible.length === 0
+ ? `No reasoning level of ${input.selection.model} is eligible: none is checked.`
+ : `Eligible levels for ${input.selection.model}: ${listed.join(", ")}${more > 0 ? `, and ${more} more` : ""}.`;
+ return `Reasoning level ${input.selection.level} of ${input.selection.model} on ${input.selection.instanceId} is not eligible for custom members in project "${input.projectTitle}". The project's list is the setting ${CREW_MEMBER_MODELS_SETTING_LABEL}. ${alternatives}`;
+};
diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts
index 84345e49ea81d..a475bd8c8c1b3 100644
--- a/packages/contracts/src/settings.ts
+++ b/packages/contracts/src/settings.ts
@@ -28,6 +28,7 @@ import {
ProviderOptionSelections,
} from "./model.ts";
import { CrewMemberModels } from "./j5/crewMemberModels.ts";
+import { CrewMemberReasoning } from "./j5/crewMemberReasoning.ts";
import { ModelSelection } from "./modelSelection.ts";
import { ProjectScript, type ProjectMutation } from "./project.ts";
import { DEFAULT_RUNTIME_MODE, RuntimeMode } from "./providerPolicy.ts";
@@ -894,6 +895,7 @@ export const PROJECT_SCOPED_SERVER_SETTING_KEYS = [
"worktreeSubmodules",
"crewAutoApprove",
"crewMemberModels",
+ "crewMemberReasoning",
"defaultAutoPull",
"defaultProjectScripts",
"enableAgentBrowserAccess",
@@ -939,6 +941,7 @@ export const ProjectSettingsOverrides = Schema.Struct({
worktreeSubmodules: ForwardCompatibleOptional(WorktreeSubmodules),
crewAutoApprove: Schema.optionalKey(Schema.Boolean),
crewMemberModels: Schema.optionalKey(CrewMemberModels),
+ crewMemberReasoning: Schema.optionalKey(CrewMemberReasoning),
defaultAutoPull: Schema.optionalKey(Schema.Boolean),
defaultProjectScripts: Schema.optionalKey(Schema.Array(ProjectScript)),
enableAgentBrowserAccess: Schema.optionalKey(Schema.Boolean),
@@ -984,6 +987,7 @@ const NULLABLE_PROJECT_SETTINGS_OVERRIDES: ReadonlySet {
expect(resolveProjectSettings(settings, null).settings.crewMemberModels).toEqual([entry("a")]);
});
+ it("replaces the reasoning levels for custom members whole, and lets a project hold null or its own list", () => {
+ const entry = (level: string) => ({ instanceId: ProviderInstanceId.make("codex"), level });
+ expect(DEFAULT_SERVER_SETTINGS.crewMemberReasoning).toBeNull();
+ const three = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, {
+ crewMemberReasoning: [entry("low"), entry("medium"), entry("high")],
+ });
+ const one = applyServerSettingsPatch(three, { crewMemberReasoning: [entry("low")] });
+ expect(one.crewMemberReasoning).toEqual([entry("low")]);
+ const settings = applyServerSettingsPatch(one, {
+ projectSettingsOverrides: {
+ [projectId]: { crewMemberReasoning: null },
+ [otherProjectId]: { crewMemberReasoning: [entry("xhigh")] },
+ },
+ });
+ const everything = resolveProjectSettings(settings, projectId);
+ expect(everything.settings.crewMemberReasoning).toBeNull();
+ expect(everything.sources.crewMemberReasoning).toBe("project");
+ expect(resolveProjectSettings(settings, otherProjectId).settings.crewMemberReasoning).toEqual([
+ entry("xhigh"),
+ ]);
+ expect(resolveProjectSettings(settings, null).settings.crewMemberReasoning).toEqual([
+ entry("low"),
+ ]);
+ });
+
it("keeps the environment text generation model when the override's provider is disabled", () => {
const disabledSelection = createModelSelection(ProviderInstanceId.make("claudeAgent"), "opus");
const settings = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, {
From 4829c0c6f40e41b194c66ef344d23a3ee4a7d2a8 Mon Sep 17 00:00:00 2001
From: Bryant Derosier
Date: Tue, 27 Oct 2026 19:24:48 -0400
Subject: [PATCH 2/6] feat(j5): hold custom members to the project's reasoning
levels (reasoning levels)
Co-Authored-By: Claude Sonnet 5.5
---
.../src/j5/a2a/CrewLaunchService.test.ts | 228 ++++++++++++++++--
apps/server/src/j5/a2a/CrewLaunchService.ts | 26 +-
apps/server/src/j5/a2a/SpawnAgentService.ts | 7 +-
apps/server/src/j5/a2a/mcp/handlers.ts | 2 +-
apps/server/src/j5/a2a/mcp/tools.ts | 6 +-
apps/server/src/j5/a2a/spawnWorkspace.test.ts | 79 +++++-
apps/server/src/j5/agents/agentDelegation.ts | 12 +-
.../agents/agentSubagent.integration.test.ts | 108 +++++++--
apps/server/src/j5/agents/crewMemberModels.ts | 82 +++++--
docs/j5/product/a2a/agent-tools.md | 12 +-
10 files changed, 490 insertions(+), 72 deletions(-)
diff --git a/apps/server/src/j5/a2a/CrewLaunchService.test.ts b/apps/server/src/j5/a2a/CrewLaunchService.test.ts
index 51af50e544084..cd8af9279c51e 100644
--- a/apps/server/src/j5/a2a/CrewLaunchService.test.ts
+++ b/apps/server/src/j5/a2a/CrewLaunchService.test.ts
@@ -85,7 +85,14 @@ const createdAt = DateTime.makeUnsafe("2026-09-09T16:00:00.000Z");
const provider = (
instanceId: string,
driver: string,
- models: ReadonlyArray<{ slug: string; options: ReadonlyArray }>,
+ models: ReadonlyArray<{
+ slug: string;
+ options: ReadonlyArray;
+ /** The option the model runs at when a selection names none. */
+ defaultOption?: string;
+ /** A model that advertises no reasoning option at all. */
+ noReasoning?: true;
+ }>,
): ServerProvider => ({
instanceId: ProviderInstanceId.make(instanceId),
driver: ProviderDriverKind.make(driver),
@@ -103,14 +110,20 @@ const provider = (
name: model.slug,
isCustom: false,
capabilities: {
- optionDescriptors: [
- {
- id: driver === "codex" ? "reasoningEffort" : "effort",
- label: "Reasoning",
- type: "select",
- options: model.options.map((id) => ({ id, label: id })),
- },
- ],
+ optionDescriptors: model.noReasoning
+ ? []
+ : [
+ {
+ id: driver === "codex" ? "reasoningEffort" : "effort",
+ label: "Reasoning",
+ type: "select",
+ options: model.options.map((id) => ({
+ id,
+ label: id,
+ ...(id === model.defaultOption ? { isDefault: true } : {}),
+ })),
+ },
+ ],
},
})),
});
@@ -2445,15 +2458,16 @@ it.effect("a persona keeps its own model off the list, until its model is overri
model: own!.modelSelection.model,
};
// Editing a field on the roster card freezes the persona's model into the seat; it is the
- // same model, so the seat still keeps it, with or without the options the card carried.
+ // same model and level, so the seat still keeps it.
const [frozen] = yield* launcher.resolveSeats(captain, [
{ ...persona, modelSelection: own!.modelSelection, runtimeMode: "approval-required" },
]);
assert.equal(frozen!.modelSelection.model, personaModel.model);
- const [bare] = yield* launcher.resolveSeats(captain, [
- { ...persona, modelSelection: personaModel },
- ]);
- assert.equal(bare!.modelSelection.model, personaModel.model);
+ // Naming no reasoning value is not keeping the persona's: it runs at the model's default.
+ const bare = yield* launcher
+ .resolveSeats(captain, [{ ...persona, modelSelection: personaModel }])
+ .pipe(Effect.flip);
+ assert.equal(bare._tag, "CrewLaunchModelNotEligibleError");
// A different model on the card makes it a custom choice, held to the list.
const other = ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"].find(
(model) => model !== personaModel.model,
@@ -2507,3 +2521,189 @@ it.effect(
}).pipe(Effect.provide(layer));
}).pipe(Effect.scoped),
);
+
+const codexLevel = (level: string) => ({ instanceId: ProviderInstanceId.make("codex"), level });
+const solAt = (value: string) => ({ ...sol, options: [{ id: "reasoningEffort", value }] });
+const terraAt = (value: string) => ({ ...terra, options: [{ id: "reasoningEffort", value }] });
+// The Captain runs on gpt-5.6-sol with no explicit level, so it runs at the model's default.
+const reasoningProviders = [
+ provider("codex", "codex", [
+ { slug: "gpt-5.6-sol", options: ["low", "medium", "high"], defaultOption: "medium" },
+ { slug: "gpt-5.6-terra", options: ["high", "xhigh"] },
+ { slug: "gpt-5.6-luna", options: [], noReasoning: true },
+ ]),
+];
+
+it.effect(
+ "a saved level list holds a custom seat to its checked levels and names what to use",
+ () =>
+ Effect.gen(function* () {
+ const { layer, captain, commands } = yield* eligibilityFixture({
+ providers: reasoningProviders,
+ settings: { crewMemberReasoning: [codexLevel("low"), codexLevel("high")] },
+ });
+ yield* Effect.gen(function* () {
+ const launcher = yield* CrewLaunchService;
+ const checked = yield* launcher.resolveSeats(captain, [
+ customSeat("low", solAt("low")),
+ customSeat("high", solAt("high")),
+ ]);
+ assert.lengthOf(checked, 2);
+ const refused = yield* launcher
+ .resolveSeats(captain, [customSeat("medium", solAt("medium"))])
+ .pipe(Effect.flip);
+ assert.equal(refused._tag, "CrewLaunchModelNotEligibleError");
+ for (const part of [
+ "Reasoning level medium of gpt-5.6-sol on codex",
+ "Billing Migration",
+ "Models for custom members in Agent Setup",
+ "Eligible levels for gpt-5.6-sol: low, high.",
+ ])
+ assert.include(refused.message, part);
+ // Another model's levels are listed for that model, not this one's.
+ const terraRefused = yield* launcher
+ .resolveSeats(captain, [customSeat("terra", terraAt("xhigh"))])
+ .pipe(Effect.flip);
+ assert.include(terraRefused.message, "Eligible levels for gpt-5.6-terra: high.");
+ // Approving the roster goes through the same check, and nothing is created.
+ const launched = yield* launcher
+ .launch({
+ providerSessionId: "session",
+ requestKey: "launch-ineligible-level",
+ captain,
+ displayName: "Crew",
+ seats: [customSeat("medium", solAt("medium"))],
+ brief: "Work.",
+ })
+ .pipe(Effect.flip);
+ assert.equal(launched._tag, "CrewLaunchModelNotEligibleError");
+ assert.lengthOf(yield* Ref.get(commands), 0);
+ }).pipe(Effect.provide(layer));
+ }).pipe(Effect.scoped),
+);
+
+it.effect(
+ "a custom seat with no explicit level runs at the model's default, which is checked",
+ () =>
+ Effect.gen(function* () {
+ // The Captain's own selection names no level, so a seat that inherits it runs at medium.
+ const refusing = yield* eligibilityFixture({
+ providers: reasoningProviders,
+ settings: { crewMemberReasoning: [codexLevel("high")] },
+ });
+ yield* Effect.gen(function* () {
+ const launcher = yield* CrewLaunchService;
+ const refused = yield* launcher
+ .resolveSeats(refusing.captain, [customSeat("inherits")])
+ .pipe(Effect.flip);
+ assert.include(refused.message, "Reasoning level medium of gpt-5.6-sol");
+ }).pipe(Effect.provide(refusing.layer));
+ const allowing = yield* eligibilityFixture({
+ providers: reasoningProviders,
+ settings: { crewMemberReasoning: [codexLevel("medium")] },
+ });
+ yield* Effect.gen(function* () {
+ const launcher = yield* CrewLaunchService;
+ yield* launcher.resolveSeats(allowing.captain, [customSeat("inherits")]);
+ }).pipe(Effect.provide(allowing.layer));
+ }).pipe(Effect.scoped),
+);
+
+it.effect(
+ "a saved empty level list makes no level eligible, but a model with none is not held",
+ () =>
+ Effect.gen(function* () {
+ const { layer, captain } = yield* eligibilityFixture({
+ providers: reasoningProviders,
+ settings: { crewMemberReasoning: [] },
+ });
+ yield* Effect.gen(function* () {
+ const launcher = yield* CrewLaunchService;
+ const refused = yield* launcher
+ .resolveSeats(captain, [customSeat("inherits")])
+ .pipe(Effect.flip);
+ assert.include(refused.message, "No reasoning level of gpt-5.6-sol is eligible");
+ yield* launcher.resolveSeats(captain, [
+ customSeat("plain", { instanceId: sol.instanceId, model: "gpt-5.6-luna" }),
+ ]);
+ }).pipe(Effect.provide(layer));
+ }).pipe(Effect.scoped),
+);
+
+it.effect(
+ "the model list is checked before the level, and a level new to the catalog starts unchecked",
+ () =>
+ Effect.gen(function* () {
+ const { layer, captain } = yield* eligibilityFixture({
+ providers: reasoningProviders,
+ // Saved when terra offered only xhigh; high arrived later.
+ settings: {
+ crewMemberModels: [terra],
+ crewMemberReasoning: [codexLevel("xhigh")],
+ },
+ });
+ yield* Effect.gen(function* () {
+ const launcher = yield* CrewLaunchService;
+ const modelFirst = yield* launcher
+ .resolveSeats(captain, [customSeat("sol", solAt("high"))])
+ .pipe(Effect.flip);
+ assert.include(modelFirst.message, "Model gpt-5.6-sol on codex");
+ yield* launcher.resolveSeats(captain, [customSeat("known", terraAt("xhigh"))]);
+ const fresh = yield* launcher
+ .resolveSeats(captain, [customSeat("fresh", terraAt("high"))])
+ .pipe(Effect.flip);
+ assert.include(fresh.message, "Reasoning level high of gpt-5.6-terra");
+ }).pipe(Effect.provide(layer));
+ }).pipe(Effect.scoped),
+);
+
+it.effect("a persona keeps its own level off the list, until its level is changed", () =>
+ Effect.gen(function* () {
+ const levels = ["low", "medium", "high", "xhigh"];
+ const { layer, captain } = yield* eligibilityFixture({
+ providers: [
+ provider(
+ "codex",
+ "codex",
+ ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"].map((slug) => ({
+ slug,
+ options: levels,
+ })),
+ ),
+ ],
+ settings: { crewMemberReasoning: [] },
+ });
+ yield* Effect.gen(function* () {
+ const launcher = yield* CrewLaunchService;
+ const persona = {
+ workspace: { type: "shared" as const },
+ name: "builder",
+ agentId: "builder",
+ reason: "Builds",
+ };
+ const [own] = yield* launcher.resolveSeats(captain, [persona]);
+ // The card freezes the persona's whole selection into the seat; unchanged, it is not held.
+ yield* launcher.resolveSeats(captain, [
+ { ...persona, modelSelection: own!.modelSelection, runtimeMode: "approval-required" },
+ ]);
+ const personaLevel = own!.modelSelection.options?.find(
+ (option) => option.id === "reasoningEffort",
+ )?.value;
+ const otherLevel = levels.find((level) => level !== personaLevel)!;
+ const refused = yield* launcher
+ .resolveSeats(captain, [
+ {
+ ...persona,
+ modelSelection: {
+ instanceId: own!.modelSelection.instanceId,
+ model: own!.modelSelection.model,
+ options: [{ id: "reasoningEffort", value: otherLevel }],
+ },
+ },
+ ])
+ .pipe(Effect.flip);
+ assert.equal(refused._tag, "CrewLaunchModelNotEligibleError");
+ assert.include(refused.message, `Reasoning level ${otherLevel}`);
+ }).pipe(Effect.provide(layer));
+ }).pipe(Effect.scoped),
+);
diff --git a/apps/server/src/j5/a2a/CrewLaunchService.ts b/apps/server/src/j5/a2a/CrewLaunchService.ts
index 524433aa5f07d..c29381c8b2b2e 100644
--- a/apps/server/src/j5/a2a/CrewLaunchService.ts
+++ b/apps/server/src/j5/a2a/CrewLaunchService.ts
@@ -1,4 +1,4 @@
-import { CrewSeatWorkspace } from "@t3tools/contracts/j5";
+import { CrewSeatWorkspace, crewMemberSelectionLevel } from "@t3tools/contracts/j5";
import {
describeCrewSeatRuntime,
materializeCrewModelSelection,
@@ -185,7 +185,7 @@ export class CrewLaunchSeatUnavailableError extends Data.TaggedError(
}
}
-/** A custom seat's model is not on the project's "Models for custom members" list. */
+/** A custom seat's model or reasoning level is not on the project's "Models for custom members" lists. */
export class CrewLaunchModelNotEligibleError extends Data.TaggedError(
"CrewLaunchModelNotEligibleError",
)<{ readonly seatName: string; readonly detail: string }> {
@@ -316,8 +316,17 @@ export const layer = Layer.effect(
),
);
const resolved: Array = [];
- // `custom` seats run on whatever the project's list of models for custom members allows. A
- // persona seat that keeps its persona's own model is not custom and skips the list.
+ // The reasoning level a selection runs at on its model, explicit or the model's default.
+ const levelOf = (selection: ModelSelection) =>
+ crewMemberSelectionLevel(
+ providers
+ .find((candidate) => candidate.instanceId === selection.instanceId)
+ ?.models.find((model) => model.slug === selection.model),
+ selection.options,
+ );
+ // `custom` seats run on whatever the project's lists of models and reasoning levels for
+ // custom members allow. A persona seat that keeps its persona's own model and level is not
+ // custom and skips the lists.
const resolveSelection = Effect.fn("j5.a2a.crewLaunch.resolveSelection")(function* (
seat: CrewLaunchSeat,
selection: ModelSelection,
@@ -430,15 +439,18 @@ export const layer = Layer.effect(
const definition = catalog.definitions.find(({ id }) => id === agentId);
// Editing any field on the roster card freezes the model it showed into the seat, and
// that is the fallback route when the primary's provider was signed out at proposal
- // time. A seat counts as keeping the persona's model by matching either route, never by
- // its absence.
+ // time. A seat counts as keeping the persona's model and level by matching either route,
+ // never by its absence.
const frozen = seat.modelSelection;
const frozenDriver = providers.find(
(candidate) => candidate.instanceId === frozen.instanceId,
)?.driver;
const keepsPersonaModel =
definition?.modelRoute.some(
- (target) => target.driver === frozenDriver && target.model === frozen.model,
+ (target) =>
+ target.driver === frozenDriver &&
+ target.model === frozen.model &&
+ target.reasoningEffort === levelOf(frozen),
) ?? false;
const { modelSelection, provider } = yield* resolveSelection(
seat,
diff --git a/apps/server/src/j5/a2a/SpawnAgentService.ts b/apps/server/src/j5/a2a/SpawnAgentService.ts
index a8231d5753079..5faca15bc8ad5 100644
--- a/apps/server/src/j5/a2a/SpawnAgentService.ts
+++ b/apps/server/src/j5/a2a/SpawnAgentService.ts
@@ -479,8 +479,9 @@ const spawn = Effect.fn("j5.a2a.spawnAgent")(function* (
}),
),
);
- // A persona runs on its own model. A plain agent runs on one the project's list allows, and a
- // retry finishes the agent its first attempt created, so only a first attempt is held to it.
+ // A persona runs on its own model. A plain agent runs on a model and level the project's
+ // lists allow, and a retry finishes the agent its first attempt created, so only a first
+ // attempt is held to them.
if (persona === undefined && firstAttempt)
yield* (yield* CrewMemberModels)
.assertEligible({ projectId: target, selection: modelSelection })
@@ -488,7 +489,7 @@ const spawn = Effect.fn("j5.a2a.spawnAgent")(function* (
Effect.mapError((error) =>
stateError(
error.message,
- "Retry j5_spawn_agent with one of the eligible models, or name a persona.",
+ "Retry j5_spawn_agent with one of the eligible models or levels, or name a persona.",
),
),
);
diff --git a/apps/server/src/j5/a2a/mcp/handlers.ts b/apps/server/src/j5/a2a/mcp/handlers.ts
index dea1435fd841f..8ae3cc61a4a6d 100644
--- a/apps/server/src/j5/a2a/mcp/handlers.ts
+++ b/apps/server/src/j5/a2a/mcp/handlers.ts
@@ -228,7 +228,7 @@ const crewProposalNextStep = (error: CrewProposalError) =>
: error._tag === "CrewLaunchSeatUnavailableError"
? "Choose a different persona from j5_list_personas or ask the user to fix that persona, then retry."
: error._tag === "CrewLaunchModelNotEligibleError"
- ? "Give that custom member one of the eligible models above, or leave its model unset to use yours if yours is eligible, then retry."
+ ? "Give that custom member one of the eligible models or levels above, or leave its model unset to use yours if yours is eligible, then retry."
: error._tag === "CrewLaunchCapError"
? "The crew is full. Work with the seats it has, or propose a new crew for the extra work."
: error._tag === "CrewLaunchSeatConflictError"
diff --git a/apps/server/src/j5/a2a/mcp/tools.ts b/apps/server/src/j5/a2a/mcp/tools.ts
index 574455044e6ed..7c1b098a2543d 100644
--- a/apps/server/src/j5/a2a/mcp/tools.ts
+++ b/apps/server/src/j5/a2a/mcp/tools.ts
@@ -575,16 +575,16 @@ export const J5ArchiveCrewFailure = Schema.Struct({
export type J5ArchiveCrewFailure = typeof J5ArchiveCrewFailure.Type;
export const J5_SPAWN_AGENT_DESCRIPTION =
- "Spawn a Peer Agent: a full-citizen teammate with its own top-level thread, starting on your brief as its first turn. It joins your project unless you name another with project_id or set scratch for none, and records you as its immutable spawner; in your own project it is placed under you. It is addressable the moment this returns. In your brief, tell the new agent what it should do first and whether it should reply to you. Choose provider, model, and reasoning for the work in the brief — see orchestrator_capabilities for what's available. To run a persona from j5_list_personas, set `persona` to its id: the spawn gets that persona's instructions and runtime policy, and provider, model, and reasoning must be one of that persona's declared routes. Without a persona it runs in your permission and interaction modes, or in narrower ones you set with runtime_mode and interaction_mode. Without a persona its model must be one the project's Models for custom members list allows; an ineligible one is refused with the eligible models. Attach files to the brief with attachments. Choose its workspace every time (see the workspace field). A new worktree is prepared after this returns, and the agent begins once it is bound, possibly while the project's setup script is still running; if preparing it fails, the agent's thread shows why, and it is not retried. Reuse client_request_id to retry the same spawn safely; reusing it with any change to the request is refused, so use a fresh one for new work.";
+ "Spawn a Peer Agent: a full-citizen teammate with its own top-level thread, starting on your brief as its first turn. It joins your project unless you name another with project_id or set scratch for none, and records you as its immutable spawner; in your own project it is placed under you. It is addressable the moment this returns. In your brief, tell the new agent what it should do first and whether it should reply to you. Choose provider, model, and reasoning for the work in the brief — see orchestrator_capabilities for what's available. To run a persona from j5_list_personas, set `persona` to its id: the spawn gets that persona's instructions and runtime policy, and provider, model, and reasoning must be one of that persona's declared routes. Without a persona it runs in your permission and interaction modes, or in narrower ones you set with runtime_mode and interaction_mode. Without a persona its model and reasoning level must be ones the project's Models for custom members lists allow; an ineligible one is refused with the eligible ones. Attach files to the brief with attachments. Choose its workspace every time (see the workspace field). A new worktree is prepared after this returns, and the agent begins once it is bound, possibly while the project's setup script is still running; if preparing it fails, the agent's thread shows why, and it is not retried. Reuse client_request_id to retry the same spawn safely; reusing it with any change to the request is refused, so use a fresh one for new work.";
export const J5_LIST_AGENTS_DESCRIPTION =
"List the personas in this environment: id, purpose, runtime policy, whether each can start now, and the provider, model, and reasoning it would run on. Read this before choosing a persona for j5_spawn_agent or a crew roster so the choice fits the task and the user's budget. Read-only.";
export const J5_PROPOSE_CREW_DESCRIPTION =
- "Propose the crew you need for the brief you were given. Use it when the user asks for a crew or the work splits into distinct responsibilities that should run at once. Mix saved personas and custom seats in the same roster: call j5_list_personas when choosing a saved persona, or leave persona unset for a custom seat with its own instructions (required) and the brief. Custom seats inherit your harness, model, and reasoning by default and run with full-access unless you set runtime_mode; to choose different ones, set model_selection (instanceId, model, options) and/or runtime_mode using orchestrator_capabilities. A custom seat's model, yours included, must be one the project's Models for custom members list allows; an ineligible one is refused with the eligible models. Saved personas are proposed with their own configuration; only the human may override their runtime before approval. To have the crew follow a playbook, set playbook to a name from j5_playbook_list and give seats the step ids they own (steps, from j5_playbook_read); a step has one owner, steps no seat owns are yours as Captain, and the result reports unowned steps and any step whose persona differs from its seat's. For a crew built from a playbook, staff one seat per distinct persona its steps name, each owning that persona's steps, and propose a custom seat, noted in its reason, where a named persona isn't available. Every seat names its workspace, with the same three choices as j5_spawn_agent. Name the crew for what it is for and give each seat a short lowercase-hyphen name like code-reviewer. By default the user reviews and edits the roster in this thread, then approves or declines. If Auto-approve new Crews is on for your project, the proposed roster is created immediately with no approval card. The result says whether it is open or approved; the launch report arrives here once creation finishes or fails. Approval creates seats without starting turns. Send each member its first assignment when it has work; reuse finished members for follow-up work in the same thread. Each seat keeps its configured access and tool approvals, which may exceed yours. You become the crew's Captain and may command several crews at once; later requests, stops, and archives name the crew they mean. Use j5_send_message for member-to-member, member-to-Captain, and Captain-to-Captain coordination, including findings and direct results; artifacts do not gate these conversations. Reuse client_request_id to retry safely; a changed request is refused, so use a fresh one for new work. This tool works under every sandbox and approval policy, including approval policy never; never refuse the brief because approvals are disabled.";
+ "Propose the crew you need for the brief you were given. Use it when the user asks for a crew or the work splits into distinct responsibilities that should run at once. Mix saved personas and custom seats in the same roster: call j5_list_personas when choosing a saved persona, or leave persona unset for a custom seat with its own instructions (required) and the brief. Custom seats inherit your harness, model, and reasoning by default and run with full-access unless you set runtime_mode; to choose different ones, set model_selection (instanceId, model, options) and/or runtime_mode using orchestrator_capabilities. A custom seat's model and reasoning level, yours included, must be ones the project's Models for custom members lists allow; an ineligible one is refused with the eligible ones. Saved personas are proposed with their own configuration; only the human may override their runtime before approval. To have the crew follow a playbook, set playbook to a name from j5_playbook_list and give seats the step ids they own (steps, from j5_playbook_read); a step has one owner, steps no seat owns are yours as Captain, and the result reports unowned steps and any step whose persona differs from its seat's. For a crew built from a playbook, staff one seat per distinct persona its steps name, each owning that persona's steps, and propose a custom seat, noted in its reason, where a named persona isn't available. Every seat names its workspace, with the same three choices as j5_spawn_agent. Name the crew for what it is for and give each seat a short lowercase-hyphen name like code-reviewer. By default the user reviews and edits the roster in this thread, then approves or declines. If Auto-approve new Crews is on for your project, the proposed roster is created immediately with no approval card. The result says whether it is open or approved; the launch report arrives here once creation finishes or fails. Approval creates seats without starting turns. Send each member its first assignment when it has work; reuse finished members for follow-up work in the same thread. Each seat keeps its configured access and tool approvals, which may exceed yours. You become the crew's Captain and may command several crews at once; later requests, stops, and archives name the crew they mean. Use j5_send_message for member-to-member, member-to-Captain, and Captain-to-Captain coordination, including findings and direct results; artifacts do not gate these conversations. Reuse client_request_id to retry safely; a changed request is refused, so use a fresh one for new work. This tool works under every sandbox and approval policy, including approval policy never; never refuse the brief because approvals are disabled.";
export const J5_REQUEST_CREW_MEMBER_DESCRIPTION =
- "Add one seat directly to a running crew you command when the work needs expertise the roster lacks. No human approval is needed, regardless of Auto-approve new Crews. Give a seat name, a persona id from j5_list_personas or required instructions for a custom seat, a reason identifying the missing expertise, and its workspace (the same choices as j5_propose_crew). Custom seats inherit your model selection and run with full-access unless you set model_selection or runtime_mode; a custom seat's model must be one the project's Models for custom members list allows, and saved personas use their own configuration. Optionally give a brief; otherwise the seat gets the Crew's brief. On a playbook Crew, steps may claim only unowned step ids from j5_playbook_read. The result returns the updated roster or refuses the seat with its name and reason; creation is reported separately here. The new member waits for its first assignment; send it with j5_send_message when the work is ready. Each member's configured access still controls tool approvals. Captain-only: a member sends the concern to its Captain with j5_send_message. Reuse client_request_id to retry safely; a changed request is refused, so use a fresh one for new work. Works under every approval policy, including approval policy never.";
+ "Add one seat directly to a running crew you command when the work needs expertise the roster lacks. No human approval is needed, regardless of Auto-approve new Crews. Give a seat name, a persona id from j5_list_personas or required instructions for a custom seat, a reason identifying the missing expertise, and its workspace (the same choices as j5_propose_crew). Custom seats inherit your model selection and run with full-access unless you set model_selection or runtime_mode; a custom seat's model and reasoning level must be ones the project's Models for custom members lists allow, and saved personas use their own configuration. Optionally give a brief; otherwise the seat gets the Crew's brief. On a playbook Crew, steps may claim only unowned step ids from j5_playbook_read. The result returns the updated roster or refuses the seat with its name and reason; creation is reported separately here. The new member waits for its first assignment; send it with j5_send_message when the work is ready. Each member's configured access still controls tool approvals. Captain-only: a member sends the concern to its Captain with j5_send_message. Reuse client_request_id to retry safely; a changed request is refused, so use a fresh one for new work. Works under every approval policy, including approval policy never.";
export const J5_STOP_AGENT_DESCRIPTION =
"Stop one Peer Agent the way a user Stop does: its running turn is interrupted now, turns already queued behind it, messages you sent it included, are held until a person resumes its queue or the next message reaches it (that message resumes the queue and runs after them, in order), its pull request watches end, and the tasks it delegated stop too. The agent remains, stays readable, and can be messaged again later — stopping halts work, it retires nothing. It reaches any agent on this server, in any project. Reuse client_request_id to retry safely.";
diff --git a/apps/server/src/j5/a2a/spawnWorkspace.test.ts b/apps/server/src/j5/a2a/spawnWorkspace.test.ts
index 87d725f71926f..2320ea5ba9d8e 100644
--- a/apps/server/src/j5/a2a/spawnWorkspace.test.ts
+++ b/apps/server/src/j5/a2a/spawnWorkspace.test.ts
@@ -376,7 +376,10 @@ const spawnHarness = (input: {
id: "reasoningEffort",
label: "Reasoning",
type: "select" as const,
- options: [{ id: "high", label: "High" }],
+ options: [
+ { id: "low", label: "Low" },
+ { id: "high", label: "High" },
+ ],
},
],
},
@@ -660,6 +663,80 @@ it.effect(
}),
);
+const codexWithLevels = {
+ ...codexSolAndTerra,
+ models: ["gpt-5.6-sol", "gpt-5.6-terra"].map((slug) => ({
+ slug,
+ name: slug,
+ capabilities: {
+ optionDescriptors: [
+ {
+ id: "reasoningEffort",
+ label: "Reasoning",
+ type: "select",
+ options: [
+ { id: "low", label: "Low" },
+ { id: "high", label: "High" },
+ ],
+ },
+ ],
+ },
+ })),
+} as unknown as ServerProvider;
+const lowOnly = {
+ crewMemberReasoning: [{ instanceId: ProviderInstanceId.make("codex"), level: "low" }],
+};
+
+it.effect("a plain spawn runs at a reasoning level its project's list allows", () =>
+ Effect.gen(function* () {
+ const { layer, call, commands } = yield* spawnHarness({
+ checkout: { isRepo: true, refName: "j5/main" },
+ memberModels: crewMemberModelsLayer({
+ providers: [codexWithLevels],
+ settings: lowOnly,
+ projectTitle: "Billing Migration",
+ }),
+ });
+ yield* Effect.gen(function* () {
+ const refused = yield* call({ ...spawnArgs, client_request_id: "off-list-level" });
+ assert.isTrue(refused.isFailure);
+ for (const part of [
+ "Reasoning level high of gpt-5.6-sol on codex",
+ "Billing Migration",
+ "Models for custom members in Agent Setup",
+ "Eligible levels for gpt-5.6-sol: low.",
+ ])
+ assert.include(message(refused), part);
+ assert.lengthOf(yield* Ref.get(commands), 0, "a refused spawn creates nothing");
+ const allowed = yield* call({
+ ...spawnArgs,
+ reasoning: "low",
+ client_request_id: "on-list-level",
+ });
+ assert.isFalse(allowed.isFailure);
+ }).pipe(Effect.provide(layer));
+ }),
+);
+
+it.effect(
+ "a retry of a spawn that already created its agent is not held to a level list saved since",
+ () =>
+ Effect.gen(function* () {
+ const { layer, call } = yield* spawnHarness({
+ checkout: { isRepo: true, refName: "j5/main" },
+ existingChildRuntimeMode: "full-access",
+ memberModels: crewMemberModelsLayer({
+ providers: [codexWithLevels],
+ settings: lowOnly,
+ }),
+ });
+ yield* Effect.gen(function* () {
+ const replayed = yield* call({ ...spawnArgs, client_request_id: "already-created" });
+ assert.isFalse(replayed.isFailure);
+ }).pipe(Effect.provide(layer));
+ }),
+);
+
it.effect("spawns an agent with no project into a folder of its own", () =>
Effect.gen(function* () {
const { layer, call, commands } = yield* spawnHarness({
diff --git a/apps/server/src/j5/agents/agentDelegation.ts b/apps/server/src/j5/agents/agentDelegation.ts
index 613446a6a34ea..ad63dfe13ea59 100644
--- a/apps/server/src/j5/agents/agentDelegation.ts
+++ b/apps/server/src/j5/agents/agentDelegation.ts
@@ -38,7 +38,7 @@ export type J5DelegateTaskInput = typeof J5DelegateTaskInput.Type;
* fallback.
*/
export const J5_DELEGATE_TASK_DESCRIPTION =
- "Run one task as a J5-owned child of THIS thread with only the supplied task prompt; parent conversation history is not copied. Pass persona=ID when the user writes @persona:ID or asks for a persona by name: the server pins that persona's instructions, provider, model, reasoning, and runtime policy, so omit target and runtimeMode. Give the persona a self-contained task, and if that call fails, report the error instead of substituting a plain child. Without persona, this is a plain J5-tracked child for cross-provider work or for work the user wants tracked as a J5 task; for an ordinary subagent request, use your provider's native subagent mechanism instead. The childThreadId is backing storage, not an ordinary top-level thread. Set isolation to worktree for a separate checkout based on the parent local commit, with project setup completed before the child starts. Uncommitted edits are not copied; omitted isolation shares the parent checkout. Provider, model, model options (see orchestrator_capabilities), runtime mode, and interaction mode inherit unless target overrides them. Without persona the child's model, an inherited one included, must be one the project's Models for custom members list allows; a refusal lists the eligible models to retry with in target. A requested runtimeMode must be one the target provider lists in orchestrator_capabilities runtimeModes; an inherited one steps down to the broadest mode it offers. Leave runtimeMode unset unless the user asks for a supervised child: approval-required and auto-accept-edits usually make the child wait for a person at each action that needs approval. Prefer mode='async' for long work; mode='wait' blocks until completion, a blocking question, or timeout. If hasPendingQuestion, pass threadId=childThreadId to t3_pending_request_list, t3_pending_request_read (with requestId) and t3_pending_request_respond, or ask the user; the task's completion still wakes this thread. timeoutMs on mode=wait is only the parent's wait budget and does not cancel the child. waitTimedOut on that wait call means the timeout fired; keep that taskId and read status on later task_status. An async child's completion wakes this thread through a notification, steered into active turns where supported or queued otherwise, so end the turn instead of polling or spawning watchers; use task_status only when the result is needed mid-turn.";
+ "Run one task as a J5-owned child of THIS thread with only the supplied task prompt; parent conversation history is not copied. Pass persona=ID when the user writes @persona:ID or asks for a persona by name: the server pins that persona's instructions, provider, model, reasoning, and runtime policy, so omit target and runtimeMode. Give the persona a self-contained task, and if that call fails, report the error instead of substituting a plain child. Without persona, this is a plain J5-tracked child for cross-provider work or for work the user wants tracked as a J5 task; for an ordinary subagent request, use your provider's native subagent mechanism instead. The childThreadId is backing storage, not an ordinary top-level thread. Set isolation to worktree for a separate checkout based on the parent local commit, with project setup completed before the child starts. Uncommitted edits are not copied; omitted isolation shares the parent checkout. Provider, model, model options (see orchestrator_capabilities), runtime mode, and interaction mode inherit unless target overrides them. Without persona the child's model and reasoning level, inherited ones included, must be ones the project's Models for custom members lists allow; a refusal lists the eligible ones to retry with in target. A requested runtimeMode must be one the target provider lists in orchestrator_capabilities runtimeModes; an inherited one steps down to the broadest mode it offers. Leave runtimeMode unset unless the user asks for a supervised child: approval-required and auto-accept-edits usually make the child wait for a person at each action that needs approval. Prefer mode='async' for long work; mode='wait' blocks until completion, a blocking question, or timeout. If hasPendingQuestion, pass threadId=childThreadId to t3_pending_request_list, t3_pending_request_read (with requestId) and t3_pending_request_respond, or ask the user; the task's completion still wakes this thread. timeoutMs on mode=wait is only the parent's wait budget and does not cancel the child. waitTimedOut on that wait call means the timeout fired; keep that taskId and read status on later task_status. An async child's completion wakes this thread through a notification, steered into active turns where supported or queued otherwise, so end the turn instead of polling or spawning watchers; use task_status only when the result is needed mid-turn.";
/** J5's delegate_task: the upstream tool with the persona extension, registered in place of it. */
export const J5DelegateTaskTool = Tool.make("delegate_task", {
@@ -52,7 +52,7 @@ export const J5DelegateTaskTool = Tool.make("delegate_task", {
OrchestratorMcpService,
ThreadManagementService,
ProviderRegistry.ProviderRegistry,
- // A plain child's model is held to the project's list of models for custom members.
+ // A plain child's model and reasoning level are held to the project's lists for custom members.
CrewMemberModels,
],
})
@@ -67,7 +67,8 @@ export const delegateTask = Effect.fn("j5.delegateTask")(function* (input: J5Del
const service = yield* OrchestratorMcpService;
const memberModels = yield* CrewMemberModels;
// A persona runs on its own model; a plain child, even one that inherits its parent's model,
- // runs on one the project's list allows. Upstream calls this with the model it resolved.
+ // runs on a model and level the project's lists allow. Upstream calls this with the model it
+ // resolved.
return yield* service.delegateTask(scope, {
...delegate,
authorizeTarget: ({ projectId, modelSelection }) =>
@@ -76,7 +77,10 @@ export const delegateTask = Effect.fn("j5.delegateTask")(function* (input: J5Del
(error) =>
new OrchestratorMcpFailure({
code: "model_unavailable",
- message: `${error.message} Retry with target set to one of them as providerInstanceId and model.`,
+ message:
+ error._tag === "CrewMemberModelNotEligibleError"
+ ? `${error.message} Retry with target set to one of them as providerInstanceId and model.`
+ : `${error.message} Retry with target options setting the model's reasoning option to one of them.`,
}),
),
),
diff --git a/apps/server/src/j5/agents/agentSubagent.integration.test.ts b/apps/server/src/j5/agents/agentSubagent.integration.test.ts
index f2edc98c3895f..b2be3912584ee 100644
--- a/apps/server/src/j5/agents/agentSubagent.integration.test.ts
+++ b/apps/server/src/j5/agents/agentSubagent.integration.test.ts
@@ -49,6 +49,7 @@ const modelSelection = {
model: BUILT_IN_AGENT_PERSONAS.scout.modelRoute[0].model,
};
const otherModel = "gpt-5.6-other";
+const plainModel = "gpt-5.6-plain";
const provider: ServerProvider = {
instanceId: modelSelection.instanceId,
driver: ProviderDriverKind.make("codex"),
@@ -61,21 +62,28 @@ const provider: ServerProvider = {
availability: "available",
slashCommands: [],
skills: [],
- models: [modelSelection.model, otherModel].map((slug) => ({
- slug,
- name: "Model",
- isCustom: false,
- capabilities: {
- optionDescriptors: [
- {
- id: "reasoningEffort",
- label: "Reasoning",
- type: "select" as const,
- options: [{ id: "high", label: "High" }],
- },
- ],
- },
- })),
+ models: [
+ ...[modelSelection.model, otherModel].map((slug) => ({
+ slug,
+ name: "Model",
+ isCustom: false,
+ capabilities: {
+ optionDescriptors: [
+ {
+ id: "reasoningEffort",
+ label: "Reasoning",
+ type: "select" as const,
+ options: [
+ { id: "high", label: "High", isDefault: true },
+ { id: "low", label: "Low" },
+ ],
+ },
+ ],
+ },
+ })),
+ // A model that advertises no reasoning option has no level to hold.
+ { slug: plainModel, name: "Plain", isCustom: false, capabilities: null },
+ ],
};
const adapter = {
instanceId: modelSelection.instanceId,
@@ -329,3 +337,73 @@ it.effect("holds a plain delegated child to the list, inherited model included",
assert.include(none.message, "nothing is checked");
}).pipe(Effect.provide(listedLayer)),
);
+
+it.effect("holds a plain delegated child to the level list, an inherited level included", () =>
+ Effect.gen(function* () {
+ const { orchestrator, scope } = yield* runningParent;
+ const settings = yield* ServerSettings.ServerSettingsService;
+ const asParent = Effect.provideService(McpInvocationContext, scope);
+ const plain = (
+ clientRequestId: string,
+ target?: { readonly model: string; readonly level?: string },
+ ) =>
+ delegateTask({
+ task: "Plain child work.",
+ clientRequestId,
+ ...(target === undefined
+ ? {}
+ : {
+ target: {
+ providerInstanceId: modelSelection.instanceId,
+ model: target.model,
+ ...(target.level === undefined
+ ? {}
+ : { options: [{ id: "reasoningEffort", value: target.level }] }),
+ },
+ }),
+ }).pipe(asParent);
+ const level = { instanceId: modelSelection.instanceId, level: "low" };
+
+ // The parent runs on its model's default level, high, which this list leaves out.
+ yield* settings.updateSettings({ crewMemberReasoning: [level] });
+ const refused = yield* plain("inherits").pipe(Effect.flip);
+ assert.equal(refused.code, "model_unavailable");
+ for (const part of [
+ `Reasoning level high of ${modelSelection.model}`,
+ "Billing Migration",
+ "Models for custom members in Agent Setup",
+ `Eligible levels for ${modelSelection.model}: low.`,
+ "Retry with target options",
+ ])
+ assert.include(refused.message, part);
+
+ // A persona runs on its own level, a model with no reasoning option has nothing to hold, and
+ // an explicit checked level works.
+ const persona = yield* delegateTask({
+ task: "Return a short evidence brief.",
+ persona: "scout",
+ clientRequestId: "persona",
+ }).pipe(asParent);
+ assert.equal(
+ (yield* orchestrator.getThreadProjection(persona.childThreadId)).thread.modelSelection.model,
+ modelSelection.model,
+ );
+ yield* plain("plain-model", { model: plainModel });
+ const explicit = yield* plain("explicit", { model: otherModel, level: "low" });
+ assert.equal(
+ (yield* orchestrator.getThreadProjection(explicit.childThreadId)).thread.modelSelection.model,
+ otherModel,
+ );
+ const unchecked = yield* plain("unchecked", { model: otherModel, level: "high" }).pipe(
+ Effect.flip,
+ );
+ assert.include(unchecked.message, `Reasoning level high of ${otherModel}`);
+
+ // A list saved afterwards does not refuse the retry of a delegation already accepted.
+ yield* settings.updateSettings({ crewMemberReasoning: [] });
+ const replayed = yield* plain("explicit", { model: otherModel, level: "low" });
+ assert.equal(replayed.childThreadId, explicit.childThreadId);
+ const none = yield* plain("fresh", { model: otherModel, level: "low" }).pipe(Effect.flip);
+ assert.include(none.message, "No reasoning level");
+ }).pipe(Effect.provide(listedLayer)),
+);
diff --git a/apps/server/src/j5/agents/crewMemberModels.ts b/apps/server/src/j5/agents/crewMemberModels.ts
index 0d5d3ec1c0068..02faf8994f8f2 100644
--- a/apps/server/src/j5/agents/crewMemberModels.ts
+++ b/apps/server/src/j5/agents/crewMemberModels.ts
@@ -1,7 +1,11 @@
import type { ModelSelection, ProjectId } from "@t3tools/contracts";
import {
crewMemberModelRefusal,
+ crewMemberReasoningRefusal,
+ crewMemberSelectionLevel,
+ eligibleCrewMemberLevelsForModel,
eligibleCrewMemberModels,
+ isCrewMemberLevelChecked,
isCrewMemberModelChecked,
} from "@t3tools/contracts/j5";
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
@@ -37,18 +41,42 @@ export class CrewMemberModelNotEligibleError extends Schema.TaggedError()(
+ "CrewMemberReasoningNotEligibleError",
+ {
+ projectId: Schema.String,
+ projectTitle: Schema.String,
+ instanceId: Schema.String,
+ model: Schema.String,
+ level: Schema.String,
+ eligible: Schema.Array(Schema.Struct({ level: Schema.String, label: Schema.String })),
+ },
+) {
+ override get message(): string {
+ return crewMemberReasoningRefusal({
+ selection: this,
+ projectTitle: this.projectTitle,
+ eligible: this.eligible,
+ });
+ }
+}
+
/**
- * The one place that decides whether a resolved model may run a custom worker in a project: a
- * Crew's custom member, a plain `j5_spawn_agent`, or a plain `delegate_task`. Persona seats that
- * keep their persona's model never reach it.
+ * The one place that decides whether a resolved model and reasoning level may run a custom worker
+ * in a project: a Crew's custom member, a plain `j5_spawn_agent`, or a plain `delegate_task`.
+ * Persona seats that keep their persona's selection never reach it.
*/
export class CrewMemberModels extends Context.Service<
CrewMemberModels,
{
readonly assertEligible: (input: {
readonly projectId: ProjectId;
- readonly selection: Pick;
- }) => Effect.Effect;
+ readonly selection: Pick;
+ }) => Effect.Effect<
+ void,
+ CrewMemberModelNotEligibleError | CrewMemberReasoningNotEligibleError
+ >;
}
>()("t3/j5/agents/crewMemberModels") {}
@@ -58,26 +86,48 @@ export const layer = Layer.effect(
const settings = yield* ServerSettings.ServerSettingsService;
const registry = yield* ProviderRegistry;
const projects = yield* ProjectService;
+ const projectTitleOf = (projectId: ProjectId) =>
+ projects.getById(projectId).pipe(
+ Effect.map(Option.map((project) => project.title)),
+ Effect.map(Option.getOrElse(() => projectId as string)),
+ Effect.orElseSucceed(() => projectId as string),
+ );
const assertEligible: CrewMemberModels["Service"]["assertEligible"] = Effect.fn(
"j5.crewMemberModels.assertEligible",
)(function* ({ projectId, selection }) {
- const list = yield* settings.getSettings.pipe(
- Effect.map((all) => resolveProjectSettings(all, projectId).settings.crewMemberModels),
+ const resolved = yield* settings.getSettings.pipe(
+ Effect.map((all) => resolveProjectSettings(all, projectId).settings),
Effect.orDie,
);
- if (isCrewMemberModelChecked(list, selection)) return;
- const eligible = eligibleCrewMemberModels(list, yield* registry.getProviders);
- const projectTitle = yield* projects.getById(projectId).pipe(
- Effect.map(Option.map((project) => project.title)),
- Effect.map(Option.getOrElse(() => projectId as string)),
- Effect.orElseSucceed(() => projectId as string),
+ const list = resolved.crewMemberModels;
+ if (!isCrewMemberModelChecked(list, selection)) {
+ return yield* new CrewMemberModelNotEligibleError({
+ projectId,
+ projectTitle: yield* projectTitleOf(projectId),
+ instanceId: selection.instanceId,
+ model: selection.model,
+ eligible: eligibleCrewMemberModels(list, yield* registry.getProviders),
+ });
+ }
+ // With no saved list every level is eligible, so the catalog is not read at all.
+ const levels = resolved.crewMemberReasoning;
+ if (levels === null) return;
+ const provider = (yield* registry.getProviders).find(
+ (candidate) => candidate.instanceId === selection.instanceId,
+ );
+ const level = crewMemberSelectionLevel(
+ provider?.models.find((model) => model.slug === selection.model),
+ selection.options,
);
- return yield* new CrewMemberModelNotEligibleError({
+ if (provider === undefined || level === null) return;
+ if (isCrewMemberLevelChecked(levels, { instanceId: provider.instanceId, level })) return;
+ return yield* new CrewMemberReasoningNotEligibleError({
projectId,
- projectTitle,
+ projectTitle: yield* projectTitleOf(projectId),
instanceId: selection.instanceId,
model: selection.model,
- eligible,
+ level,
+ eligible: eligibleCrewMemberLevelsForModel(levels, provider, selection.model),
});
});
return CrewMemberModels.of({ assertEligible });
diff --git a/docs/j5/product/a2a/agent-tools.md b/docs/j5/product/a2a/agent-tools.md
index f0291a180cccc..a072289697941 100644
--- a/docs/j5/product/a2a/agent-tools.md
+++ b/docs/j5/product/a2a/agent-tools.md
@@ -83,8 +83,7 @@ for the work in the brief — see orchestrator_capabilities for what's available
from j5_list_personas, set `persona` to its id: the spawn gets that persona's instructions and
runtime policy, and provider, model, and reasoning must be one of that persona's declared routes.
Without a persona it runs in your permission and interaction modes, or in narrower ones you set with
-runtime_mode and interaction_mode. Without a persona its model must be one the project's Models for
-custom members list allows; an ineligible one is refused with the eligible models. Attach files to
+runtime_mode and interaction_mode. Without a persona its model and reasoning level must be ones the project's Models for custom members lists allow; an ineligible one is refused with the eligible ones. Attach files to
the brief with attachments. Choose its workspace every time (see the workspace field). A new worktree is prepared after this returns, and the agent
begins once it is bound, possibly while the project's setup script is still running; if preparing it
fails, the agent's thread shows why, and it is not retried. Reuse client_request_id to retry the
@@ -202,9 +201,7 @@ custom seats in the same roster: call j5_list_personas when choosing a saved per
persona unset for a custom seat with its own instructions (required) and the brief. Custom seats
inherit your harness, model, and reasoning by default and run with full-access unless you set
runtime_mode; to choose different ones, set model_selection (instanceId, model, options) and/or
-runtime_mode using orchestrator_capabilities. A custom seat's model, yours included, must be one
-the project's Models for custom members list allows; an ineligible one is refused with the eligible
-models. Saved personas are proposed with their own configuration; only the human may override their runtime before approval. To have the crew follow
+runtime_mode using orchestrator_capabilities. A custom seat's model and reasoning level, yours included, must be ones the project's Models for custom members lists allow; an ineligible one is refused with the eligible ones. Saved personas are proposed with their own configuration; only the human may override their runtime before approval. To have the crew follow
a playbook, set playbook to a name from j5_playbook_list and give seats the step ids they own
(steps, from j5_playbook_read); a step has one owner, steps no seat owns are yours as Captain, and
the result reports unowned steps and any step whose persona differs from its seat's. For a crew
@@ -258,7 +255,7 @@ caller, persona-backed where a seat names one, records the Crew snapshot with ea
a `` launch report into the caller's thread immediately after creation: the roster, what the user changed against the proposal, and per seat `start=waiting|started|failed|pending`, with a `seat_failed` line carrying the run's error (`not_started` when the seat's thread exists but registration failed) and a `seat_not_created` line for an approved seat whose thread was never created, which is left off the roster. A proposal resolves once: a seat that fails does not stop the others or reopen the gate. Declines post the decline at once.
Every seat names its workspace, with the same three choices as `j5_spawn_agent`, so there is no Captain-aware default (Jackson, 2026-10-03). Each seat's workspace resolves at preview against the Captain's repository, and the approval token binds it, as it binds the Captain's branch and worktree. Every preview also carries the Captain's current branch, the directory its branch picker searches, and its worktrees, for the roster card's editor; the branches themselves are searched live, so no list is capped. A seat the person adds starts in the Captain's checkout. A seat recorded before workspaces were required stays readable but is refused at preview and approval until one is chosen. New and added seats wait for their first assignment. A direct chat message, participant message, or playbook handoff activates the seat with its approved instructions and shared brief, the current roster with responsibilities and participant ids, and the assignment with its envelope and reply obligation intact. A new-worktree seat prepares its workspace before running that assignment; failed preparation is reported as a seat failure.
New Crews require human approval by default. **Settings → Agent Setup → Crews → Auto-approve new Crews** skips that gate, off by default and overridable per project. The server reads the Captain's project setting only for a new request; changing it leaves existing Crews and open proposals alone. Automatic approval launches the proposed configuration through the same provider, workspace, capacity, and persona checks. Tool approvals still follow each seat's access. The persisted proposal and launch report distinguish automatic approval from a human decision.
-**Models for custom members** is a project setting holding the checked provider models; until one is saved every model is eligible. A custom seat, including one that inherits the Captain's model, must run on an eligible model, checked at preview, at approval, and for an automatic launch, so a roster naming another is refused whole before anything spawns, with an error naming the seat, the model, the project and the setting and listing the eligible models. A saved persona seat that keeps the persona's model skips the check; one whose model the person changed on the card is checked like a custom seat. An accepted proposal is not checked again.
+**Models for custom members** is a pair of project settings holding the checked provider models and the checked reasoning levels; until a list is saved everything it covers is eligible. A custom seat, including one that inherits the Captain's selection, must run on an eligible model at an eligible level (its explicit one, or the model's default), checked at preview, at approval, and for an automatic launch, so a roster naming another is refused whole before anything spawns, with an error naming the seat, the model or level, the project and the setting and listing the eligible ones. A model with no reasoning option has no level to check. A saved persona seat that keeps the persona's model and level skips the check; one where the person changed either on the card is checked like a custom seat. An accepted proposal is not checked again.
### `j5_request_crew_member`
@@ -267,8 +264,7 @@ lacks. No human approval is needed, regardless of Auto-approve new Crews. Give a
persona id from j5_list_personas or required instructions for a custom seat, a reason identifying
the missing expertise, and its workspace (the same choices as j5_propose_crew). Custom seats
inherit your model selection and run with full-access unless you set model_selection or
-runtime_mode; a custom seat's model must be one the project's Models for custom members list
-allows, and saved personas use their own configuration. Optionally give a brief; otherwise the
+runtime_mode; a custom seat's model and reasoning level must be ones the project's Models for custom members lists allow, and saved personas use their own configuration. Optionally give a brief; otherwise the
seat gets the Crew's brief. On a playbook Crew, steps may claim only unowned step ids from
j5_playbook_read. The result returns the updated roster or refuses the seat with its name and
reason; creation is reported separately here. The new member waits for its first assignment; send
From ffa8fb4f6134d07cd62301ee448e28f47564213e Mon Sep 17 00:00:00 2001
From: Bryant Derosier
Date: Tue, 27 Oct 2026 19:29:11 -0400
Subject: [PATCH 3/6] feat(web): choose reasoning levels for custom members in
Agent Setup and the roster card (reasoning levels)
Co-Authored-By: Claude Sonnet 5.5
---
.../src/j5/crew/CrewMemberModelsSettings.tsx | 164 +++++++++++++-----
.../web/src/j5/crew/CrewProposalCard.test.tsx | 63 ++++++-
apps/web/src/j5/crew/CrewProposalCard.tsx | 7 +-
.../src/j5/crew/CrewProposalMemberDialog.tsx | 8 +-
apps/web/src/j5/crew/CrewSeatEditor.tsx | 41 +++--
.../j5/crew/crewMemberModels.logic.test.ts | 152 ++++++++++++++++
.../web/src/j5/crew/crewMemberModels.logic.ts | 145 +++++++++++++++-
apps/web/src/j5/crew/useCrewMemberModels.ts | 29 +++-
8 files changed, 544 insertions(+), 65 deletions(-)
diff --git a/apps/web/src/j5/crew/CrewMemberModelsSettings.tsx b/apps/web/src/j5/crew/CrewMemberModelsSettings.tsx
index 3564aeae8e267..ab1ad2b5efb5f 100644
--- a/apps/web/src/j5/crew/CrewMemberModelsSettings.tsx
+++ b/apps/web/src/j5/crew/CrewMemberModelsSettings.tsx
@@ -1,15 +1,20 @@
import { useAtomValue } from "@effect/atom-react";
import type { EnvironmentId, ServerProvider } from "@t3tools/contracts";
import {
+ crewMemberLevelCounts,
crewMemberModelCounts,
+ crewMemberProviderLevels,
+ isCrewMemberLevelChecked,
isCrewMemberModelChecked,
isCrewMemberProviderSetUp,
type CrewMemberModel,
type CrewMemberModels,
+ type CrewMemberReasoning,
+ type CrewMemberReasoningLevel,
} from "@t3tools/contracts/j5";
import { Link } from "@tanstack/react-router";
import { AlertTriangleIcon, ChevronDownIcon, ChevronRightIcon } from "lucide-react";
-import { useMemo, useState } from "react";
+import { useMemo, useState, type ReactNode } from "react";
import { ProviderInstanceIcon } from "../../components/chat/ProviderInstanceIcon";
import { SettingResetButton, SettingsRow } from "../../components/settings/settingsLayout";
@@ -26,16 +31,20 @@ import { serverEnvironment } from "../../state/server";
import { useEnvironmentQuery } from "../../state/query";
import { agentPersonaEnvironment } from "../agents/agentPersonaAtoms";
import {
+ crewMemberLevelsSummary,
crewMemberModelLabel,
crewMemberModelsSummary,
+ crewMemberProviderSummary,
personasOffCrewMemberModels,
+ setCrewMemberLevelChecked,
setCrewMemberModelChecked,
setCrewMemberProviderChecked,
+ setCrewMemberProviderLevelsChecked,
} from "./crewMemberModels.logic";
const NO_ENVIRONMENT = "" as EnvironmentId;
-/** One model: solid when allowed. Every chip fills its grid cell, so they all match in size. */
+/** One model or level: solid when allowed. Every chip fills its grid cell, so they all match in size. */
function ModelChip(props: {
readonly name: string;
readonly checked: boolean;
@@ -57,17 +66,40 @@ function ModelChip(props: {
);
}
+interface CrewMemberListsPatch {
+ readonly crewMemberModels?: ReadonlyArray;
+ readonly crewMemberReasoning?: ReadonlyArray;
+}
+
+function ChipGroup(props: { readonly label: string; readonly children: ReactNode }) {
+ return (
+
- Personas keep their own model.
+ Personas keep their own model and level.
{offList.length > 0
? ` ${offList.join(", ")} ${offList.length === 1 ? "uses" : "use"} an unchecked one.`
: ""}{" "}
diff --git a/apps/web/src/j5/crew/CrewProposalCard.test.tsx b/apps/web/src/j5/crew/CrewProposalCard.test.tsx
index 420025f3fba2b..218aa79e877ea 100644
--- a/apps/web/src/j5/crew/CrewProposalCard.test.tsx
+++ b/apps/web/src/j5/crew/CrewProposalCard.test.tsx
@@ -20,6 +20,7 @@ const state = vi.hoisted(() => ({
preview: vi.fn(),
read: vi.fn(),
memberModels: null as ReadonlyArray<{ instanceId: string; model: string }> | null,
+ memberReasoning: null as ReadonlyArray<{ instanceId: string; level: string }> | null,
}));
vi.mock("@effect/atom-react", () => ({ useAtomValue: (atom: unknown) => atom }));
vi.mock("../state", () => ({
@@ -30,7 +31,10 @@ vi.mock("../a2a/ParticipantIdentitiesClient", () => ({
useParticipantLabels: () => new Map([["captain", "Release Captain"]]),
}));
vi.mock("../sharing/access", () => ({ useCanOperateThread: () => state.permitted }));
-vi.mock("./useCrewMemberModels", () => ({ useCrewMemberModels: () => state.memberModels }));
+vi.mock("./useCrewMemberModels", () => ({
+ useCrewMemberModels: () => state.memberModels,
+ useCrewMemberReasoning: () => state.memberReasoning,
+}));
vi.mock("../../state/query", () => ({
useEnvironmentQuery: (query: unknown) => ({ data: query === "crew-proposals" ? [proposal] : {} }),
}));
@@ -78,6 +82,25 @@ const codexProvider: ServerProvider = {
models: [
{ slug: "gpt-6", name: "GPT-6", isCustom: false, capabilities: null },
{ slug: "other-model", name: "Other model", isCustom: false, capabilities: null },
+ {
+ slug: "deep",
+ name: "Deep",
+ isCustom: false,
+ capabilities: {
+ optionDescriptors: [
+ {
+ id: "reasoningEffort",
+ label: "Reasoning",
+ type: "select",
+ options: [
+ { id: "low", label: "Low" },
+ { id: "medium", label: "Medium", isDefault: true },
+ { id: "high", label: "High" },
+ ],
+ },
+ ],
+ },
+ },
],
};
const providers: ReadonlyArray = [
@@ -149,6 +172,7 @@ beforeEach(() => {
);
state.permitted = true;
state.memberModels = null;
+ state.memberReasoning = null;
state.preview.mockReset().mockImplementation(preview);
state.read.mockReset().mockImplementation(({ input }: { input: { personaId: string } }) =>
Promise.resolve({
@@ -646,3 +670,40 @@ it("leaves a persona member's pickers whole, since it runs on its own model", as
await click(button("reviewer model"));
expect(option("reviewer model", "Other model")).toBeDefined();
});
+
+it("offers a custom member only the reasoning levels its project's list allows", async () => {
+ state.memberReasoning = [
+ { instanceId: "codex", level: "low" },
+ { instanceId: "codex", level: "high" },
+ ];
+ await render();
+ await click(button("Edit seat builder"));
+ await click(button("builder model"));
+ await click(option("builder model", "Deep"));
+ // The model's default, medium, is not allowed, so the seat starts on the first allowed level.
+ expect(button("builder reasoning").textContent).toContain("Low");
+ await click(button("builder reasoning"));
+ expect(option("builder reasoning", "Low")).toBeDefined();
+ expect(option("builder reasoning", "High")).toBeDefined();
+ expect(option("builder reasoning", "Medium")).toBeUndefined();
+ await click(option("builder reasoning", "High"));
+ await click(button("Save changes"));
+ await click(approve());
+ expect(resolve.mock.calls[0]?.[1][0].modelSelection).toEqual({
+ instanceId: "codex",
+ model: "deep",
+ options: [{ id: "reasoningEffort", value: "high" }],
+ });
+});
+
+it("leaves a persona member's reasoning picker whole", async () => {
+ state.memberReasoning = [{ instanceId: "codex", level: "low" }];
+ await render();
+ await click(button("Edit seat reviewer"));
+ await click(button("reviewer model"));
+ await click(option("reviewer model", "Deep"));
+ expect(button("reviewer reasoning").textContent).toContain("Medium");
+ await click(button("reviewer reasoning"));
+ expect(option("reviewer reasoning", "Medium")).toBeDefined();
+ expect(option("reviewer reasoning", "High")).toBeDefined();
+});
diff --git a/apps/web/src/j5/crew/CrewProposalCard.tsx b/apps/web/src/j5/crew/CrewProposalCard.tsx
index 6a19ec50b4d3a..20c2d44570a33 100644
--- a/apps/web/src/j5/crew/CrewProposalCard.tsx
+++ b/apps/web/src/j5/crew/CrewProposalCard.tsx
@@ -17,7 +17,7 @@ import { describePersonaSwap, removedSeatSteps, stepTitle, unownedSteps } from "
import { CrewProposalMemberDialog } from "./CrewProposalMemberDialog";
import type { CrewProposalRow } from "./crewProposalDraft";
import { CrewProposalMemberRow } from "./CrewProposalMemberRow";
-import { useCrewMemberModels } from "./useCrewMemberModels";
+import { useCrewMemberModels, useCrewMemberReasoning } from "./useCrewMemberModels";
import { useCrewProposalPreview } from "./useCrewProposalPreview";
import { ComposerBanner } from "../../components/chat/ComposerBanner";
import { useCanOperateThread } from "../sharing/access";
@@ -63,6 +63,10 @@ export function CrewProposalCard(props: {
props.environmentId,
proposal.captainThreadId as ThreadId,
);
+ const memberReasoning = useCrewMemberReasoning(
+ props.environmentId,
+ proposal.captainThreadId as ThreadId,
+ );
const [rows, setRows] = useState(
() =>
readCrewProposalDraft(props.environmentId, proposal.id) ??
@@ -338,6 +342,7 @@ export function CrewProposalCard(props: {
environmentId={props.environmentId}
workspaceOptions={preview.workspaceOptions}
memberModels={memberModels}
+ memberReasoning={memberReasoning}
agents={agents}
disabled={props.busy}
onClose={() => setEditing(null)}
diff --git a/apps/web/src/j5/crew/CrewProposalMemberDialog.tsx b/apps/web/src/j5/crew/CrewProposalMemberDialog.tsx
index f373d7cd0b2be..02d90e3c72d57 100644
--- a/apps/web/src/j5/crew/CrewProposalMemberDialog.tsx
+++ b/apps/web/src/j5/crew/CrewProposalMemberDialog.tsx
@@ -2,7 +2,11 @@ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
import { XIcon } from "lucide-react";
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import type { EnvironmentId } from "@t3tools/contracts";
-import type { CrewMemberModels, CrewWorkspaceOptions } from "@t3tools/contracts/j5";
+import type {
+ CrewMemberModels,
+ CrewMemberReasoning,
+ CrewWorkspaceOptions,
+} from "@t3tools/contracts/j5";
import { useEffect, useEffectEvent, useMemo, useState, type RefObject } from "react";
import { Button } from "../../components/ui/button";
@@ -34,6 +38,7 @@ export function CrewProposalMemberDialog(props: {
environmentId: EnvironmentId | null;
workspaceOptions?: CrewWorkspaceOptions | undefined;
memberModels?: CrewMemberModels | undefined;
+ memberReasoning?: CrewMemberReasoning | undefined;
agents: ReadonlyArray<{ personaId: string; displayName: string }>;
disabled: boolean;
onClose: () => void;
@@ -146,6 +151,7 @@ export function CrewProposalMemberDialog(props: {
runtime={runtime}
workspaceOptions={props.workspaceOptions ?? preview.workspaceOptions}
memberModels={props.memberModels}
+ memberReasoning={props.memberReasoning}
disabled={props.disabled}
loadingInstructions={loadingPersona}
onChange={setValue}
diff --git a/apps/web/src/j5/crew/CrewSeatEditor.tsx b/apps/web/src/j5/crew/CrewSeatEditor.tsx
index 6ecd055c0344f..5867940d7136e 100644
--- a/apps/web/src/j5/crew/CrewSeatEditor.tsx
+++ b/apps/web/src/j5/crew/CrewSeatEditor.tsx
@@ -3,6 +3,7 @@ import type { EnvironmentId } from "@t3tools/contracts";
import {
isCrewMemberModelChecked,
type CrewMemberModels,
+ type CrewMemberReasoning,
type CrewProposalSeatRuntime,
type CrewWorkspaceOptions,
} from "@t3tools/contracts/j5";
@@ -36,6 +37,7 @@ import {
setCrewReasoning,
type CrewSeatDraft,
} from "./crewSeatRuntime";
+import { crewReasoningChoicesFor, withEligibleCrewReasoning } from "./crewMemberModels.logic";
interface CrewSeatEditorProps {
readonly value: CrewSeatDraft;
@@ -46,6 +48,8 @@ interface CrewSeatEditorProps {
readonly workspaceOptions?: CrewWorkspaceOptions | undefined;
/** The project's models for custom members; a custom member's pickers offer only these. */
readonly memberModels?: CrewMemberModels | undefined;
+ /** The project's reasoning levels for custom members; the reasoning picker offers only these. */
+ readonly memberReasoning?: CrewMemberReasoning | undefined;
readonly disabled: boolean;
readonly loadingInstructions?: boolean;
readonly onPersonaChange: (personaId: string) => void;
@@ -221,9 +225,11 @@ function CrewSeatWorkspaceField(props: CrewSeatEditorProps) {
function CrewSeatRuntimeFields(props: CrewSeatEditorProps & { environmentId: EnvironmentId }) {
const providers = useAtomValue(serverEnvironment.providersValueAtom(props.environmentId)) ?? [];
- // A custom member runs on a model the project's list allows; a persona keeps its own model, so
- // its pickers stay whole (the server checks a persona seat whose model was changed).
- const memberModels = props.value.agentId === CUSTOM_AGENT ? props.memberModels : null;
+ // A custom member runs on a model and level the project's lists allow; a persona keeps its own,
+ // so its pickers stay whole (the server checks a persona seat whose model or level was changed).
+ const custom = props.value.agentId === CUSTOM_AGENT;
+ const memberModels = custom ? props.memberModels : null;
+ const memberReasoning = custom ? props.memberReasoning : null;
const choices = useMemo(
() =>
providers.flatMap((provider) => {
@@ -257,15 +263,7 @@ function CrewSeatRuntimeFields(props: CrewSeatEditorProps & { environmentId: Env
const reasoningValue =
selection?.options?.find(({ id }) => id === reasoning?.id)?.value ??
getProviderOptionCurrentValue(reasoning);
- const reasoningChoices =
- reasoning?.type === "select"
- ? reasoning.options
- : reasoning?.type === "boolean"
- ? [
- { id: "true", label: "On" },
- { id: "false", label: "Off" },
- ]
- : [];
+ const reasoningChoices = crewReasoningChoicesFor(reasoning, provider, memberReasoning);
const mode = CREW_ACCESS_OPTIONS.find(({ value: mode }) => mode === value.runtimeMode);
const accessOptions =
provider?.driver === "acpRegistry"
@@ -290,7 +288,14 @@ function CrewSeatRuntimeFields(props: CrewSeatEditorProps & { environmentId: Env
nextProvider?.models.find((candidate) => candidate.slug === selection?.model) ??
nextProvider?.models[0];
if (nextProvider && nextModel)
- props.onChange(chooseCrewHarness(value, nextProvider, nextModel));
+ props.onChange(
+ withEligibleCrewReasoning(
+ chooseCrewHarness(value, nextProvider, nextModel),
+ nextProvider,
+ nextModel,
+ memberReasoning,
+ ),
+ );
}}
>
@@ -335,7 +340,15 @@ function CrewSeatRuntimeFields(props: CrewSeatEditorProps & { environmentId: Env
}
onValueChange={(slug) => {
const nextModel = offered?.models.find((candidate) => candidate.slug === slug);
- if (offered && nextModel) props.onChange(chooseCrewHarness(value, offered, nextModel));
+ if (offered && nextModel)
+ props.onChange(
+ withEligibleCrewReasoning(
+ chooseCrewHarness(value, offered, nextModel),
+ offered,
+ nextModel,
+ memberReasoning,
+ ),
+ );
}}
>
diff --git a/apps/web/src/j5/crew/crewMemberModels.logic.test.ts b/apps/web/src/j5/crew/crewMemberModels.logic.test.ts
index ff519412aac03..05f35c844b559 100644
--- a/apps/web/src/j5/crew/crewMemberModels.logic.test.ts
+++ b/apps/web/src/j5/crew/crewMemberModels.logic.test.ts
@@ -1,16 +1,23 @@
import {
ProviderInstanceId,
+ type ModelSelection,
type OrchestrationV2AgentPersonaCatalog,
type ServerProvider,
} from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";
import {
+ crewMemberLevelsSummary,
crewMemberModelLabel,
crewMemberModelsSummary,
+ crewMemberProviderSummary,
+ crewReasoningChoicesFor,
personasOffCrewMemberModels,
+ setCrewMemberLevelChecked,
setCrewMemberModelChecked,
setCrewMemberProviderChecked,
+ setCrewMemberProviderLevelsChecked,
+ withEligibleCrewReasoning,
} from "./crewMemberModels.logic";
const codex = ProviderInstanceId.make("codex");
@@ -102,3 +109,148 @@ describe("crew member models settings logic", () => {
expect(personasOffCrewMemberModels(null, [])).toEqual([]);
});
});
+
+const effort = (id: string, levels: ReadonlyArray, defaultId?: string) => ({
+ id,
+ label: "Reasoning",
+ type: "select" as const,
+ options: levels.map((level) => ({
+ id: level,
+ label: level.toUpperCase(),
+ ...(level === defaultId ? { isDefault: true } : {}),
+ })),
+});
+const withLevels = (
+ instanceId: ProviderInstanceId,
+ models: ReadonlyArray<{ slug: string; levels: ReadonlyArray; defaultId?: string }>,
+) =>
+ ({
+ ...provider(instanceId, []),
+ models: models.map((model) => ({
+ slug: model.slug,
+ name: model.slug,
+ capabilities: {
+ optionDescriptors: [effort("reasoningEffort", model.levels, model.defaultId)],
+ },
+ })),
+ }) as unknown as ServerProvider;
+const leveled = [
+ withLevels(codex, [
+ { slug: "a", levels: ["low", "high"], defaultId: "high" },
+ { slug: "b", levels: ["medium", "high", "xhigh"] },
+ ]),
+ provider(claude, ["x"]),
+];
+const level = (instanceId: ProviderInstanceId, id: string) => ({ instanceId, level: id });
+
+describe("crew member reasoning settings logic", () => {
+ it("starts from the whole level catalog when the first chip is unchecked", () => {
+ expect(setCrewMemberLevelChecked(null, leveled, level(codex, "high"), false)).toEqual([
+ level(codex, "low"),
+ level(codex, "medium"),
+ level(codex, "xhigh"),
+ ]);
+ });
+
+ it("checks a level once and keeps entries for levels the catalog no longer lists", () => {
+ const saved = [level(codex, "retired")];
+ const checked = setCrewMemberLevelChecked(saved, leveled, level(codex, "low"), true);
+ expect(checked).toEqual([level(codex, "retired"), level(codex, "low")]);
+ expect(setCrewMemberLevelChecked(checked, leveled, level(codex, "low"), true)).toEqual(checked);
+ expect(setCrewMemberLevelChecked(checked, leveled, level(codex, "low"), false)).toEqual(saved);
+ });
+
+ it("checks and unchecks a whole provider's levels without touching the others", () => {
+ const other = [level(claude, "max")];
+ const all = setCrewMemberProviderLevelsChecked(other, leveled, leveled[0]!, true);
+ expect(all).toEqual([
+ level(claude, "max"),
+ level(codex, "low"),
+ level(codex, "high"),
+ level(codex, "medium"),
+ level(codex, "xhigh"),
+ ]);
+ expect(setCrewMemberProviderLevelsChecked(all, leveled, leveled[0]!, false)).toEqual(other);
+ });
+
+ it("counts checked levels in the catalog and warns when a saved list leaves none", () => {
+ expect(crewMemberLevelsSummary(null, leveled)).toEqual({
+ label: "4 of 4",
+ nothingEligible: false,
+ });
+ expect(
+ crewMemberLevelsSummary([level(codex, "low"), level(codex, "retired")], leveled),
+ ).toEqual({ label: "1 of 4", nothingEligible: false });
+ expect(crewMemberLevelsSummary([], leveled).nothingEligible).toBe(true);
+ // A provider with no levels has nothing to warn about.
+ expect(crewMemberLevelsSummary([], [provider(claude, ["x"])]).nothingEligible).toBe(false);
+ });
+
+ it("summarizes a provider's models and levels, and only its models when it has no levels", () => {
+ expect(crewMemberProviderSummary(leveled[0]!, [pair(codex, "a")], [level(codex, "low")])).toBe(
+ "1 of 2 models · 1 of 4 levels",
+ );
+ expect(crewMemberProviderSummary(leveled[0]!, null, null)).toBe(
+ "2 of 2 models · 4 of 4 levels",
+ );
+ expect(crewMemberProviderSummary(leveled[1]!, [], [])).toBe("0 of 1 models");
+ });
+
+ it("narrows a custom member's reasoning picker to the allowed levels and leaves a persona's whole", () => {
+ const descriptor = effort("reasoningEffort", ["medium", "high", "xhigh"]);
+ const allowed = [level(codex, "high")];
+ expect(crewReasoningChoicesFor(descriptor, leveled[0], allowed).map(({ id }) => id)).toEqual([
+ "high",
+ ]);
+ // A persona's list is passed as null, which allows everything.
+ expect(crewReasoningChoicesFor(descriptor, leveled[0], null)).toHaveLength(3);
+ expect(crewReasoningChoicesFor(undefined, leveled[0], allowed)).toEqual([]);
+ // A thinking switch is not a level, so a list never narrows it.
+ expect(
+ crewReasoningChoicesFor(
+ { id: "thinking", label: "Thinking", type: "boolean" },
+ leveled[0],
+ [],
+ ).map(({ id }) => id),
+ ).toEqual(["true", "false"]);
+ });
+
+ it("starts a changed model on its first allowed level when its default is not allowed", () => {
+ const [codexProvider] = leveled;
+ const modelB = codexProvider!.models[1]!;
+ const draft = {
+ modelSelection: {
+ instanceId: codex,
+ model: "b",
+ options: [{ id: "reasoningEffort", value: "medium" }],
+ },
+ };
+ // The model's selected level is allowed, so nothing changes.
+ expect(withEligibleCrewReasoning(draft, codexProvider!, modelB, [level(codex, "medium")])).toBe(
+ draft,
+ );
+ const changed = withEligibleCrewReasoning(draft, codexProvider!, modelB, [
+ level(codex, "xhigh"),
+ level(codex, "high"),
+ ]);
+ // In the model's own order: high comes before xhigh.
+ expect(changed.modelSelection.options).toEqual([{ id: "reasoningEffort", value: "high" }]);
+ // No list saved, or no allowed level at all: the seat is left as it is.
+ expect(withEligibleCrewReasoning(draft, codexProvider!, modelB, null)).toBe(draft);
+ expect(withEligibleCrewReasoning(draft, codexProvider!, modelB, [])).toBe(draft);
+ });
+
+ it("judges a selection with no explicit level by the model's default", () => {
+ const modelA = leveled[0]!.models[0]!;
+ const draft: { modelSelection: ModelSelection } = {
+ modelSelection: { instanceId: codex, model: "a" },
+ };
+ expect(withEligibleCrewReasoning(draft, leveled[0]!, modelA, [level(codex, "high")])).toBe(
+ draft,
+ );
+ expect(
+ withEligibleCrewReasoning(draft, leveled[0]!, modelA, [level(codex, "low")]).modelSelection
+ .options,
+ ).toEqual([{ id: "reasoningEffort", value: "low" }]);
+ });
+});
diff --git a/apps/web/src/j5/crew/crewMemberModels.logic.ts b/apps/web/src/j5/crew/crewMemberModels.logic.ts
index 8a804e3615e1c..33c945f92c225 100644
--- a/apps/web/src/j5/crew/crewMemberModels.logic.ts
+++ b/apps/web/src/j5/crew/crewMemberModels.logic.ts
@@ -1,12 +1,28 @@
-import type { OrchestrationV2AgentPersonaCatalog, ServerProvider } from "@t3tools/contracts";
import {
+ agentPersonaReasoningDescriptor,
+ type ModelSelection,
+ type OrchestrationV2AgentPersonaCatalog,
+ type ProviderOptionDescriptor,
+ type ServerProvider,
+ type ServerProviderModel,
+} from "@t3tools/contracts";
+import {
+ crewMemberLevelCounts,
crewMemberModelCounts,
+ crewMemberProviderLevels,
+ crewMemberSelectionLevel,
+ eligibleCrewMemberLevelsForModel,
+ isCrewMemberLevelChecked,
isCrewMemberModelChecked,
isCrewMemberProviderSetUp,
type CrewMemberModel,
type CrewMemberModels,
+ type CrewMemberReasoning,
+ type CrewMemberReasoningLevel,
} from "@t3tools/contracts/j5";
+import { setCrewReasoning } from "./crewSeatRuntime";
+
type ModelKey = Pick;
const sameModel = (left: ModelKey, right: ModelKey) =>
@@ -86,3 +102,130 @@ export const personasOffCrewMemberModels = (
? [persona.displayName]
: [],
);
+
+type LevelKey = Pick;
+
+const sameLevel = (left: LevelKey, right: LevelKey) =>
+ left.instanceId === right.instanceId && left.level === right.level;
+
+/** Every level of every provider a person can choose from, as checked pairs. */
+const levelCatalogEntries = (
+ providers: ReadonlyArray,
+): ReadonlyArray =>
+ providers.filter(isCrewMemberProviderSetUp).flatMap((provider) =>
+ crewMemberProviderLevels(provider).map(({ level }) => ({
+ instanceId: provider.instanceId,
+ level,
+ })),
+ );
+
+/** The level list after one chip is changed, starting from the whole catalog when none was saved. */
+export const setCrewMemberLevelChecked = (
+ list: CrewMemberReasoning,
+ providers: ReadonlyArray,
+ key: LevelKey,
+ checked: boolean,
+): ReadonlyArray => {
+ const without = (list ?? levelCatalogEntries(providers)).filter(
+ (entry) => !sameLevel(entry, key),
+ );
+ return checked ? [...without, { instanceId: key.instanceId, level: key.level }] : without;
+};
+
+/** The level list after every level of one provider is checked or unchecked. */
+export const setCrewMemberProviderLevelsChecked = (
+ list: CrewMemberReasoning,
+ providers: ReadonlyArray,
+ provider: ServerProvider,
+ checked: boolean,
+): ReadonlyArray => {
+ const others = (list ?? levelCatalogEntries(providers)).filter(
+ (entry) => entry.instanceId !== provider.instanceId,
+ );
+ return checked
+ ? [
+ ...others,
+ ...crewMemberProviderLevels(provider).map(({ level }) => ({
+ instanceId: provider.instanceId,
+ level,
+ })),
+ ]
+ : others;
+};
+
+/** "3 of 4" levels, and whether a saved list leaves no level eligible. */
+export const crewMemberLevelsSummary = (
+ list: CrewMemberReasoning,
+ providers: ReadonlyArray,
+) => {
+ const { checked, total } = crewMemberLevelCounts(list, providers);
+ return {
+ label: `${checked} of ${total}`,
+ nothingEligible: list !== null && total > 0 && checked === 0,
+ };
+};
+
+/** What one provider's card header says: "1 of 8 models", then its levels when it has any. */
+export const crewMemberProviderSummary = (
+ provider: ServerProvider,
+ models: CrewMemberModels,
+ reasoning: CrewMemberReasoning,
+): string => {
+ const modelCounts = crewMemberModelCounts(models, [provider]);
+ const levelCounts = crewMemberLevelCounts(reasoning, [provider]);
+ const modelsText = `${modelCounts.checked} of ${modelCounts.total} models`;
+ return levelCounts.total === 0
+ ? modelsText
+ : `${modelsText} · ${levelCounts.checked} of ${levelCounts.total} levels`;
+};
+
+/**
+ * The choices a seat's reasoning picker offers. A custom member's list narrows a select reasoning
+ * option to the levels the project allows; pass `null` for a persona, whose picker stays whole.
+ */
+export const crewReasoningChoicesFor = (
+ descriptor: ProviderOptionDescriptor | undefined,
+ provider: Pick | undefined,
+ allowed: CrewMemberReasoning | undefined,
+): ReadonlyArray<{ readonly id: string; readonly label: string }> => {
+ if (descriptor === undefined) return [];
+ if (descriptor.type === "boolean")
+ return [
+ { id: "true", label: "On" },
+ { id: "false", label: "Off" },
+ ];
+ const isLevel =
+ agentPersonaReasoningDescriptor({ capabilities: { optionDescriptors: [descriptor] } }) !==
+ undefined;
+ return !isLevel || provider === undefined
+ ? descriptor.options
+ : descriptor.options.filter((choice) =>
+ isCrewMemberLevelChecked(allowed, { instanceId: provider.instanceId, level: choice.id }),
+ );
+};
+
+/**
+ * A custom member's seat after its model or provider changed: when the level it would run at is not
+ * allowed, the first allowed level of that model is chosen, so the card never starts on a level the
+ * server would refuse. A model with no allowed level is left as it is; approval refuses it.
+ */
+export const withEligibleCrewReasoning = (
+ draft: T,
+ provider: Pick,
+ model: ServerProviderModel,
+ allowed: CrewMemberReasoning | undefined,
+): T => {
+ const descriptor = agentPersonaReasoningDescriptor(model);
+ const selection = draft.modelSelection;
+ if (descriptor === undefined || selection === undefined) return draft;
+ const level = crewMemberSelectionLevel(model, selection.options);
+ if (
+ level === null ||
+ isCrewMemberLevelChecked(allowed, { instanceId: provider.instanceId, level })
+ )
+ return draft;
+ const first = eligibleCrewMemberLevelsForModel(allowed, provider, model.slug)[0];
+ return first === undefined
+ ? draft
+ : { ...draft, modelSelection: setCrewReasoning(selection, descriptor, first.level) };
+};
diff --git a/apps/web/src/j5/crew/useCrewMemberModels.ts b/apps/web/src/j5/crew/useCrewMemberModels.ts
index 57784a3540b52..eead85fd4d473 100644
--- a/apps/web/src/j5/crew/useCrewMemberModels.ts
+++ b/apps/web/src/j5/crew/useCrewMemberModels.ts
@@ -1,6 +1,6 @@
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
-import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
-import type { CrewMemberModels } from "@t3tools/contracts/j5";
+import type { EnvironmentId, ServerSettings, ThreadId } from "@t3tools/contracts";
+import type { CrewMemberModels, CrewMemberReasoning } from "@t3tools/contracts/j5";
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
import { useServerConfigs, useThreadShell } from "../../state/entities";
@@ -8,19 +8,32 @@ import { useServerConfigs, useThreadShell } from "../../state/entities";
const NO_ENVIRONMENT = "" as EnvironmentId;
/**
- * The models custom members may run on in the Captain's project, as the server will check them:
- * the environment's list, or the project's own. `null` while either is unknown, which offers every
- * model, so the card never hides a choice the server would allow.
+ * One of the lists custom members are held to in the Captain's project, as the server will check
+ * it: the environment's list, or the project's own. `null` while either is unknown, which offers
+ * everything, so the card never hides a choice the server would allow.
*/
-export function useCrewMemberModels(
+function useCrewMemberList(
+ key: Key,
environmentId: EnvironmentId | null,
captainThreadId: ThreadId,
-): CrewMemberModels {
+): ServerSettings[Key] | null {
const projectId =
useThreadShell(environmentId === null ? null : scopeThreadRef(environmentId, captainThreadId))
?.projectId ?? null;
const config = useServerConfigs().get(environmentId ?? NO_ENVIRONMENT);
return config === undefined || projectId === null
? null
- : resolveProjectSettings(config.settings, projectId).settings.crewMemberModels;
+ : resolveProjectSettings(config.settings, projectId).settings[key];
}
+
+/** The models custom members may run on in the Captain's project. */
+export const useCrewMemberModels = (
+ environmentId: EnvironmentId | null,
+ captainThreadId: ThreadId,
+): CrewMemberModels => useCrewMemberList("crewMemberModels", environmentId, captainThreadId);
+
+/** The reasoning levels custom members may run at in the Captain's project. */
+export const useCrewMemberReasoning = (
+ environmentId: EnvironmentId | null,
+ captainThreadId: ThreadId,
+): CrewMemberReasoning => useCrewMemberList("crewMemberReasoning", environmentId, captainThreadId);
From 36b6e228934ffb9e2d014326596d102509136c26 Mon Sep 17 00:00:00 2001
From: Bryant Derosier
Date: Tue, 27 Oct 2026 19:31:21 -0400
Subject: [PATCH 4/6] docs(j5): record the reasoning-level lists in Crews,
Agent Setup, FORK.md and the divergence register (reasoning levels)
Co-Authored-By: Claude Sonnet 5.5
---
FORK.md | 2 +-
docs/j5/product/a2a/agent-tools.md | 6 +++---
docs/j5/product/features/crews.md | 12 +++++++-----
docs/j5/product/upstream.md | 10 +++++-----
docs/j5/user/personas.md | 4 ++--
5 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/FORK.md b/FORK.md
index 7972b5ebd1ab0..3efb5f7f308ec 100644
--- a/FORK.md
+++ b/FORK.md
@@ -485,7 +485,7 @@ migrations after upstream migrations.
89. Deferred Crew assignments ([#745](https://github.com/Jacksondr5/j5code/issues/745)): `orchestration-v2/runtimeLayer.ts` wraps the shared orchestrator with J5-owned `CrewDeliveryContext.ts` for first-assignment workspace preparation and guards, and supplies J5-owned `CrewTurnContext.ts` to provider turn start and provider turn control. `orchestration-v2/ProviderTurnStartService.ts` asks that service whether the thread is a Crew seat (one indexed read) and delegates only a seat's selected assignment text to it immediately around provider delivery; every other thread keeps upstream's fast path and delivery unchanged, and `CrewDeliveryContext.ts` likewise passes any non-seat thread's dispatch straight through. `orchestration-v2/ProviderTurnControlService.ts` wraps the live session with the service's `steering`, one hook beside upstream's `steerTurn` call, so a message steered into a busy seat carries the current context too. The service builds the approved introduction or net roster changes from the current roster, sends the full introduction again when the provider conversation it reached is replaced (a model or provider switch, or a missing native session rebuilt from history), and records what it sent only after the provider accepts the prompt; a send that never happens (the run was stopped or superseded before `startTurn`) leaves it owed. Editable messages and shared author prefixes stay unchanged, so queued edits, cancellations and reordering cannot consume context. Waiting seats whose Crew is retired fail visibly; a retained worktree guard applies even after retirement. J5 migration 49 owns the context, and `CrewSeatPreparation.ts` uses upstream's persisted preparation path. `orchestration-v2/ProviderTurnStartService.test.ts` and `ProviderTurnControlService.test.ts` exercise the hooks against the real seat context, including a retained and a replaced native conversation and a Stop before the provider send. On an advance, retain the hooks at actual delivery and steering after queue selection, shared by every provider and transport.
-90. Models for custom members ([#744](https://github.com/Jacksondr5/j5code/issues/744), register D39, Bryant's approval of the upstream edit to `delegateTask`): `packages/contracts/src/settings.ts` imports J5's `CrewMemberModels` schema (`packages/contracts/src/j5/crewMemberModels.ts`) and registers `crewMemberModels`, a nullable list of checked `(providerInstanceId, model)` pairs (never saved is `null`, every model eligible), in the project-scoped key list, project overrides (also in the nullable-override list), server settings and patches. `apps/server/src/mcp/OrchestratorMcpService.ts` gives `delegateTask` an optional `authorizeTarget` input, called right after `resolveTargetRechecking` with the child's project and resolved model selection unless the command already has a receipt, so a plain `delegate_task` is checked on the model the child will actually run on, inherited included. Upstream behavior is unchanged when no hook is passed; J5's `agents/agentDelegation.ts` passes one that calls the J5-owned `CrewMemberModels` service (`apps/server/src/j5/agents/crewMemberModels.ts`), which Crew launches and `j5_spawn_agent` also call. `apps/server/src/mcp/toolkits/worktree/registration.test.ts` stubs that service among the J5 tool dependencies, and `packages/shared/src/projectSettings.test.ts` gains one case for the key's whole-list replace and project override. On an advance, keep the one call after the target resolves and before anything is created.
+90. Models for custom members ([#744](https://github.com/Jacksondr5/j5code/issues/744), register D39, Bryant's approval of the upstream edit to `delegateTask`): `packages/contracts/src/settings.ts` imports J5's `CrewMemberModels` and `CrewMemberReasoning` schemas (`packages/contracts/src/j5/crewMemberModels.ts`, `crewMemberReasoning.ts`) and registers `crewMemberModels`, a nullable list of checked `(providerInstanceId, model)` pairs, and `crewMemberReasoning`, the same for `(providerInstanceId, level)` pairs (never saved is `null`, everything eligible), each in the project-scoped key list, project overrides (also in the nullable-override list), server settings and patches: one import line and five lines per key, the second key beside the first. `apps/server/src/mcp/OrchestratorMcpService.ts` gives `delegateTask` an optional `authorizeTarget` input, called right after `resolveTargetRechecking` with the child's project and resolved model selection unless the command already has a receipt, so a plain `delegate_task` is checked on the model the child will actually run on, inherited included. Upstream behavior is unchanged when no hook is passed; J5's `agents/agentDelegation.ts` passes one that calls the J5-owned `CrewMemberModels` service (`apps/server/src/j5/agents/crewMemberModels.ts`), which Crew launches and `j5_spawn_agent` also call; the service checks the model and then the reasoning level of the same resolved selection, so the one hook covers both lists. `apps/server/src/mcp/toolkits/worktree/registration.test.ts` stubs that service among the J5 tool dependencies, and `packages/shared/src/projectSettings.test.ts` gains one case for each key's whole-list replace and project override. On an advance, keep the one call after the target resolves and before anything is created.
## Pin and upstream advance runbook
diff --git a/docs/j5/product/a2a/agent-tools.md b/docs/j5/product/a2a/agent-tools.md
index a072289697941..ac393768a120b 100644
--- a/docs/j5/product/a2a/agent-tools.md
+++ b/docs/j5/product/a2a/agent-tools.md
@@ -121,7 +121,7 @@ work."
**Result:** the new agent's `participant_id` and `thread_id`, its `project_id` and `project_title`, and its placement with the caller recorded as spawner: under the caller in the caller's own project, and with no parent in another or when the caller is an outside agent.
-**Errors**, each naming state and next command: the caller is a provider Subagent; the caller's membership is missing or ambiguous; the caller's project ledger cannot be read; the caller sits in a Crew (naming its Captain as the escalation and `delegate_task` for its own subagents; only a Captain grows a Crew, through the gate); the chosen workspace can't be used (a path that isn't one of the project's worktrees, a `base_ref` that doesn't resolve, a `branch` that exists, an unreadable repository); the model, with no persona, is off the project's list of models for custom members; the `client_request_id` is bound to a different request, or a start for it is already in flight; creation failed. For an outside agent: no `project_id` and no `scratch` (naming `t3_project_list`); the `shared` workspace (naming the three it may choose); a persona whose policy is broader than the approved level (naming the level, and a persona within it or a new sign-in at a higher level).
+**Errors**, each naming state and next command: the caller is a provider Subagent; the caller's membership is missing or ambiguous; the caller's project ledger cannot be read; the caller sits in a Crew (naming its Captain as the escalation and `delegate_task` for its own subagents; only a Captain grows a Crew, through the gate); the chosen workspace can't be used (a path that isn't one of the project's worktrees, a `base_ref` that doesn't resolve, a `branch` that exists, an unreadable repository); the model or its reasoning level, with no persona, is off the project's lists of models for custom members; the `client_request_id` is bound to a different request, or a start for it is already in flight; creation failed. For an outside agent: no `project_id` and no `scratch` (naming `t3_project_list`); the `shared` workspace (naming the three it may choose); a persona whose policy is broader than the approved level (naming the level, and a persona within it or a new sign-in at a higher level).
**Events:** participant joined, placement created.
@@ -438,7 +438,7 @@ run; `j5_stop_crew` doesn't, and unarchiving doesn't restart it.
35. `j5_spawn_agent` refuses an outside agent that passes neither `project_id` nor `scratch`, and one that asks for the `shared` workspace, each with an error naming the legal move.
36. An agent an outside agent spawns has no placement parent, records the outside agent as its spawner, and is told in its first turn that an outside agent started it and that `j5_send_message` cannot reply to it.
37. `j5_spawn_agent` gives an outside agent's spawn the level its sign-in was approved at, or a narrower mode it chose. A broader mode is refused. A persona whose policy is broader than that level is refused with an error that names the level and the legal moves.
-38. A custom Crew seat, a `j5_spawn_agent` without a persona and a `delegate_task` without a persona run only on a model the project's list of models for custom members allows, an inherited model included; a refusal names the model, the project and the setting, lists the eligible models, and creates nothing. A persona's own model is never checked, and a retry of an accepted call is not checked again.
+38. A custom Crew seat, a `j5_spawn_agent` without a persona and a `delegate_task` without a persona run only on a model and reasoning level the project's lists for custom members allow, inherited ones included; a refusal names the model or level, the project and the setting, lists the eligible ones, and creates nothing. A persona's own selection is never checked, and a retry of an accepted call is not checked again.
## History
@@ -490,4 +490,4 @@ run; `j5_stop_crew` doesn't, and unarchiving doesn't restart it.
- 2026-10-24 — `j5_send_message`'s `deliveryNotice` also tells the sender when its message waits on the receiver's held queue, failed worktree setup or usage limit, and that it should not be sent again (Jackson, [#272](https://github.com/Jacksondr5/j5code/issues/272)).
- 2026-10-24 — upstream's queue tools join the kept upstream tools; `t3_queue_edit` edits only a message the caller sent, inside its envelope (Jackson, [#136](https://github.com/Jacksondr5/j5code/issues/136)).
- 2026-10-24 — a pre-upgrade spawn retry binds its request when the workspace type matches its accepted create receipt and is refused otherwise (Jackson, 2026-10-24; [PR #660](https://github.com/Jacksondr5/j5code/pull/660)).
-- 2026-10-27 — custom Crew seats, a plain `j5_spawn_agent` and a plain `delegate_task` run only on a model the project's list of models for custom members allows, an inherited model included; AC38 (Bryant; [#744](https://github.com/Jacksondr5/j5code/issues/744)).
+- 2026-10-27 — custom Crew seats, a plain `j5_spawn_agent` and a plain `delegate_task` run only on a model and reasoning level the project's lists of models for custom members allow, inherited ones included; AC38 (Bryant; [#744](https://github.com/Jacksondr5/j5code/issues/744)).
diff --git a/docs/j5/product/features/crews.md b/docs/j5/product/features/crews.md
index c95c8052d14ee..de2193c542bb7 100644
--- a/docs/j5/product/features/crews.md
+++ b/docs/j5/product/features/crews.md
@@ -17,7 +17,7 @@ A **Crew** is a group of agents formed as a unit from a **roster its Captain pro
**Configured access controls tool approvals.** A seat runs with its proposed configuration, or the person's final configuration when a human approves it, using its persona's policy when no override is selected; the Captain may be read-only. The gate shows each seat's persona or custom-seat choice, instructions, and resolved harness, model, reasoning level, and access before approval, and the Captain's reason for a seat stays readable in its row. Human-approved rosters and legacy additions use the same preview. Automatically approved rosters and direct additions use the proposed configuration through the same runtime validation; their history records automatic approval. Automatic approval never changes a seat's tool approval policy. A custom member started automatically, by an auto-approved roster or a Captain's addition, defaults to Full access like any custom seat, so a Supervised Captain can start a Full-access member without review; that is accepted (2026-10-28), and the Agent Setup setting governs rosters only. Approval binds the displayed roster and configuration; changed configuration requires a fresh review, and a launch uses the validated resolution rather than choosing a different route afterward. Seats are checked where they are structured: a persona missing from the library or turned off, a duplicate seat name, or a roster past the cap is refused to the Captain with the next step, before anyone spawns. Prose in a brief is never parsed or validated.
-**Models for custom members.** **Settings → Agent Setup → Crews → Models for custom members** chooses which provider models custom workers may run on, as a list of checked models that a project can override like auto-approval. Until a list is saved every model is eligible; once one is saved only the checked models are, and a model added to the catalog later starts unchecked. The platform enforces the list for every custom seat, at launch and when added, auto-approved launches included, and for an agent started without a persona by `j5_spawn_agent` or `delegate_task`; the roster card offers a custom member only eligible models. The list applies when the agent is created, not afterwards: a later model change, for example an agent setting a thread's model with `t3_thread_configure`, is not limited. A persona always runs on its own configured model, even one that isn't checked, and Agent Setup names any persona whose model isn't on the list; a persona seat whose model the person changed on the card is a custom choice and is checked. The list chooses models; it is not a spending cap. **Native subagents are outside it, per provider.** Codex and Cursor choose a native subagent's model themselves and J5 only records what the provider reports once the subagent runs: not supported here. Claude shows its permission callback the subagent call and the model it asked for before the subagent starts, but J5 does not check the list there, and whether a denial would hold in every permission mode is unverified; it is not supported here either. Agent Setup says the list doesn't cover native subagents.
+**Models for custom members.** **Settings → Agent Setup → Crews → Models for custom members** chooses which provider models and which reasoning levels custom workers may use, as two lists of checked entries that a project can override like auto-approval. Until a list is saved everything it covers is eligible; once one is saved only the checked entries are, and a model or level added to the catalog later starts unchecked. The platform enforces both lists for every custom seat, at launch and when added, auto-approved launches included, and for an agent started without a persona by `j5_spawn_agent` or `delegate_task`; the roster card offers a custom member only eligible models and levels. The lists apply when the agent is created, not afterwards: a later model or reasoning change, for example an agent setting a thread's model and options with `t3_thread_configure`, is not limited. A persona always runs on its own configured model and level, even ones that aren't checked, and Agent Setup names any persona whose model isn't on the list; a persona seat whose model or level the person changed on the card is a custom choice and is checked. The lists choose models and levels; they are not a spending cap. **Native subagents are outside it, per provider.** Codex and Cursor choose a native subagent's model themselves and J5 only records what the provider reports once the subagent runs: not supported here. Claude shows its permission callback the subagent call and the model it asked for before the subagent starts, but J5 does not check the list there, and whether a denial would hold in every permission mode is unverified; it is not supported here either. Agent Setup says the list doesn't cover native subagents.
**Several people.** Where more than one person can write to a Captain's thread, "the person" in this definition is any of them. The roster and a seat's tool approvals go to everyone who can write to that thread, and the first answer settles each; anyone who can write to the Captain's thread can write to its seats too ([shared conversations](shared-conversations.md), [people and access](people-and-access.md)).
@@ -100,9 +100,11 @@ The platform ships the machinery — propose, gate, spawn, render, remind, notif
24. Until a list is saved every model is eligible and nothing changes; a saved list makes only its checked models eligible, a model new to the catalog starts unchecked, and a saved list with nothing checked makes none eligible and says so on its row.
25. A custom seat, whether the Captain proposed it, the person added it, the Captain added it, it inherits the Captain's model, or an automatic approval launches it, is refused when its model is off the list: the refusal names the seat, the model, the project and the setting, lists the eligible models, and creates nothing. The roster card offers a custom member only eligible models.
-26. A persona seat that keeps its persona's model is not checked. One whose model was changed on the card is checked like a custom seat, the two compared by provider instance and model alone. Agent Setup names any persona whose model isn't on the list.
-27. A plain `j5_spawn_agent` and a plain `delegate_task`, the child's inherited model included, are held to the list of the project the child joins. A retry of a call or proposal already accepted is not checked again.
-28. The Agent Setup row reads the checked models in the catalog over the catalog ("6 of 12"), opens in place as one card per set-up provider (one open at a time, a same-size chip for each model, solid when checked) and sends the others to Providers in one line, keeps entries for models that left the catalog, and carries the scoped-setting indicator, inheritance and reset. Its note says the list doesn't cover native subagents on Codex, Claude and Cursor.
+26. A persona seat that keeps its persona's model and level is not checked. One whose model or level was changed on the card is checked like a custom seat, the two compared by provider instance, model and reasoning level. Agent Setup names any persona whose model isn't on the list.
+27. A plain `j5_spawn_agent` and a plain `delegate_task`, the child's inherited model included, are held to the model list of the project the child joins. A retry of a call or proposal already accepted is not checked again.
+28. The Agent Setup row reads the checked models in the catalog over the catalog ("6 of 12"), opens in place as one card per set-up provider (one open at a time) and sends the others to Providers in one line. A card's header counts its models and levels ("1 of 8 models · 3 of 4 levels") and has one Check all or Uncheck all for both; under it a Models group and, for a provider with levels, a Reasoning group each show a same-size chip per entry, solid when checked. The row keeps entries that left the catalog, warns when either saved list is empty, and carries the scoped-setting indicator, inheritance and reset. Its note says the list doesn't cover native subagents on Codex, Claude and Cursor.
+29. Reasoning levels follow the same rules as models, per provider instance: until a list is saved every level is eligible, a saved list holds only the checked levels so a level new to the catalog starts unchecked, and a saved empty list makes none eligible. A provider's levels are the choices of its models' reasoning options; a thinking switch is not a level.
+30. A custom seat, a plain `j5_spawn_agent` and a plain `delegate_task` are refused when the level they would run at, the explicit one or else the model's default, is unchecked: the refusal names the level, the model, the provider, the project and the setting, lists the levels that model may use, and creates nothing. A model with no reasoning option has no level to check. The roster card offers a custom member only eligible levels and starts a changed model on its first eligible level; a persona seat's pickers stay whole. A retry of a call or proposal already accepted is not checked again.
## Scenarios
@@ -153,4 +155,4 @@ The platform ships the machinery — propose, gate, spawn, render, remind, notif
- 2026-10-22 — active peer steering covers Claude (Bryant).
- 2026-10-17 — several people (Jackson; [record](../../worklog/2026-10-16-people-and-access-session.md)): "the person" is anyone who can write to the Captain's thread, and a Crew's later requests reach all of them, which ends the stall where a guest who asked for a Crew never saw its seats' approvals (AC23; [#534](https://github.com/Jacksondr5/j5code/issues/534)).
- 2026-10-27 — the Captain's timeline shows the person only what they would act on: launch and finish notices become one line per seat that needs them, a Crew member's message a compact row, and each seat's row says how its last run ended (Bryant; [#741](https://github.com/Jacksondr5/j5code/issues/741)).
-- 2026-10-27 — models for custom members: a project's list of checked models decides what custom seats, plain spawned agents and plain delegated tasks run on; personas keep their own model; native subagents are outside the list on every provider, and AC24–AC28 (Bryant; [#744](https://github.com/Jacksondr5/j5code/issues/744)).
+- 2026-10-27 — models for custom members: a project's lists of checked models and checked reasoning levels decide what custom seats, plain spawned agents and plain delegated tasks run on; personas keep their own; native subagents are outside the lists on every provider (AC24–AC30; Bryant; [#744](https://github.com/Jacksondr5/j5code/issues/744)).
diff --git a/docs/j5/product/upstream.md b/docs/j5/product/upstream.md
index 81f3f4e9f814e..3a2086dbcf676 100644
--- a/docs/j5/product/upstream.md
+++ b/docs/j5/product/upstream.md
@@ -118,15 +118,15 @@ Letter codes in the Decided lines (SC2, QS1, AR3, and so on) are rulings recorde
**Decided:** Jackson, 2026-10-13. Recorded in FORK.md case 74.
-#### D39. A plain delegated task runs only on a model the project allows
+#### D39. A plain delegated task runs only on a model and reasoning level the project allows
**Upstream:** `delegate_task` runs the child on the model it resolves from the call's `target`, or on the parent's own model when none is given, and J5's persona-aware wrapper only sees `target`.
-**J5:** upstream's `delegateTask` takes an optional `authorizeTarget` hook that it calls with the child's project and resolved model, after resolving the target and before creating anything. J5's wrapper passes one for a call without a persona, which refuses a model that is off the project's list under Settings → Agent Setup → Crews → Models for custom members, an inherited model included, and lists the eligible models so the agent can retry with `target`. A call that names a persona, and a retry of a delegation already accepted, are not checked.
+**J5:** upstream's `delegateTask` takes an optional `authorizeTarget` hook that it calls with the child's project and resolved model, after resolving the target and before creating anything. J5's wrapper passes one for a call without a persona, which refuses a model or reasoning level that is off the project's lists under Settings → Agent Setup → Crews → Models for custom members, inherited ones included, and lists the eligible ones so the agent can retry with `target`. A call that names a persona, and a retry of a delegation already accepted, are not checked.
-**Why:** the list is one decision that custom Crew seats, `j5_spawn_agent` and `delegate_task` all follow ([Crews](features/crews.md), AC27). The wrapper cannot see the model a child inherits, so the check needs the one place that resolves it.
+**Why:** the lists are one decision that custom Crew seats, `j5_spawn_agent` and `delegate_task` all follow ([Crews](features/crews.md), AC27, AC30). The wrapper cannot see the model or level a child inherits, so the check needs the one place that resolves it.
-**Consequences:** one optional input and four lines in `OrchestratorMcpService.ts` (FORK.md case 90), with no change to upstream's behavior when no hook is passed. Check at each advance that the call still sits after the target resolves and before the command is dispatched. `t3_thread_launch` and `create_threads`, which J5 hides from agents, are not checked. The list holds when an agent is created and not afterwards: `t3_thread_configure` sets any thread's model with only a thread-write check, so a later model change is not limited.
+**Consequences:** one optional input and four lines in `OrchestratorMcpService.ts` (FORK.md case 90), with no change to upstream's behavior when no hook is passed. The reasoning levels are a second setting key beside the models one in `packages/contracts/src/settings.ts`, in the same five places, and need no further upstream edit. Check at each advance that the call still sits after the target resolves and before the command is dispatched. `t3_thread_launch` and `create_threads`, which J5 hides from agents, are not checked. The lists hold when an agent is created and not afterwards: `t3_thread_configure` sets any thread's model and options with only a thread-write check, so a later model or reasoning change is not limited.
**Decided:** Bryant, 2026-10-27 ([#744](https://github.com/Jacksondr5/j5code/issues/744)). Recorded in FORK.md case 90.
@@ -622,4 +622,4 @@ J5 kept a run from resuming after a usage-limit reset when the person had presse
- 2026-10-25 — D19: a copied prompt link points at j5.codes/new, which opens it in J5's apps or on the person's own server (Jackson's 2026-10-24 decision; [#633](https://github.com/Jacksondr5/j5code/issues/633)).
- 2026-10-25 — D4: a delivery to an agent stopped on a usage limit waits unsent until the agent continues, whether or not its queue is held, where it used to be handed over unless messages were held there; deliveries waiting unsent go together, in send order, when a run starts on the agent, where each used to wait for its own recheck (Jackson, 2026-10-24, [#718](https://github.com/Jacksondr5/j5code/issues/718)).
- 2026-10-26 — D33: a Viewer, or a Collaborator on one thread, isn't offered a new thread, a fork or a new project where their level refuses it (Jackson's 2026-10-25 approval; [#640](https://github.com/Jacksondr5/j5code/issues/640), [#641](https://github.com/Jacksondr5/j5code/issues/641)).
-- 2026-10-27 — D39 added: a plain `delegate_task` is held to the project's models for custom members through one hook in upstream's `delegateTask` (Bryant; [#744](https://github.com/Jacksondr5/j5code/issues/744)).
+- 2026-10-27 — D39 added: a plain `delegate_task` is held to the project's models and reasoning levels for custom members through one hook in upstream's `delegateTask` (Bryant; [#744](https://github.com/Jacksondr5/j5code/issues/744)).
diff --git a/docs/j5/user/personas.md b/docs/j5/user/personas.md
index 7bf66f8845947..e31e655d592fb 100644
--- a/docs/j5/user/personas.md
+++ b/docs/j5/user/personas.md
@@ -46,11 +46,11 @@ A crew is a group of agents that one agent, the Captain, runs as a unit for one
> Put together a crew to follow @docs/runbooks/release.md for the 2.4 release and report back when the PR is green.
-The agent uses the conversation to propose a roster above the composer. Each member has a responsibility, a reason for joining, and instructions. Members may use saved personas or be custom agents created for this task. You can remove members, add a saved persona, or add a custom seat with a name and instructions, then approve or decline. Custom members start with the Captain's harness, model, and reasoning level, and with Full access, as long as that model is one **Models for custom members** allows. Before approval, you can change their harness, model, reasoning level, and access, whether the agent proposed the member or you added it manually. Selecting a saved persona uses that persona's configured runtime policy. No special Captain persona is needed, and one Captain can coordinate several crews in the same conversation. Before you approve, each member shows its resolved harness, model, reasoning level, and access. Members whose access asks before acting are marked **Stops for approvals**: they pause in their own threads until you answer, so give them Full access if you will not be watching. Changing the roster refreshes these details. If the configuration changes before launch, review the refreshed settings and approve again. The preview also covers the Captain's branch and worktree, so switching the Captain's branch before you approve means reviewing a fresh preview. Each member also shows where it works, chosen by the Captain for every member it proposes: **Captain's checkout**, a **New worktree** from a base branch, or an **Existing worktree** of the project. You can change any member's choice before approving. A new worktree offers a searchable branch list, starting at the Captain's current one, with an option to start from the branch's copy on origin; an existing worktree offers the project's worktrees. A member you add yourself starts in the Captain's checkout. A new worktree's setup script starts with it, and unless the script is set to finish first, the member may begin before it does. If preparing a member's worktree fails, the Captain is told why in the launch report. A member on an ACP registry harness offers only **Supervised** and **Full access**, because those harnesses can't enforce **Auto-accept edits** or **Auto**.
+The agent uses the conversation to propose a roster above the composer. Each member has a responsibility, a reason for joining, and instructions. Members may use saved personas or be custom agents created for this task. You can remove members, add a saved persona, or add a custom seat with a name and instructions, then approve or decline. Custom members start with the Captain's harness, model, and reasoning level, and with Full access, as long as that model and level are ones **Models for custom members** allows. Before approval, you can change their harness, model, reasoning level, and access, whether the agent proposed the member or you added it manually. Selecting a saved persona uses that persona's configured runtime policy. No special Captain persona is needed, and one Captain can coordinate several crews in the same conversation. Before you approve, each member shows its resolved harness, model, reasoning level, and access. Members whose access asks before acting are marked **Stops for approvals**: they pause in their own threads until you answer, so give them Full access if you will not be watching. Changing the roster refreshes these details. If the configuration changes before launch, review the refreshed settings and approve again. The preview also covers the Captain's branch and worktree, so switching the Captain's branch before you approve means reviewing a fresh preview. Each member also shows where it works, chosen by the Captain for every member it proposes: **Captain's checkout**, a **New worktree** from a base branch, or an **Existing worktree** of the project. You can change any member's choice before approving. A new worktree offers a searchable branch list, starting at the Captain's current one, with an option to start from the branch's copy on origin; an existing worktree offers the project's worktrees. A member you add yourself starts in the Captain's checkout. A new worktree's setup script starts with it, and unless the script is set to finish first, the member may begin before it does. If preparing a member's worktree fails, the Captain is told why in the launch report. A member on an ACP registry harness offers only **Supervised** and **Full access**, because those harnesses can't enforce **Auto-accept edits** or **Auto**.
To let Captains launch new Crews without reviewing the initial roster, open **Settings → Agent Setup → Crews** and enable **Auto-approve new Crews**. It starts off. Use the settings scope to set an environment default or a project override. Changing it leaves existing Crews and open proposals alone.
-To choose which models custom members may run on, open **Settings → Agent Setup → Crews → Models for custom members**. The row reads, for example, "6 of 12"; open it to check or uncheck each model of the providers you have set up. Until you save a list, every model is allowed, and after you save one a model added later starts unchecked. If nothing is checked, no custom member can start, and the row says so. The same list applies to custom crew members, whether you or the Captain added them and whether the crew launched automatically, and to agents started without a persona by another agent. A custom member's model picker on the roster card offers only the checked models, and a model that isn't checked is refused with the models that are. Set an environment default or a project override like **Auto-approve new Crews**. Personas always run on their own model, even one that isn't checked; the row names any persona whose model isn't. The list doesn't cover native subagents, which Codex, Claude and Cursor start on a model of their own choosing.
+To choose which models and reasoning levels custom members may use, open **Settings → Agent Setup → Crews → Models for custom members**. The row reads, for example, "6 of 12" models; open it to check or uncheck each model and each reasoning level of the providers you have set up. Until you save a list, everything is allowed, and after you save one a model or level added later starts unchecked. If no model is checked, no custom member can start, and the row says so; with no level checked, custom members can't use models that have levels. The same lists apply to custom crew members, whether you or the Captain added them and whether the crew launched automatically, and to agents started without a persona by another agent. A custom member's model and reasoning pickers on the roster card offer only the checked entries, and one that isn't checked is refused with the ones that are. Set an environment default or a project override like **Auto-approve new Crews**. Personas always run on their own model and level, even ones that aren't checked; the row names any persona whose model isn't. The list doesn't cover native subagents, which Codex, Claude and Cursor start on a model of their own choosing.
A crew can follow a playbook: ask for one by name, and the Captain assigns each member the steps it owns. The roster card then shows the playbook, which member owns which step, the steps no member owns (the Captain does those), and any step whose persona differs from the member's, including when the wanted persona is missing or turned off. You can't move steps between members; removing a member leaves its steps unowned, and the card tells you. If the playbook or a persona it names changes after you open the card, approval asks you to review again.
From 7774ddda1683f922210ae79c1e099960b22aa5b0 Mon Sep 17 00:00:00 2001
From: Bryant Derosier
Date: Wed, 28 Oct 2026 07:25:27 -0400
Subject: [PATCH 5/6] test(j5): a persona seat on either route's level is
unchanged (reasoning levels)
The persona seat comparison matches a route's model and level together, so a seat frozen on the fallback route at its level skips the lists, and the same model at another level is checked.
Co-Authored-By: Claude Sonnet 5.5
---
.../src/j5/a2a/CrewLaunchService.test.ts | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/apps/server/src/j5/a2a/CrewLaunchService.test.ts b/apps/server/src/j5/a2a/CrewLaunchService.test.ts
index cd8af9279c51e..cedd4c7f44715 100644
--- a/apps/server/src/j5/a2a/CrewLaunchService.test.ts
+++ b/apps/server/src/j5/a2a/CrewLaunchService.test.ts
@@ -2522,6 +2522,39 @@ it.effect(
}).pipe(Effect.scoped),
);
+it.effect("a persona seat on either route's level is unchanged; another level is checked", () =>
+ Effect.gen(function* () {
+ const { layer, captain } = yield* eligibilityFixture({
+ providers: [
+ codexModels("gpt-5.6-sol"),
+ provider("claudeAgent", "claudeAgent", [
+ { slug: "claude-opus-5", options: ["high", "low"] },
+ ]),
+ ],
+ settings: { crewMemberReasoning: [] },
+ });
+ yield* Effect.gen(function* () {
+ const launcher = yield* CrewLaunchService;
+ const seat = (level: string) => ({
+ workspace: { type: "shared" as const },
+ name: "builder",
+ agentId: "builder",
+ reason: "Builds",
+ runtimeMode: "approval-required" as const,
+ modelSelection: {
+ instanceId: ProviderInstanceId.make("claudeAgent"),
+ model: "claude-opus-5",
+ options: [{ id: "effort", value: level }],
+ },
+ });
+ yield* launcher.resolveSeats(captain, [seat("high")]);
+ const refused = yield* launcher.resolveSeats(captain, [seat("low")]).pipe(Effect.flip);
+ assert.equal(refused._tag, "CrewLaunchModelNotEligibleError");
+ assert.include(refused.message, "Reasoning level low");
+ }).pipe(Effect.provide(layer));
+ }).pipe(Effect.scoped),
+);
+
const codexLevel = (level: string) => ({ instanceId: ProviderInstanceId.make("codex"), level });
const solAt = (value: string) => ({ ...sol, options: [{ id: "reasoningEffort", value }] });
const terraAt = (value: string) => ({ ...terra, options: [{ id: "reasoningEffort", value }] });
From 7e2bea18bfc5f4fe2fa15e3e065735db8d9efc33 Mon Sep 17 00:00:00 2001
From: Bryant Derosier
Date: Mon, 2 Nov 2026 17:50:02 -0500
Subject: [PATCH 6/6] style(j5): format the launch service after its error
class stopped being exported
Co-Authored-By: Claude Sonnet 5.5
---
apps/server/src/j5/a2a/CrewLaunchService.ts | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/apps/server/src/j5/a2a/CrewLaunchService.ts b/apps/server/src/j5/a2a/CrewLaunchService.ts
index f6f3acefb1210..cccca393fcb3e 100644
--- a/apps/server/src/j5/a2a/CrewLaunchService.ts
+++ b/apps/server/src/j5/a2a/CrewLaunchService.ts
@@ -188,9 +188,10 @@ class CrewLaunchSeatUnavailableError extends Data.TaggedError("CrewLaunchSeatUna
}
/** A custom seat's model or reasoning level is not on the project's "Models for custom members" lists. */
-class CrewLaunchModelNotEligibleError extends Data.TaggedError(
- "CrewLaunchModelNotEligibleError",
-)<{ readonly seatName: string; readonly detail: string }> {
+class CrewLaunchModelNotEligibleError extends Data.TaggedError("CrewLaunchModelNotEligibleError")<{
+ readonly seatName: string;
+ readonly detail: string;
+}> {
override get message(): string {
return `Seat ${this.seatName}: ${this.detail} Nothing was spawned.`;
}