Skip to content

Commit 4b71aa2

Browse files
committed
feat(code): remove thinking msg during compaction
1 parent 8c85de8 commit 4b71aa2

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

apps/code/src/renderer/features/sessions/components/ConversationView.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ export function ConversationView({
5353
const debugLogsCloudRuns = useSettingsStore((s) => s.debugLogsCloudRuns);
5454
const showDebugLogs = agentLogsEnabled && debugLogsCloudRuns;
5555

56-
const { items: conversationItems, lastTurnInfo } = useMemo(
56+
const {
57+
items: conversationItems,
58+
lastTurnInfo,
59+
isCompacting,
60+
} = useMemo(
5761
() =>
5862
buildConversationItems(events, isPromptPending, {
5963
showDebugLogs,
@@ -199,6 +203,7 @@ export function ConversationView({
199203
queuedCount={queuedMessages.length}
200204
hasPendingPermission={pendingPermissionsCount > 0}
201205
pausedDurationMs={pausedDurationMs}
206+
isCompacting={isCompacting}
202207
/>
203208
</div>
204209
}

apps/code/src/renderer/features/sessions/components/SessionFooter.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface SessionFooterProps {
1111
queuedCount?: number;
1212
hasPendingPermission?: boolean;
1313
pausedDurationMs?: number;
14+
isCompacting?: boolean;
1415
}
1516

1617
export function SessionFooter({
@@ -21,8 +22,9 @@ export function SessionFooter({
2122
queuedCount = 0,
2223
hasPendingPermission = false,
2324
pausedDurationMs,
25+
isCompacting = false,
2426
}: SessionFooterProps) {
25-
if (isPromptPending) {
27+
if (isPromptPending && !isCompacting) {
2628
// Show static "waiting" state when permission is pending
2729
if (hasPendingPermission) {
2830
return (

apps/code/src/renderer/features/sessions/components/buildConversationItems.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export interface LastTurnInfo {
5151
export interface BuildResult {
5252
items: ConversationItem[];
5353
lastTurnInfo: LastTurnInfo | null;
54+
isCompacting: boolean;
5455
}
5556

5657
interface TurnState {
@@ -71,6 +72,7 @@ interface ItemBuilder {
7172
currentTurn: TurnState | null;
7273
pendingPrompts: Map<number, TurnState>;
7374
shellExecutes: Map<string, { item: UserShellExecute; index: number }>;
75+
isCompacting: boolean;
7476
nextId: () => number;
7577
}
7678

@@ -81,6 +83,7 @@ function createItemBuilder(): ItemBuilder {
8183
currentTurn: null,
8284
pendingPrompts: new Map(),
8385
shellExecutes: new Map(),
86+
isCompacting: false,
8487
nextId: () => idCounter++,
8588
};
8689
}
@@ -179,7 +182,7 @@ export function buildConversationItems(
179182
}
180183
: null;
181184

182-
return { items: b.items, lastTurnInfo };
185+
return { items: b.items, lastTurnInfo, isCompacting: b.isCompacting };
183186
}
184187

185188
function handlePromptRequest(
@@ -354,6 +357,9 @@ function handleNotification(
354357
if (isPosthogMethod(msg.method, "status")) {
355358
if (!b.currentTurn) ensureImplicitTurn(b, ts);
356359
const params = msg.params as { status: string; isComplete?: boolean };
360+
if (params.status === "compacting" && !params.isComplete) {
361+
b.isCompacting = true;
362+
}
357363
pushItem(b, {
358364
sessionUpdate: "status",
359365
status: params.status,
@@ -382,6 +388,7 @@ function handleNotification(
382388
}
383389

384390
function markCompactingStatusComplete(b: ItemBuilder) {
391+
b.isCompacting = false;
385392
for (let i = b.items.length - 1; i >= 0; i--) {
386393
const item = b.items[i];
387394
if (

0 commit comments

Comments
 (0)