The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): ride the backend approval window for approval.respond
Austin Pickettaff4034f914c
diff --git a/apps/desktop/src/plugins/hermes-bots/group-turns.ts b/apps/desktop/src/plugins/hermes-bots/group-turns.tsindex e859437943a..1c056437eed 100644--- a/apps/desktop/src/plugins/hermes-bots/group-turns.ts+++ b/apps/desktop/src/plugins/hermes-bots/group-turns.ts@@ -8,6 +8,8 @@import { host } from '@hermes/plugin-sdk'+import { APPROVAL_RESPOND_TIMEOUT_MS } from '@hermes/shared'+import { noteBotAttention } from './data'import { groupFailureReason, recordGroupActivity } from './group-activity'import { $groupChats, $groupClarify, appendGroupChatEntry, updateGroupChat } from './group-chat'@@ -816,11 +818,18 @@ export async function answerGroupClarify(try {if (entry.kind === 'approval') {- await requestForBot(member, 'approval.respond', {- session_id: entry.sessionId || undefined,- request_id: entry.requestId,- choice: typeof answers === 'string' && answers ? answers : 'deny'- })+ // Ride the backend's approvals.timeout (300s default), not the generic+ // request timeout — the user owns the full approval window (#60654).+ await requestForBot(+ member,+ 'approval.respond',+ {+ session_id: entry.sessionId || undefined,+ request_id: entry.requestId,+ choice: typeof answers === 'string' && answers ? answers : 'deny'+ },+ { timeoutMs: APPROVAL_RESPOND_TIMEOUT_MS }+ )} else if (entry.questions && entry.questions.length) {for (const question of entry.questions) {// Question ids are opaque on the wire (`GroupPrompt.questions` typesdiff --git a/apps/shared/src/index.ts b/apps/shared/src/index.tsindex 82c60f4be56..35ddac34f61 100644--- a/apps/shared/src/index.ts+++ b/apps/shared/src/index.ts@@ -91,6 +91,7 @@ export {wireFrameText} from './json-rpc-channel'export {+ APPROVAL_RESPOND_TIMEOUT_MS,type ConnectionState,type GatewayClientOptions,GatewayEventHub,diff --git a/apps/shared/src/json-rpc-gateway.ts b/apps/shared/src/json-rpc-gateway.tsindex c355f12c52b..8143304c764 100644--- a/apps/shared/src/json-rpc-gateway.ts+++ b/apps/shared/src/json-rpc-gateway.ts@@ -38,6 +38,15 @@ export interface GatewayClientOptions {const ANY = '*'const DEFAULT_REQUEST_TIMEOUT_MS = 120_000+// `approval.respond` rides the SAME deadline the backend grants the user to+// answer: tools/approval_context.py reads `approvals.timeout` (default 300s —+// gateway push notifications may not be seen for minutes). A shorter client+// timeout races that window: answer at t=130s and the frontend has already+// rejected its own RPC while the backend happily applies the decision — the+// desktop shows "request timed out" and freezes on a card that is actually+// resolved (#60654). Match the backend default so the client only gives up+// when the backend itself fails the approval closed.+export const APPROVAL_RESPOND_TIMEOUT_MS = 300_000const isGatewayReady = (event: GatewayEvent): event is GatewayEvent<'gateway.ready'> => event.type === 'gateway.ready'// Replay fetch after reconnect: bounded so a wedged backend can't hold the