Compare commits
2
Commits
f9a3699603
...
59f600d34d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59f600d34d | ||
|
|
cbedfed2ba |
@@ -1,4 +1,5 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useChatWebSocket } from 'hooks/useChatWebSocket';
|
||||
import { useClient } from 'hooks/useClient';
|
||||
import { useSettings } from 'state/useSettings';
|
||||
@@ -214,7 +215,7 @@ export function useChat(initialSessionId?: string, initialModel?: string | null,
|
||||
|
||||
Fired when the transcript id arrives — the START of the turn, not the end — because that is the moment
|
||||
the session becomes real on disk and the server can already name it from the first user message. Fired
|
||||
again when the turn finishes, because the harness's own `ai-title` may have improved on it by then.
|
||||
again when a turn finishes, because the harness writes its own `ai-title` while the turn runs.
|
||||
*/
|
||||
const announceSession = useCallback(() => {
|
||||
void queryClient.invalidateQueries({ queryKey: ['CLAUDE_SESSIONS'] });
|
||||
@@ -430,10 +431,6 @@ export function useChat(initialSessionId?: string, initialModel?: string | null,
|
||||
setClaudeSessionId(msg.claudeSessionId);
|
||||
if (replaceUrl) writePermalink(msg.claudeSessionId);
|
||||
}
|
||||
// Again at the end of every turn, and OUTSIDE the id check above: the harness writes its own
|
||||
// `ai-title` while the turn runs, so the name the list is showing may now be bettered by the one on
|
||||
// disk — and that is true whether or not this particular `result` happened to carry the id.
|
||||
announceSession();
|
||||
commitStreaming();
|
||||
setMessages((prev) => [
|
||||
...prev,
|
||||
@@ -446,6 +443,9 @@ export function useChat(initialSessionId?: string, initialModel?: string | null,
|
||||
const hadTools = toolCallsInTurnRef.current;
|
||||
toolCallsInTurnRef.current = false;
|
||||
onTurnCompleteRef.current?.(hadTools);
|
||||
// Every turn end: the harness writes its own `ai-title` while a turn runs, so the name the lists are
|
||||
// showing may now be bettered by the one on disk.
|
||||
announceSession();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user