Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(teammates): show preserved routine hooks on resume

Chris47a440ee8603
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts
index be6fa277d6..eef12338f5 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts
@@ -1332,15 +1332,17 @@ describe('teammate turn principal', () => {
// Same save API on helper and scheduler: only an existing disabled->enabled
// transition is a resume; ordinary creation/editing remains unchanged.
+ // r4410276099: omitted hook parameters retain the saved command, which must be shown.
it.each(['cindy_helper', 'cindy_scheduler'] as const)('asks for routine restoration through %s', async server => {
const h = desktopFixture('automatic');
live(h);
- h.routines.set('saved', { enabled: false, revision: 3 });
+ h.routines.set('saved', { enabled: false, revision: 3, preRunCommand: 'node saved-check.mjs' });
const request = { ...helper('routine_save', { botId: 'bot', id: 'saved', enabled: true }), server };
expect(await withToolCallAuthority(h.authorize, request,
async () => taskActionRoutineRevision('bot', 'saved'))).toBe(3);
expect(h.confirm).toHaveBeenCalledWith('companion', 'routine_save', request.args,
- { server, risk: 'resume' });
+ { server, risk: 'resume', details: { routine: { id: 'saved', enabled: false, revision: 3,
+ preRunCommand: 'node saved-check.mjs' } } });
h.confirm.mockClear();
h.routines.set('saved', { enabled: true, revision: 4 });
expect(await withToolCallAuthority(h.authorize, request, async () => 'edited')).toBe('edited');
diff --git a/apps/desktop/src/main/maker-ipc/taskActionHost.ts b/apps/desktop/src/main/maker-ipc/taskActionHost.ts
index 5863563c91..332a995045 100644
--- a/apps/desktop/src/main/maker-ipc/taskActionHost.ts
+++ b/apps/desktop/src/main/maker-ipc/taskActionHost.ts
@@ -393,7 +393,8 @@ export function createDesktopTaskActionAuthorizer(deps: {
: risk === 'command' && taskActionStartsIndependentAgent(call, schedule)
? { details: { ...(schedule ? { schedule } : {}), execution: { mode: 'agent', newTaskPermissionMode: 'bypassPermissions' } } }
: schedule ? { details: { schedule } }
- : call.tool === 'routine_run_now' && routine?.details ? { details: routine.details } : {}) });
+ : (call.tool === 'routine_run_now' || risk === 'resume') && routine?.details
+ ? { details: routine.details } : {}) });
if (!confirmed) {
rejectedDecision = { ok: false, errorCode: 'USER_CANCELLED',
message: 'The action was not approved. Do not execute or retry it without a new request.' };