feat(gateway): complete openclaw phase1 queue parity v2

This commit is contained in:
William Valentin
2026-02-16 12:04:33 -08:00
parent 78da226542
commit 813a0dc5c5
19 changed files with 678 additions and 53 deletions
+19 -3
View File
@@ -720,7 +720,18 @@ describe('config handlers', () => {
function makeConfig() {
return {
telegram: { bot_token: 'secret-token-123', allowed_chat_ids: [12345] },
server: { tailscale: {}, localhost: true, port: 18800 },
server: {
tailscale: {},
localhost: true,
port: 18800,
queue: {
mode: 'collect' as const,
cap: 50,
overflow: 'drop_old' as const,
debounce_ms: 0,
summarize_overflow: true,
},
},
models: {
default: { provider: 'anthropic' as const, model: 'claude-3-haiku', api_key: 'sk-secret-key' },
fallback_chain: ['anthropic'],
@@ -754,18 +765,22 @@ describe('config handlers', () => {
patches: {
'hooks.confirm': ['shell.exec', 'file.write'],
'hooks.log': ['file.read'],
'server.queue.mode': 'followup',
'server.queue.debounce_ms': 100,
},
},
};
const result = await handlers['config.patch'](req) as GatewayResponse;
const r = result.result as { applied: string[]; rejected: string[]; persisted: boolean };
expect(r.applied).toEqual(['hooks.confirm', 'hooks.log']);
expect(r.applied).toEqual(['hooks.confirm', 'hooks.log', 'server.queue.mode', 'server.queue.debounce_ms']);
expect(r.rejected).toEqual([]);
expect(r.persisted).toBe(false);
// Verify the config was actually mutated
expect(config.hooks.confirm).toEqual(['shell.exec', 'file.write']);
expect(config.hooks.log).toEqual(['file.read']);
expect(config.server.queue.mode).toBe('followup');
expect(config.server.queue.debounce_ms).toBe(100);
});
it('config.patch rejects unknown keys', async () => {
@@ -798,6 +813,7 @@ describe('config handlers', () => {
params: {
patches: {
'hooks.confirm': 'not-an-array',
'server.queue.cap': 0,
},
},
};
@@ -805,7 +821,7 @@ describe('config handlers', () => {
const r = result.result as { applied: string[]; rejected: string[]; persisted: boolean };
expect(r.applied).toEqual([]);
expect(r.rejected).toEqual(['hooks.confirm']);
expect(r.rejected).toEqual(['hooks.confirm', 'server.queue.cap']);
expect(r.persisted).toBe(false);
});