Skip to content

Personas: an ordered model list #778

Closed

Description

@bryantderosier

Item 3 of 11 in the Personas v2: simpler specialists milestone. It ships in one release with #777 and #779.

The problem

Today a persona gets exactly two routes: a primary and a fallback. That's either too rigid, when I want three or four acceptable models in order, or it forces a fallback I don't actually want. And when a persona can't launch, j5_list_personas gives the agent one formatted string, not a reason it can act on.

Where this sits

Decision 2 of the Personas v2 proposal. This story covers the list shape, how a model gets picked from it, the agent-facing listing, and the Agent Setup editor. The limits based on who picked the persona (#781) and the reviewer preference (#782) plug into the same selection step later.

What we already have

  • Contract: modelRoute: Schema.Tuple([AgentPersonaModelTarget, AgentPersonaModelTarget]) appears in AgentPersonaEditInput, AgentPersonaDefinitionView, and AgentPersonaCreateInput. resolvedRoute on the assignment is "primary" | "fallback" | "override". AgentPersonaRouteAttempt and AgentPersonaRouteFailureCode already describe why one route failed. All of these are in packages/contracts/src/j5/agentPersona.ts.
  • Routing: apps/server/src/j5/agents/agentPersonaRouting.ts resolves the route. agentPersonaLaunch.ts, agentPersonaSpawn.ts, and agentPersonaSubagent.ts call it.
  • Listing: j5_list_personas lives in apps/server/src/j5/a2a/mcp/tools.ts:767. Its description says it returns "the provider, model, and reasoning this persona would run on right now, or null when blocked".
  • Editors: web uses AgentDefinitionFields.tsx, AgentEditorDialog.tsx, and AgentCreateDialog.tsx in apps/web/src/j5/agents/, with Primary/Fallback model pickers. Mobile has its own Agent Setup screens under apps/mobile/src/j5/agents/.
  • Usage limits: we already know when a provider is at its usage limit, because deliveries wait on it.

Proposal

A persona has an ordered list of model-and-reasoning entries, as many as it wants. When a worker is created, selection takes the first entry that passes all of these:

A provider already known to be at its usage limit is skipped. If a worker hits a usage limit mid-run, today's behavior stays: deliveries wait, and the same worker picks back up after the reset.

When the list runs out, the launch fails with one structured reason per entry. It escalates to the Captain inside a Crew, and to the person otherwise. The escalation itself is #785.

Acceptance criteria

  • The definition, create, and edit contracts carry an ordered list of entries. Each entry has a provider instance, a model, and model options.
  • Selection picks the first entry that passes every check. Tests use a list of three or more entries where the first ones fail for different reasons.
  • A provider that's known to be at its usage limit is skipped at selection.
  • An exhausted list fails with one reason per entry. Reuse or extend AgentPersonaRouteFailureCode, which covers not signed in, model not offered, and access not enforceable, and add usage limit.
  • The assignment records which entry was chosen (its index or its model) instead of primary/fallback, and old assignments still decode.
  • j5_list_personas returns the ordered entries, each with its rejection reason if it has one, instead of one formatted route string. The tool description is updated to match.
  • Agent Setup on web, desktop, and mobile can add, remove, and reorder entries, and set each entry's reasoning.
  • Persona availability badges ("Blocked") show the reason for each entry.
  • docs/j5/user/personas.md describes the ordered list instead of primary/fallback models.
  • Focused tests cover selection order, the usage-limit skip, an exhausted list with mixed reasons, and the listing shape.

Out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions