Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(creds): block notification-surface approve for the secure credential form (#20580)

Arvin Xu8d607062c460
diff --git a/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts b/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts
index 5603cd945e7..8010899fcc2 100644
--- a/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts
+++ b/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts
@@ -254,7 +254,11 @@ describe('buildRuntimeInterventionNotification', () => {
});
expect(result?.items[0]).toMatchObject({
- allowedActions: ['approve_tool', 'reject_continue', 'stop'],
+ // No `approve_tool`: only the card can resolve the secure form β€” a
+ // notification-surface approve would skip the secret entry entirely and
+ // strand the run in an approve-without-form loop (CredentialNotFound β†’
+ // re-request β†’ approve again).
+ allowedActions: ['reject_continue', 'stop'],
interactionKind: 'tool_approval',
surface: 'form',
});
diff --git a/apps/server/src/services/agentRuntime/agentInterventionNotification.ts b/apps/server/src/services/agentRuntime/agentInterventionNotification.ts
index fd592eed914..9e2ade910f7 100644
--- a/apps/server/src/services/agentRuntime/agentInterventionNotification.ts
+++ b/apps/server/src/services/agentRuntime/agentInterventionNotification.ts
@@ -159,7 +159,17 @@ const actionsFor = (
// A form resolved by approval (the secure credential form): the card
// approves after its own write, so there are no arguments to edit and no
// allow-list entry to remember.
- return ['approve_tool', 'reject_continue', 'stop'];
+ //
+ // `approve_tool` must NOT be offered here. The form IS the approval: it
+ // writes the secret to the credential store before the card approves, and
+ // the executor only confirms the key exists afterwards. An approval that
+ // skips the form (IM bot / push action) therefore approves a call whose
+ // credential was never entered β€” the run gets `CredentialNotFound`, the
+ // agent re-requests, and the user is stuck in an approve-without-form
+ // loop. Web already gates this (card-only resolution); the notification
+ // surface must fail closed the same way, leaving only reject/stop so the
+ // run can continue without the secret.
+ return ['reject_continue', 'stop'];
}
if (interactionKind === 'question') {