mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
fix(mcp): keep the input seq strictly increasing within one process (#615 merge-time fix)
send_prompt and interrupt_session tagged input with seq = Date.now() under one clientId. The server drops a seq at or below the last one it saw for that clientId and still answers 200, so two inputs in one millisecond (parallel tool calls) or a clock stepped back lost the second input while the tool reported it sent. The seq is now max(last + 1, now). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3072449c94
commit
35e21dd676
2 files changed
+18
-3
No files matched your search
@@ -411,6 +411,16 @@ describe('the tools', () => {
|
||||
expect(result.structured).toMatchObject({ outcome: 'not_delivered' });
|
||||
});
|
||||
|
||||
it('input seq stays strictly increasing within one millisecond, across send_prompt and interrupt_session', async () => {
|
||||
// The runner's clock is frozen at 1: the server drops a repeated seq while still answering 200.
|
||||
const { tools, calls } = runner(config({ allowAnySession: true }));
|
||||
await tools.run('send_prompt', { session_id: USERS, text: 'one', wait: false });
|
||||
await tools.run('send_prompt', { session_id: USERS, text: 'two', wait: false });
|
||||
await tools.run('interrupt_session', { session_id: USERS });
|
||||
const seqs = calls.filter((c) => c.path.endsWith('/input')).map((c) => c.body?.seq);
|
||||
expect(seqs).toEqual([1, 2, 3]);
|
||||
});
|
||||
|
||||
it('wait_for_session needs exactly one of until and match, and passes a marker literally', async () => {
|
||||
const { tools, calls } = runner(config());
|
||||
expect((await tools.run('wait_for_session', { session_id: USERS })).isError).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user