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:
@@ -422,6 +422,20 @@ describe('choosing an agent', () => {
|
||||
expect(late.creatingConversation).toBe(false);
|
||||
});
|
||||
|
||||
it('falling back from a removed agent: applied on any resting screen without disturbing it, never while something is in flight', () => {
|
||||
const base = run(readyWithAgents(), select).state;
|
||||
const back: AppEvent = { type: 'agent_reconciled', agentId: 'default', conversationId: CONV };
|
||||
const answered = run(base, { type: 'submit_text', freshId: ID1, text: 'q' }, { type: 'turn_update', generation: base.generation + 1, result: result(ID1), pages: ['her answer'] }).state;
|
||||
const after = reduce(answered, back).state;
|
||||
expect(after.phase).toBe('answer');
|
||||
expect(after.pages).toEqual(['her answer']); // what she said stays on screen
|
||||
expect([after.agentId, after.conversationId]).toEqual(['default', CONV]);
|
||||
expect(after.conversationEpoch).toBe(answered.conversationEpoch + 1);
|
||||
for (const busy of [run(base, { type: 'activate', freshId: ID1 }).state, run(base, { type: 'submit_text', freshId: ID1, text: 'q' }).state]) {
|
||||
expect(reduce(busy, back).state, busy.phase).toBe(busy);
|
||||
}
|
||||
});
|
||||
|
||||
it('with one agent, or none listed, no screen mentions an agent', () => {
|
||||
for (const agents of [[], [AGENTS[0]!]]) {
|
||||
const state = run(initialState, { type: 'init', paired: true, conversationId: CONV, captureMaxSeconds: 30, resumeRequestId: null, agents }).state;
|
||||
|
||||
Reference in New Issue
Block a user