Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(conversations): restore chat tool parts test and slice test files

Steven Enamakelc7dc07a761e1
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsx
index d61d0d7587..b741312c5d 100644
--- a/app/src/features/conversations/Conversations.tsx
+++ b/app/src/features/conversations/Conversations.tsx
@@ -239,9 +239,7 @@ const Conversations = ({
const location = useLocation();
const { threadId: routeThreadId } = useParams<{ threadId?: string }>();
const shouldSyncChatRoute = variant === 'page' && location.pathname.startsWith('/chat');
- const { threads, selectedThreadId, messages } = useAppSelector(
- state => state.thread
- );
+ const { threads, selectedThreadId, messages } = useAppSelector(state => state.thread);
// Optional-chain + default: narrow test stores may omit `activeThreadIds`.
const activeThreadIds = useAppSelector(
state => state.thread.activeThreadIds ?? EMPTY_ACTIVE_THREADS
@@ -499,7 +497,6 @@ const Conversations = ({
};
}, [composerModelOverride]);
-
// One-shot guard for the Stop/ESC partial-preservation path (#4862): request
// ids whose partial reply has already been persisted, so a repeated Stop/ESC
// fired before the `cancelled` event clears the live stream can't append the
@@ -535,7 +532,6 @@ const Conversations = ({
// foreground turn's timer alive.
const turnSignatureByThreadRef = useRef<Map<string, readonly unknown[]>>(new Map());
-
const handleCreateNewThread = async () => {
try {
const thread = await dispatch(createNewThread()).unwrap();
@@ -922,8 +918,6 @@ const Conversations = ({
inferenceHeartbeatByThread,
]);
-
-
const handleSlashCommand = (command: string): boolean => {
const decision = handleComposerSlashCommand(command);
if (decision.kind === 'not_handled') return false;
@@ -1189,7 +1183,6 @@ const Conversations = ({
handleSendMessageRef.current = handleSendMessage;
-
// Queue a FOLLOW-UP on the selected thread while a turn is streaming
// (queue_mode 'followup'): the backend sends it as a fresh turn once the
// current turn finishes. We do NOT insert it into the transcript now —
@@ -1373,7 +1366,6 @@ const Conversations = ({
true
);
-
const handleComposerEscape = useCallback(() => {
if (!selectedThreadActive) return;
const composerEmpty = inputValue.trim().length === 0;
diff --git a/app/src/features/conversations/components/ChatToolParts.test.tsx b/app/src/features/conversations/components/ChatToolParts.test.tsx
index a8bfa5b29b..057c15b4af 100644
--- a/app/src/features/conversations/components/ChatToolParts.test.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.test.tsx
@@ -284,7 +284,9 @@ describe('ChatToolParts', () => {
/>
);
- expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Finding the right tool');
+ expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent(
+ 'Finding the right tool'
+ );
// The regression this pins: the old name/argument-key heuristic matched
// this row on both legs.
expect(screen.getByTestId('assistant-ui-tool-call')).not.toHaveTextContent('Searched the web');
diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsx
index f2e3bbb058..07d94b53fb 100644
--- a/app/src/providers/ChatRuntimeProvider.tsx
+++ b/app/src/providers/ChatRuntimeProvider.tsx
@@ -1280,7 +1280,6 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
}
}
-
const deliveryKey = segmentDeliveryKey(event.thread_id, event.request_id);
const segmentDelivery = takeSegmentDelivery(segmentDeliveriesRef.current, deliveryKey);
const completeSegmentDelivery = hasCompleteSegmentDelivery(event, segmentDelivery);
@@ -1442,7 +1441,6 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
}
}
-
deleteSegmentDelivery(
segmentDeliveriesRef.current,
segmentDeliveryKey(event.thread_id, event.request_id)
diff --git a/app/src/store/__tests__/chatRuntimeSlice.test.ts b/app/src/store/__tests__/chatRuntimeSlice.test.ts
index a96b520ca3..bfdfe8a18e 100644
--- a/app/src/store/__tests__/chatRuntimeSlice.test.ts
+++ b/app/src/store/__tests__/chatRuntimeSlice.test.ts
@@ -7,7 +7,6 @@ import reducer, {
clearAllChatRuntime,
clearArtifactsForThread,
clearInferenceStatusForThread,
- clearParallelRequest,
clearPendingApprovalForThread,
clearRuntimeForThread,
clearStreamingAssistantForThread,
@@ -16,10 +15,8 @@ import reducer, {
hydrateRuntimeFromRunLedger,
hydrateRuntimeFromSnapshot,
markInferenceTurnStreaming,
- registerParallelRequest,
removeArtifactForThread,
setInferenceStatusForThread,
- setParallelStream,
setPendingApprovalForThread,
setStreamingAssistantForThread,
setToolTimelineForThread,
@@ -985,91 +982,6 @@ describe('chatRuntimeSlice', () => {
expect(cleared.artifactsByThread).toEqual({});
});
});
-
-});
-
- it('keeps two concurrent same-thread branches separate', () => {
- let state = reducer(undefined, registerParallelRequest({ threadId: 't-1', requestId: 'r1' }));
- state = reducer(state, registerParallelRequest({ threadId: 't-1', requestId: 'r2' }));
- state = reducer(
- state,
- setParallelStream({
- threadId: 't-1',
- streaming: { requestId: 'r1', content: 'one', thinking: '' },
- })
- );
- state = reducer(
- state,
- setParallelStream({
- threadId: 't-1',
- streaming: { requestId: 'r2', content: 'two', thinking: '' },
- })
- );
- expect(Object.keys(state.parallelStreamsByThread['t-1'])).toEqual(['r1', 'r2']);
- expect(state.parallelStreamsByThread['t-1']['r1'].content).toBe('one');
- expect(state.parallelStreamsByThread['t-1']['r2'].content).toBe('two');
- });
-
- it('clearParallelRequest removes one branch and drops the thread bucket when empty', () => {
- let state = reducer(undefined, registerParallelRequest({ threadId: 't-1', requestId: 'r1' }));
- state = reducer(state, registerParallelRequest({ threadId: 't-1', requestId: 'r2' }));
- state = reducer(
- state,
- setParallelStream({
- threadId: 't-1',
- streaming: { requestId: 'r1', content: 'one', thinking: '' },
- })
- );
- state = reducer(
- state,
- setParallelStream({
- threadId: 't-1',
- streaming: { requestId: 'r2', content: 'two', thinking: '' },
- })
- );
-
- state = reducer(state, clearParallelRequest({ requestId: 'r1' }));
- expect(state.parallelRequestThreads['r1']).toBeUndefined();
- expect(state.parallelStreamsByThread['t-1']['r1']).toBeUndefined();
- expect(state.parallelStreamsByThread['t-1']['r2'].content).toBe('two');
-
- state = reducer(state, clearParallelRequest({ requestId: 'r2' }));
- expect(state.parallelStreamsByThread['t-1']).toBeUndefined();
- expect(state.parallelRequestThreads).toEqual({});
- });
-
- it('clearRuntimeForThread drops the thread parallel streams and their request mappings', () => {
- let state = reducer(undefined, registerParallelRequest({ threadId: 't-1', requestId: 'r1' }));
- state = reducer(
- state,
- setParallelStream({
- threadId: 't-1',
- streaming: { requestId: 'r1', content: 'one', thinking: '' },
- })
- );
- // An unrelated thread's parallel branch must survive.
- state = reducer(state, registerParallelRequest({ threadId: 't-2', requestId: 'r9' }));
- state = reducer(
- state,
- setParallelStream({
- threadId: 't-2',
- streaming: { requestId: 'r9', content: 'keep', thinking: '' },
- })
- );
-
- state = reducer(state, clearRuntimeForThread({ threadId: 't-1' }));
- expect(state.parallelStreamsByThread['t-1']).toBeUndefined();
- expect(state.parallelRequestThreads['r1']).toBeUndefined();
- expect(state.parallelStreamsByThread['t-2']['r9'].content).toBe('keep');
- expect(state.parallelRequestThreads['r9']).toBe('t-2');
- });
-
- it('clearParallelRequest is a no-op for an unknown requestId', () => {
- const state = reducer(undefined, clearParallelRequest({ requestId: 'nope' }));
- expect(state.parallelStreamsByThread).toEqual({});
- expect(state.parallelRequestThreads).toEqual({});
- });
- });
});
describe('toolCallReceived (Phase 3 reducer-side merge)', () => {
@@ -1350,30 +1262,6 @@ describe('streamDeltaReceived (Phase 3 reducer-side merge)', () => {
thinking: 'new',
});
});
-
- it('routes a forked (parallel) turn into its own lane without touching the primary or processing', () => {
- let state = reducer(
- undefined,
- registerParallelRequest({ threadId: 't1', requestId: 'branch' })
- );
- state = reducer(
- state,
- streamDeltaReceived({
- threadId: 't1',
- requestId: 'branch',
- round: 0,
- delta: 'B',
- channel: 'content',
- })
- );
- expect(state.parallelStreamsByThread['t1']['branch']).toEqual({
- requestId: 'branch',
- content: 'B',
- thinking: '',
- });
- expect(state.streamingAssistantByThread['t1']).toBeUndefined();
- expect(state.processingByThread['t1']).toBeUndefined();
- });
});
describe('subagent event reducers (Phase 3)', () => {
diff --git a/app/src/store/chatRuntimeSlice.test.ts b/app/src/store/chatRuntimeSlice.test.ts
index 7d10786a1b..fd4f17297d 100644
--- a/app/src/store/chatRuntimeSlice.test.ts
+++ b/app/src/store/chatRuntimeSlice.test.ts
@@ -890,7 +890,7 @@ describe('hydrateRuntimeFromSnapshot — persisted tool result output', () => {
});
});
-describe('hydrateRuntimeFromSnapshot — interrupted partial answer (fix 2)', () => {
+describe('hydrateRuntimeFromSnapshot — interrupted snapshot', () => {
function makeInterruptedPartialSnapshot(
threadId: string,
over: Partial<PersistedTurnState> = {}
@@ -910,63 +910,18 @@ describe('hydrateRuntimeFromSnapshot — interrupted partial answer (fix 2)', ()
};
}
- it('surfaces the persisted partial reply + thinking as a settled buffer', () => {
+ it('settles an interrupted snapshot without resurrecting its partial as a live stream', () => {
const store = makeStore();
store.dispatch(
hydrateRuntimeFromSnapshot({ snapshot: makeInterruptedPartialSnapshot('t-int') })
);
const state = store.getState().chatRuntime;
- expect(state.interruptedAssistantByThread['t-int']).toEqual({
- requestId: 'req-int',
- content: 'Here is the partial ans',
- thinking: 'was still reasoning',
- });
// It is NOT resurrected as a live streaming buffer (would pulse).
expect(state.streamingAssistantByThread['t-int']).toBeUndefined();
// The lifecycle is recorded as interrupted, not a fake in-flight status.
expect(state.inferenceTurnLifecycleByThread['t-int']).toBe('interrupted');
});
-
- it('keeps an interrupted turn that only produced thinking', () => {
- const store = makeStore();
- store.dispatch(
- hydrateRuntimeFromSnapshot({
- snapshot: makeInterruptedPartialSnapshot('t-think', { streamingText: '' }),
- })
- );
- expect(store.getState().chatRuntime.interruptedAssistantByThread['t-think']).toMatchObject({
- content: '',
- thinking: 'was still reasoning',
- });
- });
-
- it('does not surface a partial for an interrupted turn with no persisted text', () => {
- const store = makeStore();
- store.dispatch(
- hydrateRuntimeFromSnapshot({
- snapshot: makeInterruptedPartialSnapshot('t-empty', { streamingText: '', thinking: '' }),
- })
- );
- expect(store.getState().chatRuntime.interruptedAssistantByThread['t-empty']).toBeUndefined();
- });
-
- it('clears a stale interrupted partial when a completed snapshot lands', () => {
- const store = makeStore();
- store.dispatch(hydrateRuntimeFromSnapshot({ snapshot: makeInterruptedPartialSnapshot('t-c') }));
- expect(store.getState().chatRuntime.interruptedAssistantByThread['t-c']).toBeDefined();
-
- store.dispatch(
- hydrateRuntimeFromSnapshot({
- snapshot: makeInterruptedPartialSnapshot('t-c', {
- lifecycle: 'completed',
- streamingText: '',
- thinking: '',
- }),
- })
- );
- expect(store.getState().chatRuntime.interruptedAssistantByThread['t-c']).toBeUndefined();
- });
});
describe('hydrateRuntimeFromSnapshot — transcript seq ordering (fix 5)', () => {