The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): preserve clarify when asking /btw
Charan Rathore3a2a626821bf
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsxindex 735448354d6..df09c60eb3c 100644--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx@@ -498,6 +498,34 @@ describe('useComposerSubmit with a clarify parked on the session', () => {vi.restoreAllMocks()})+ it.each(['/btw what is the task?', '/BTW what is the task?', '/btw'])('keeps a pending clarify answerable while dispatching %s', async text => {+ parkClarify('runtime-session')+ const { hook, onSubmit, onSteer } = renderSubmitHook({ busy: true, text })++ act(() => {+ hook.result.current.submitDraft()+ })++ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith(text, expect.anything()))+ expect(onSteer).not.toHaveBeenCalled()+ expect(respond).not.toHaveBeenCalled()+ expect(hasOpenServerRequest('req-runtime-session')).toBe(true)+ expect($clarifyRequests.get()['runtime-session']).toBeDefined()+ })++ it('still skips clarify for a different slash command', async () => {+ parkClarify('runtime-session')+ const { hook, onSubmit } = renderSubmitHook({ busy: true, text: '/status' })++ act(() => {+ hook.result.current.submitDraft()+ })++ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith('/status', expect.anything()))+ expect(respond).toHaveBeenCalledWith({ answer: '' })+ expect(hasOpenServerRequest('req-runtime-session')).toBe(false)+ })+it('skips the question and still sends the typed message on an idle session', async () => {parkClarify('runtime-session')const { hook, onSubmit } = renderSubmitHook({ text: 'actually do this instead' })diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.tsindex fd720b1f4bc..02e9ff8bdef 100644--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts@@ -225,12 +225,14 @@ export function useComposerSubmit({// (default 5 min) — the message looks sent and nothing happens. Typing a// real message instead of picking an option IS the answer "none of these":// skip the question so the tool returns, then route the words normally.+ // /btw is a side question, not a reply to clarify.//// Fire-and-forget, not awaited: the skip clears the card synchronously and// both RPCs ride the same socket in call order, so the gateway resolves the- // clarify before it sees the follow-up. Awaiting first would leave the draft+ // clarify before it sees the follow-up. /btw takes the separate slash path.+ // Awaiting first would leave the draft// live for a tick — long enough for a second Enter to send it twice.- if (payloadPresent && !queueEdit && hasClarifyRequest(sessionId)) {+ if (payloadPresent && !queueEdit && !/^\/btw(?:\s|$)/i.test(text.trim()) && hasClarifyRequest(sessionId)) {void skipClarifyRequest(sessionId)}