CODY-021: a removed agent is reconciled the moment its turn settles
If the current agent was taken off the bridge's list while its request was in flight, start-up rightly kept it for that request, but nothing fell back afterwards: the screen named the default (first in the list) while state, storage and the conversation were still the removed agent's. The controller now reconciles inside dispatch, in the same step as any state change and before anything is drawn: on a resting screen, if the stored agent is not offered, the stored agent and thread are swapped to the default's own and the state follows (agent_reconciled). While a request is in flight nothing changes, so the turn is never moved or repeated. This also covers an abandoned turn at start. CODY-022: README scope list no longer says multiple agents are excluded. Not reviewed, not deployed, not uploaded. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,12 @@ export type AppEvent =
|
||||
}
|
||||
/** The user picked another agent (a swipe at Ready). `conversationId` is that agent's own, if it has one. */
|
||||
| { type: 'agent_selected'; agentId: string; conversationId: string | null }
|
||||
/**
|
||||
* The current agent is no longer offered and nothing is in flight with it: fall back to the
|
||||
* default agent and ITS conversation. Unlike a selection this applies on any resting screen,
|
||||
* and leaves what is on screen (the removed agent's last answer or error) in place.
|
||||
*/
|
||||
| { type: 'agent_reconciled'; agentId: string; conversationId: string | null }
|
||||
| { type: 'unpaired' }
|
||||
/** Semantic actions. `freshId` is a new UUID supplied by the caller in case a turn starts. */
|
||||
| { type: 'activate'; freshId: string }
|
||||
@@ -234,6 +240,17 @@ export function reduce(state: AppState, event: AppEvent): Step {
|
||||
});
|
||||
}
|
||||
|
||||
case 'agent_reconciled': {
|
||||
if (!IDLE.has(state.phase)) return same(state);
|
||||
return same({
|
||||
...state,
|
||||
agentId: event.agentId,
|
||||
conversationId: event.conversationId,
|
||||
conversationEpoch: state.conversationEpoch + 1,
|
||||
creatingConversation: false,
|
||||
});
|
||||
}
|
||||
|
||||
case 'unpaired': {
|
||||
const effects: Effect[] = state.phase === 'listening' ? [{ type: 'discard_capture' }] : [];
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user