fix(coding): restore sending after queued messages settle
This commit is contained in:
@@ -621,6 +621,28 @@ describe('coding Conversation store', () => {
|
||||
expect(store.getState().requestsByConversationId['conversation-a']).toEqual({});
|
||||
});
|
||||
|
||||
it.each(['steer', 'follow-up'] as const)('clears %s acceptance even when settlement precedes the response', async (mode) => {
|
||||
const pending = deferred<PromptAcceptance>();
|
||||
const store = createCodingConversationStore({
|
||||
getSnapshot: vi.fn(),
|
||||
openEvents: vi.fn(),
|
||||
submitPrompt: vi.fn(() => pending.promise),
|
||||
createId: ids(),
|
||||
});
|
||||
const running = snapshot('conversation-a');
|
||||
running.run = { status: 'running', mode: 'prompt', runId: 'run-1' };
|
||||
store.getState().applySnapshotEvent(snapshotEvent(running));
|
||||
store.getState().setDraft('conversation-a', '排队的消息');
|
||||
const submission = store.getState().submitPrompt({ conversationId: 'conversation-a', mode });
|
||||
const settled = snapshot('conversation-a', 1, 1);
|
||||
settled.run = { status: 'idle', mode: 'prompt', runId: 'run-1', terminalReason: 'completed', settledAt: 1_000 };
|
||||
store.getState().applySnapshotEvent(snapshotEvent(settled));
|
||||
pending.resolve({ ...acceptance('conversation-a', 'request-1'), mode });
|
||||
await submission;
|
||||
expect(store.getState().requestsByConversationId['conversation-a']).toEqual({});
|
||||
expect(store.getState().draftsByConversationId['conversation-a'].text).toBe('');
|
||||
});
|
||||
|
||||
it('preserves the optimistic UI id when a reconnect snapshot is already durable', async () => {
|
||||
const store = createCodingConversationStore({
|
||||
getSnapshot: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user