The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: keep native steer fallback on canonical queue admission
Teknium35255f5c1343
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 e37b2a5f852..d29ad9a8137 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@@ -5,6 +5,8 @@ import { afterEach, describe, expect, it, vi } from 'vitest'import { PaneVisibleContext } from '@/components/pane-shell/pane-visibility'import { $clarifyRequests } from '@/store/clarify'import type { ComposerAttachment } from '@/store/composer'+import { $connection } from '@/store/session'+import { getQueuedPrompts, $queuedPromptsBySession } from '@/store/composer-queue'import { $gateway } from '@/store/gateway'import {clearAllPrompts,@@ -147,6 +149,18 @@ describe('useComposerSubmit external request routing', () => {vi.restoreAllMocks()})+ it('routes a refused native steer through canonical queue admission', async () => {+ $connection.set({ mode: 'local', wsUrl: 'ws://localhost/api/ws?native_dial=unminted' } as never)+ $queuedPromptsBySession.set({})+ const h = renderSubmitHook({ busy: true, text: 'keep guidance' })+ h.onSteer.mockResolvedValue(false)+ try {+ act(() => h.hook.result.current.steerDraft())+ await waitFor(() => expect(h.onSubmit).toHaveBeenCalledWith('keep guidance', expect.objectContaining({ fromQueue: true, sessionId: 'runtime-session', storedSessionId: 'stored-session' })))+ expect(getQueuedPrompts('stored-session')).toEqual([])+ } finally { $connection.set(null); $queuedPromptsBySession.set({}) }+ })+it('does not fan out a main ship across keep-alives or other projects', async () => {const visibleMain = renderSubmitHook({ sessionKey: 'session-a' })const hiddenMain = renderSubmitHook({ sessionKey: 'session-b', visible: false })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 1a3c799e199..75e0ca6b102 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@@ -7,7 +7,7 @@ import type { BusyInputMode } from '@/store/busy-input-mode'import { hasClarifyRequest, skipClarifyRequest } from '@/store/clarify'import { clearSessionDraft, type ComposerAttachment } from '@/store/composer'import { resetBrowseState } from '@/store/composer-input-history'-import { enqueueQueuedPrompt, type QueuedPromptEntry } from '@/store/composer-queue'+import { enqueueQueuedPrompt, serverOwnsComposerQueue, type QueuedPromptEntry } from '@/store/composer-queue'import { hasMcpSetupRequest, skipMcpSetupRequest } from '@/store/mcp-setup'import { hasBlockingPromptRequest } from '@/store/prompts'@@ -86,8 +86,8 @@ export function useComposerSubmit({// Shared send primitive: fire onSubmit, and if the gateway rejects (accepted// === false) or throws, re-load + re-stash the draft so the words survive.- const dispatchSubmit = (text: string, attachments?: ComposerAttachment[], displayKind?: 'hidden') => {- const submittedScope = activeQueueSessionKeyRef.current+ const dispatchSubmit = (text: string, attachments?: ComposerAttachment[], displayKind?: 'hidden', target?: Parameters<ChatBarProps['onSubmit']>[1]) => {+ const submittedScope = target?.storedSessionId ?? activeQueueSessionKeyRef.currentconst submittedAttachments = attachments ?? []const restore = () => {@@ -100,9 +100,7 @@ export function useComposerSubmit({}void Promise.resolve(- attachments- ? onSubmit(text, { attachments, composerScope: submittedScope, ...(displayKind ? { displayKind } : {}) })- : onSubmit(text, { composerScope: submittedScope, ...(displayKind ? { displayKind } : {}) })+ onSubmit(text, { ...target, ...(attachments ? { attachments } : {}), composerScope: submittedScope, ...(displayKind ? { displayKind } : {}) })).then(accepted => void (accepted === false ? restore() : clearSessionDraft(submittedScope))).catch(restore)@@ -253,9 +251,14 @@ export function useComposerSubmit({triggerHaptic('submit')clearDraft()+ const canonical = serverOwnsComposerQueue(sessionId ?? activeQueueSessionKey)void Promise.resolve(onSteer(text, mode)).then(accepted => {if (!accepted && activeQueueSessionKey) {- enqueueQueuedPrompt(activeQueueSessionKey, { text, attachments: [] })+ if (canonical) {+ dispatchSubmit(text, [], undefined, { fromQueue: true, sessionId: sessionId ?? null, storedSessionId: activeQueueSessionKey })+ } else {+ enqueueQueuedPrompt(activeQueueSessionKey, { text, attachments: [] })+ }}})}