The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): post-merge seams — completion finds its reserved stream row; ticket bridge stays stdlib-only
Tekniumbad0d932b6a7
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/completion-boundaries.test.tsx b/apps/desktop/src/app/session/hooks/use-message-stream/completion-boundaries.test.tsxindex de6d09b7fc1..59d8897cce4 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/completion-boundaries.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-message-stream/completion-boundaries.test.tsx@@ -24,8 +24,11 @@ const STORED = 'completion-stored'const ANSWER = 'The answer is unchanged.'const noop = async () => undefined-const requestGateway = async <T,>(method: string): Promise<T> =>- (method === 'prompt.submit' ? { status: 'started' } : { status: 'redirected' }) as T+// The canonical admission receipt echoes the client's submission id.+const requestGateway = async <T,>(method: string, params?: Record<string, unknown>): Promise<T> =>+ (method === 'prompt.submit'+ ? { admission_id: params?.submission_id, session_id: SID, status: 'started' }+ : { status: 'redirected' }) as T// Real submit/redirect, stream reducer, cache and view publication; only RPC// acceptance and history/metadata I/O are stand-ins.@@ -110,14 +113,14 @@ function mount(rpc = requestGateway) {it('binds a late submit acknowledgement to its exact optimistic prompt without reviving the turn', async () => {const laterUser: ChatMessage = { id: 'later-user', role: 'user', parts: [{ type: 'text', text: 'Give the answer.' }] }- const h = mount(async <T,>(): Promise<T> => {+ const h = mount(async <T,>(_method: string, params?: Record<string, unknown>): Promise<T> => {await h.send('message.start')await h.send('message.delta', { text: ANSWER })await h.send('message.complete', { text: ANSWER })h.update(state => ({ ...state, messages: [...state.messages, laterUser], needsInput: true }))await flush()- return { status: 'started', user_row_id: 71 } as T+ return { admission_id: params?.submission_id, session_id: SID, status: 'started', user_row_id: 71 } as T})await h.submit()diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/index.ts b/apps/desktop/src/app/session/hooks/use-message-stream/index.tsindex b6bffb47a87..97eda74daa5 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/index.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/index.ts@@ -738,8 +738,11 @@ export function useMessageStream({message => message.role === 'user' && !(hasCurrentResponse && message.id === `user-queued-${sessionId}`))+ // A redirect reserves its correction row below the live stream without+ // sealing it, so a still-pending stream row above the last user message+ // is this completion's own reply, not a stale earlier occurrence.const streamIndex = streamId- ? prev.findIndex((message, index) => index > lastUserIndex && message.id === streamId)+ ? prev.findIndex((message, index) => message.id === streamId && (index > lastUserIndex || message.pending)): -1const settleAt = (index: number) =>diff --git a/hermes_cli/gateway_runtime.py b/hermes_cli/gateway_runtime.pyindex 4f2213e1996..09ab0a9aa69 100644--- a/hermes_cli/gateway_runtime.py+++ b/hermes_cli/gateway_runtime.py@@ -7,10 +7,11 @@ import ipaddressimport mathimport osfrom pathlib import Path-from typing import Literal+from typing import TYPE_CHECKING, Literalfrom urllib.parse import urlsplit-from gateway.runtime_contract import RuntimeState+if TYPE_CHECKING:+ from gateway.runtime_contract import RuntimeState@dataclass(frozen=True)