Skip to content

Commit afb84dc

Browse files
authored
Merge pull request #4 from itkonen/fix/clear-resolved-question
Bump eca-webview: clear remotely answered questions
2 parents 340176e + f394ff6 commit afb84dc

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎eca-webview‎

‎tests/chat-restore.test.mjs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,30 @@ test('the already-connected live question path still works', async () => {
260260
assert.equal(messageCache.has(host, 'chat-1'), false);
261261
});
262262

263+
test('a matching tool completion clears a question answered by another client', async () => {
264+
const bridge = bridgeFor(snapshot({ pendingToolCalls: [] }));
265+
await bridge.dispatchInitialState();
266+
bridge.handleSSEEvent(event('chat:ask-question', {
267+
chatId: 'chat-1', toolCallId: 'tool-1', requestId: 'live', question: 'Live?', options: [],
268+
}));
269+
bridge.handleSSEEvent(event('chat:content-received', {
270+
chatId: 'chat-1', role: 'system',
271+
content: {
272+
type: 'toolCalled', origin: 'native', id: 'other-tool', name: 'read_file',
273+
arguments: [], error: false, outputs: [], totalTimeMs: 1,
274+
},
275+
}));
276+
assert.equal(state.chats['chat-1'].pendingQuestion.requestId, 'live');
277+
bridge.handleSSEEvent(event('chat:content-received', {
278+
chatId: 'chat-1', role: 'system',
279+
content: {
280+
type: 'toolCalled', origin: 'native', id: 'tool-1', name: 'ask_user',
281+
arguments: [], error: false, outputs: [], totalTimeMs: 1,
282+
},
283+
}));
284+
assert.equal(state.chats['chat-1'].pendingQuestion, undefined);
285+
});
286+
263287
test('a disconnected bridge does not publish a delayed snapshot into another session', async () => {
264288
const bridge = bridgeFor(snapshot());
265289
const response = deferred();

0 commit comments

Comments
 (0)