Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(chat): outline only user messages in the conversation minimap

vastsa5caa0c227b27
diff --git a/apps/desktop/src/components/ConversationMinimap.tsx b/apps/desktop/src/components/ConversationMinimap.tsx
index 94eb03aac..abda75f3d 100644
--- a/apps/desktop/src/components/ConversationMinimap.tsx
+++ b/apps/desktop/src/components/ConversationMinimap.tsx
@@ -18,7 +18,7 @@ import {
import { TooltipButton } from "./ui";
/* Codex-style conversation minimap: a packed stack of dashes on the left edge
- * of the thread, one per user turn or assistant response. Moving the cursor
+ * of the thread, one per user message. Moving the cursor
* along the rail magnifies nearby dashes with a macOS-Dock cosine falloff, the
* nearest turn shows a preview popover, and clicking jumps to that turn. Dashes
* grow horizontally only, so magnification never shifts the stack layout. */
@@ -362,8 +362,7 @@ export const ConversationMinimap = memo(function ConversationMinimap({
return null;
}
- const roleLabel = (role: ConversationMinimapMarker["role"]) =>
- role === "user" ? t("chat.userMessage") : t("chat.assistantMessage");
+ const userLabel = t("chat.userMessage");
const earlierLabel = loadingEarlier
? t("chat.loadingEarlierMessages")
: t("chat.showEarlierMessages");
@@ -403,10 +402,10 @@ export const ConversationMinimap = memo(function ConversationMinimap({
if (node) markerEls.current.set(marker.id, node);
else markerEls.current.delete(marker.id);
}}
- className={`minimap-marker ${marker.role} ${
+ className={`minimap-marker user ${
marker.id === activeId ? "active" : ""
}`}
- aria-label={roleLabel(marker.role)}
+ aria-label={userLabel}
aria-current={marker.id === activeId ? "true" : undefined}
onFocus={(event) =>
setHovered({
@@ -425,7 +424,7 @@ export const ConversationMinimap = memo(function ConversationMinimap({
style={{ top: `${hovered.top}px` }}
>
<div className="minimap-popover-role">
- {roleLabel(hovered.marker.role)}
+ {userLabel}
</div>
<div className="minimap-popover-text">{hovered.marker.preview}</div>
</div>
diff --git a/apps/desktop/src/lib/conversation-minimap.ts b/apps/desktop/src/lib/conversation-minimap.ts
index 644bbcfbe..5fcb70af1 100644
--- a/apps/desktop/src/lib/conversation-minimap.ts
+++ b/apps/desktop/src/lib/conversation-minimap.ts
@@ -3,7 +3,6 @@ import { messageContentFacts } from "./transcript-summary";
export type ConversationMinimapMarker = {
id: string;
- role: "user" | "assistant";
preview: string;
};
@@ -21,56 +20,19 @@ export function shouldRenderConversationMinimap({
return hasEarlier || (markerCount >= 2 && overflows);
}
-function appendPreview(current: string, next: string): string {
- if (!next || current.length >= CONVERSATION_MINIMAP_PREVIEW_MAX_CHARS) {
- return current;
- }
- return `${current}${current ? "\n\n" : ""}${next}`.slice(
- 0,
- CONVERSATION_MINIMAP_PREVIEW_MAX_CHARS,
- );
-}
-
-/** Build one user marker and one assistant marker per conversational turn. */
+/** Build one marker per user message; assistant output is not outlined. */
export function buildConversationMinimapMarkers(
messages: UiMessage[],
): ConversationMinimapMarker[] {
const markers: ConversationMinimapMarker[] = [];
- let assistantMarkerIndex: number | null = null;
-
for (const message of messages) {
- if (message.role === "user") {
- markers.push({
- id: message.id,
- role: "user",
- preview: messageContentFacts(message).trimmedContent.slice(
- 0, CONVERSATION_MINIMAP_PREVIEW_MAX_CHARS,
- ),
- });
- assistantMarkerIndex = null;
- continue;
- }
- if (message.role !== "assistant") continue;
-
- // Later fragments cannot change a saturated preview or its first anchor.
- if (assistantMarkerIndex !== null &&
- markers[assistantMarkerIndex].preview.length >= CONVERSATION_MINIMAP_PREVIEW_MAX_CHARS
- ) continue;
- const content = messageContentFacts(message).trimmedContent;
- if (!content) continue;
- if (assistantMarkerIndex === null) {
- markers.push({
- id: message.id,
- role: "assistant",
- preview: content.slice(0, CONVERSATION_MINIMAP_PREVIEW_MAX_CHARS),
- });
- assistantMarkerIndex = markers.length - 1;
- continue;
- }
-
- const marker = markers[assistantMarkerIndex];
- marker.preview = appendPreview(marker.preview, content);
+ if (message.role !== "user") continue;
+ markers.push({
+ id: message.id,
+ preview: messageContentFacts(message).trimmedContent.slice(
+ 0, CONVERSATION_MINIMAP_PREVIEW_MAX_CHARS,
+ ),
+ });
}
-
return markers;
}
diff --git a/apps/desktop/src/styles/chat-shell.css b/apps/desktop/src/styles/chat-shell.css
index 893be6e20..cc88a8791 100644
--- a/apps/desktop/src/styles/chat-shell.css
+++ b/apps/desktop/src/styles/chat-shell.css
@@ -569,10 +569,6 @@
--dash-w: 13px;
}
-.minimap-marker.assistant {
- --dash-w: 8px;
-}
-
.minimap-marker.history {
--dash-w: 13px;
--history-marker-color: color-mix(in oklab, var(--ds-text-primary) 14%, transparent);
diff --git a/apps/desktop/test/conversation-minimap.test.mjs b/apps/desktop/test/conversation-minimap.test.mjs
index 4b35e7ec4..ab1aee5db 100644
--- a/apps/desktop/test/conversation-minimap.test.mjs
+++ b/apps/desktop/test/conversation-minimap.test.mjs
@@ -59,7 +59,7 @@ test("shows a completed outline only with enough markers and overflow", () => {
);
});
-test("uses one assistant marker for all response fragments in a user turn", () => {
+test("marks only user messages", () => {
const markers = buildConversationMinimapMarkers([
message("user-1", "user", "First question"),
message("assistant-1a", "assistant", "First sentence."),
@@ -69,38 +69,19 @@ test("uses one assistant marker for all response fragments in a user turn", () =
message("assistant-2", "assistant", "Second response."),
]);
- assert.deepEqual(
- markers.map(({ id, role }) => ({ id, role })),
- [
- { id: "user-1", role: "user" },
- { id: "assistant-1a", role: "assistant" },
- { id: "user-2", role: "user" },
- { id: "assistant-2", role: "assistant" },
- ],
- );
- assert.equal(markers[1].preview, "First sentence.\n\nSecond sentence.");
-});
-
-test("starts the assistant marker at the first contentful response fragment", () => {
- const markers = buildConversationMinimapMarkers([
- message("user-1", "user", "Question"),
- { ...message("thinking", "assistant", ""), thinking: "Reasoning" },
- message("tool-1", "tool", "tool output"),
- message("answer", "assistant", "Final answer"),
+ assert.deepEqual(markers, [
+ { id: "user-1", preview: "First question" },
+ { id: "user-2", preview: "Second question" },
]);
-
- assert.deepEqual(markers.map((marker) => marker.id), ["user-1", "answer"]);
});
-test("caps the combined assistant preview", () => {
+test("caps the user preview", () => {
const markers = buildConversationMinimapMarkers([
- message("user-1", "user", "Question"),
- message("assistant-1a", "assistant", "a".repeat(200)),
- message("assistant-1b", "assistant", "b".repeat(200)),
+ message("user-1", "user", "a".repeat(400)),
]);
assert.equal(
- markers[1].preview.length,
+ markers[0].preview.length,
CONVERSATION_MINIMAP_PREVIEW_MAX_CHARS,
);
});
diff --git a/apps/desktop/test/transcript-projection.test.mjs b/apps/desktop/test/transcript-projection.test.mjs
index 75748a9b4..7afcd7e38 100644
--- a/apps/desktop/test/transcript-projection.test.mjs
+++ b/apps/desktop/test/transcript-projection.test.mjs
@@ -207,7 +207,7 @@ test("deterministic replacement sequences match grouping after each update", ()
}
});
-test("a saturated minimap preview ignores later huge fragments but keeps user boundaries", () => {
+test("the minimap never reads assistant bodies and marks only user messages", () => {
let reads = 0;
const later = message("later", "assistant", "");
Object.defineProperty(later, "content", { get() { reads++; return "x".repeat(100_000); } });
@@ -217,5 +217,5 @@ test("a saturated minimap preview ignores later huge fragments but keeps user bo
message("u2", "user", "Next"), message("a2", "assistant", "Second answer"),
]);
assert.equal(reads, 0);
- assert.deepEqual(markers.map(({ id }) => id), ["u", "first", "u2", "a2"]);
+ assert.deepEqual(markers.map(({ id }) => id), ["u", "u2"]);
});
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index d719f966e..1745fdd2f 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1742,9 +1742,8 @@ storage but compose into one assistant turn until the next user message.
view. Plain project-file references still prefer the bundled file view, whose
open contract does not carry a line position.
- Hover or focus a minimap marker: show the localized sender and a bounded
- plaintext preview; multiple assistant fragments produced within one user
- turn are combined into one AI-response marker and preview; nearby markers
- magnify horizontally without reflowing the rail
+ plaintext preview of that user message; nearby markers magnify horizontally
+ without reflowing the rail
- Click a minimap marker: smoothly scroll its message near the top of the
transcript viewport
- Scroll the transcript: update the active minimap marker against an anchor
@@ -1856,10 +1855,8 @@ storage but compose into one assistant turn until the next user message.
- The minimap renders when at least two eligible turn markers exist **and** the
transcript content overflows one viewport (scrollHeight > clientHeight), or
whenever earlier history remains unmounted or unloaded (D269).
- Each visible user message creates one marker; all contentful assistant
- fragments until the next user message create one AI-response marker anchored
- to the first contentful fragment. Tool-only rows do not create markers or
- split an AI response, and a one-page transcript never shows the rail.
+ Each visible user message creates one marker; assistant and tool rows do
+ not create markers, and a one-page transcript never shows the rail.
- Marker previews are capped at 280 source characters and are display-only
- Derived visible rows, minimap rows, and activity grouping share the immutable
`messages` projection with the Composer context inspector. After warm-up, an
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index e4c1ddc92..3d1ed3ae1 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -3906,8 +3906,8 @@ identify the platform validation still needed.
#### E2E-041: Conversation minimap navigates long transcripts
- **Preconditions**: A session contains enough user and assistant turns to
- scroll beyond one viewport and densely fill the minimap, including one AI
- response emitted as multiple assistant fragments around tool activity; a
+ scroll beyond one viewport and densely fill the minimap, including assistant
+ responses emitted as multiple fragments around tool activity; a
second session has at least two eligible turn markers that still fit in one
viewport.
- **Steps**: 1) Open the long session. 2) Scroll through the transcript and
@@ -3918,13 +3918,11 @@ identify the platform validation still needed.
window taller until content no longer overflows, then shorter again. 9) At a
short window height, inspect and activate the first and last markers near the
minimap's vertical bounds, including from the titlebar-facing side.
-- **Expected**: The rail contains one marker per visible user turn and one per
- AI response. Multiple assistant fragments between two user messages share a
- single marker and combined bounded preview, while tool-only rows create no
- marker and do not split the response. The marker near the upper-third reading
+- **Expected**: The rail contains one marker per visible user message;
+ assistant and tool rows create no marker. The marker near the upper-third reading
anchor exposes `aria-current`; hover and focus show the same localized sender
and preview; nearby markers magnify horizontally without shifting the stack;
- activation smoothly scrolls to the first contentful message in that response;
+ activation smoothly scrolls to that user message;
the rail is absent when fewer than two eligible markers exist **or** when
content does not overflow one viewport; the rail reappears once overflow
returns after a resize. Dense markers remain centered in the unobstructed
diff --git a/scripts/e2e/transcript-long-history.tsx b/scripts/e2e/transcript-long-history.tsx
index d24929db2..c90ec232b 100644
--- a/scripts/e2e/transcript-long-history.tsx
+++ b/scripts/e2e/transcript-long-history.tsx
@@ -241,11 +241,12 @@ export async function transcriptLongHistoryProbe() {
const largest = sessions[2];
await select(largest);
// A mounted older row must invalidate its own projection and minimap preview.
- const older = largest.messages[largest.messages.length - 7];
+ // The outline only marks user messages, so correct a mounted older user row.
+ const older = largest.messages.slice(0, -6).findLast((item) => item.role === "user")!;
send(largest.summary.id, { type: "message_end", message: { ...older, content: "Older row corrected", status: "complete" } });
await until(() => host.textContent?.includes("Older row corrected") === true, "older row correction");
await settled();
- const markers = [...host.querySelectorAll<HTMLButtonElement>(".minimap-marker.assistant")];
+ const markers = [...host.querySelectorAll<HTMLButtonElement>(".minimap-marker.user")];
assert(markers.length > 0, "minimap markers missing");
let freshPreview = false;
const previews: string[] = [];