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): restore card approve for the secure credential form (#21811)

Arvin Xu8f9b315344a4
diff --git a/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts b/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts
index 8010899fcc2..83cd584bc4e 100644
--- a/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts
+++ b/apps/server/src/services/agentRuntime/__tests__/agentInterventionNotification.test.ts
@@ -233,7 +233,7 @@ describe('buildRuntimeInterventionNotification', () => {
expect(result?.systemActionEligibility).toBe('review_only');
});
- it('lets only the card resolve the secure credential form', async () => {
+ it('keeps approve on the durable secure credential form row for its card', async () => {
const credsForm = {
apiName: 'requestCredsInput',
arguments: '{"key":"openai","name":"OpenAI","type":"kv-env","fieldNames":["OPENAI_API_KEY"]}',
@@ -254,11 +254,11 @@ describe('buildRuntimeInterventionNotification', () => {
});
expect(result?.items[0]).toMatchObject({
- // 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'],
+ // The card approves the durable row after saving the secret, so
+ // `approve_tool` must be stored (dropping it 403'd every card submit).
+ // Review withholds approve for this shape in the Cloud resolution
+ // service; edit and remember never apply to the form.
+ allowedActions: ['approve_tool', '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 9e2ade910f7..ce7aa719b91 100644
--- a/apps/server/src/services/agentRuntime/agentInterventionNotification.ts
+++ b/apps/server/src/services/agentRuntime/agentInterventionNotification.ts
@@ -160,16 +160,13 @@ const actionsFor = (
// approves after its own write, so there are no arguments to edit and no
// allow-list entry to remember.
//
- // `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'];
+ // These actions become the durable row's `allowedActions`, which every
+ // surface resolves against, the conversation card included. `approve_tool`
+ // must stay here or the card's own submit is rejected as unavailable. The
+ // surfaces that cannot render the form (Review opened from a push or IM
+ // notification) withhold approve for this shape in the Cloud resolution
+ // service instead, so approving there cannot skip the secret entry.
+ return ['approve_tool', 'reject_continue', 'stop'];
}
if (interactionKind === 'question') {