fix: pass actual chat JID to agent runner instead of group folder

watch_ci tasks in perf channel were silently failing because
NANOCLAW_CHAT_JID was set to the group folder name (e.g. "eyejokerdb-4")
instead of the actual Discord JID. The scheduler rejected the task with
"target group not registered".

Also adds a fallback in ipc.ts to resolve folder names to registered
JIDs when a folder name is passed instead of a JID.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eyejoker
2026-03-21 14:27:00 +09:00
parent 2c8260135f
commit dd15585941
4 changed files with 88 additions and 4 deletions

View File

@@ -167,6 +167,26 @@ describe('schedule_task authorization', () => {
const allTasks = getAllTasks();
expect(allTasks.length).toBe(0);
});
it('accepts a target folder name and resolves it to the registered JID', async () => {
await processTaskIpc(
{
type: 'schedule_task',
prompt: 'folder-based target',
schedule_type: 'once',
schedule_value: '2025-06-01T00:00:00',
targetJid: 'other-group',
},
'other-group',
false,
deps,
);
const allTasks = getAllTasks();
expect(allTasks).toHaveLength(1);
expect(allTasks[0].group_folder).toBe('other-group');
expect(allTasks[0].chat_jid).toBe('other@g.us');
});
});
// --- pause_task authorization ---