Skip to content

Personas: people can switch a persona worker's model #783

Closed

Description

@bryantderosier

Item 8 of 11 in the Personas v2: simpler specialists milestone.

The problem

Once a persona worker starts on a model, I can't change it. The server rejects any model or provider change on a persona thread with "has an immutable model route", and the web composer hides the model picker for persona threads. If a worker is stuck on a provider that hit its usage limit, or I just want it on a different model, my only option is to start over with a new worker.

The lock exists so a worker can't end up on a provider that can't enforce its access. For example, a read-only reviewer moved to Cursor could suddenly start writing code. We don't need to lock the model forever for that, though. We can just run the same check again when someone switches.

Where this sits

This is new on 28 Oct, from Bastian's comment: "A worker still keeps its model for life. Are we blocking model switching?" It replaces the proposal's "a worker keeps its model for its lifetime" line. It doesn't change how agents work: a Captain that wants a different model still replaces the worker (#784).

What we already have

  • Server lock: agentPersonaRouteLockedError and agentPersonaModelMismatchError in apps/server/src/j5/agents/agentPersonaOrchestration.ts:62-85. They reject thread.model-selection.set, provider.switch, and any message whose model selection differs from the assignment's resolvedModelSelection.
  • Upstream hooks: personaGuards.routeLocked at apps/server/src/orchestration-v2/Orchestrator.ts:2590, and personaGuards.modelMismatch at :4622. Both are already recorded in FORK.md ("All logic lives in j5/agents/agentPersonaOrchestration.ts… Do not reinline the guards"), so this should stay a change to J5 files only.
  • Web composer: apps/web/src/j5/agents/personaComposerSelection.ts always snaps the selection back to the persona's model. apps/web/src/j5/crew/crewMemberModels.logic.ts also reads resolvedModelSelection.
  • Mobile: it doesn't know about the lock at all. It just gets the server's rejection.
  • Command context: the guard's CommandContext is only { commandId, type } (agentPersonaOrchestration.ts:136). It can't tell a person's change from an agent's.
  • Agent path: agents can change a thread's model through upstream's t3_thread_configure (apps/server/src/mcp/toolkits/thread/).
  • Access checks: providerCanEnforceAgentPersonaAuthority (agentPersonaProviderPolicy.ts) is the check a switch should rerun.

Proposal

  • People can switch. I can change a persona worker's model and provider from the composer, on web, desktop, and mobile.
  • The server checks again. It runs the same checks as at launch: a signed-in provider offers the model, and that provider can enforce the persona's access. A refused switch explains why, and the worker stays on its current model.
  • It's my pick. A switch counts as a person's pick, so the eligibility list doesn't apply.
  • The record follows. The assignment records the new model and that a person switched it.
  • Same instructions. The worker keeps its launch snapshot, so its instructions and access don't change.
  • Agents still can't. A model change that an agent sends is still refused, with a message pointing at replacement.

A nice side effect: a worker that hit a usage limit can be moved to another model instead of waiting out the reset.

Acceptance criteria

  • On web and desktop, the composer on a persona thread shows the model picker and lets me pick a different model or provider.
  • On mobile, the persona thread's composer offers the same.
  • Switching to a model whose provider can enforce the persona's access works. The next turn runs on it, with the same instructions.
  • Switching to a provider that can't enforce the persona's access is refused with a reason naming the access level. The worker stays on its model.
  • Switching to a model that no signed-in provider offers is refused with a reason.
  • The assignment records the new model and that a person switched it. The persona chip and its tooltip show the current model.
  • A model or provider change from an agent, through t3_thread_configure or a message's model selection, is still refused. The message says to replace the worker instead.
  • Provider switches mid-thread follow upstream's existing provider.switch behavior. Nothing new is invented for persona threads.
  • A reviewer switched onto the author's model is allowed. It's my call (Personas: reviewers prefer a different model from the author #782).
  • docs/j5/user/personas.md no longer says the route is fixed, and says how switching works.
  • Focused tests cover: a permitted switch, a refused switch because of access, a refused switch because the model isn't offered, and a refused switch from an agent.

Out of scope

Open question

How does the guard tell a person's change from an agent's? Today it only sees { commandId, type }. J5's own MCP command ids carry an mcp segment, but I'd rather not key on id strings, and upstream's t3_thread_configure may not. Options:

  • thread an actor or origin through the guard's command context, if upstream's command already has one;
  • only allow switches that come through the client RPC path.

Whoever picks this up should look at what upstream's command carries before deciding.

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