The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): report rejected quick-entry submits
LeonardoLGDSb0b83ca6f2c0
diff --git a/apps/desktop/src/app/contrib/hooks/use-quick-entry-bridge.test.ts b/apps/desktop/src/app/contrib/hooks/use-quick-entry-bridge.test.tsnew file mode 100644index 00000000000..e7dc992d08e--- /dev/null+++ b/apps/desktop/src/app/contrib/hooks/use-quick-entry-bridge.test.ts@@ -0,0 +1,17 @@+import { describe, expect, it } from 'vitest'+import { quickEntrySubmitAck } from './use-quick-entry-bridge'++describe('quickEntrySubmitAck', () => {+ it('reports a rejected prompt as failure instead of acknowledging success', () => {+ expect(quickEntrySubmitAck(false)).toEqual({+ code: 'submit-rejected',+ message: 'The prompt was not accepted.',+ ok: false,+ retryable: true+ })+ })++ it('acknowledges only an accepted prompt as success', () => {+ expect(quickEntrySubmitAck(true)).toEqual({ ok: true })+ })+})diff --git a/apps/desktop/src/app/contrib/hooks/use-quick-entry-bridge.ts b/apps/desktop/src/app/contrib/hooks/use-quick-entry-bridge.tsindex cb0dade94d5..62c5878a8f9 100644--- a/apps/desktop/src/app/contrib/hooks/use-quick-entry-bridge.ts+++ b/apps/desktop/src/app/contrib/hooks/use-quick-entry-bridge.ts@@ -13,7 +13,7 @@ import { sessionTileDelegate } from '@/store/session-states'import { isAuxiliaryWindow } from '@/store/windows'interface QuickEntryBridgeParams {- submitText: (text: string) => Promise<unknown> | unknown+ submitText: (text: string) => Promise<boolean> | booleansubmitTextToNewSession: (text: string) => Promise<{ runtimeSessionId: string; sessionId: string }>}@@ -21,6 +21,22 @@ interface QuickEntryBridgeParams {// rows is the whole point.const QUICK_ENTRY_SESSION_OPTIONS = 5+/**+ * `submitText` resolves false when a pre-submit guard declines the prompt+ * without throwing (for example, while the target is busy). That is a failed+ * delivery, not an acknowledgement of success.+ */+export function quickEntrySubmitAck(submitted: boolean): QuickEntrySubmitResult {+ return submitted+ ? { ok: true }+ : {+ code: 'submit-rejected',+ message: 'The prompt was not accepted.',+ ok: false,+ retryable: true+ }+}+function sessionOptions(): QuickEntrySessionOption[] {return $sessions.get()@@ -109,8 +125,8 @@ export function useQuickEntryBridge({}try {- await submitTextRef.current(text)- ack({ ok: true })+ const submitted = await submitTextRef.current(text)+ ack(quickEntrySubmitAck(submitted))} catch (error) {ack({ code: 'submit-failed', message: error instanceof Error ? error.message : String(error), ok: false, retryable: true })}