GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(web): an expanded thinking row no longer re-parses the whole rea… · pingdotgg/t3code@caea7c4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components/chat
    • MessagesTimeline.browser.test.tsx
    • TimelineWorkEntryRow.logic.ts
    • TimelineWorkEntryRow.tsx
    • TimelineWorkGroupRows.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/chat/MessagesTimeline.browser.test.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,41 @@ describe("MessagesTimeline agent messages", () => {
368368
});
369369
});
370370

371+
describe("MessagesTimeline live reasoning", () => {
372+
it("labels an expanded live thought from its opening instead of the whole trace", async () => {
373+
const runId = RunId.make("thinking-run");
374+
const trace = `Checking the **parser** first. ${"Then the next file. ".repeat(1_000)}`;
375+
await using screen = await renderTimeline(
376+
[
377+
{
378+
kind: "work",
379+
id: "thought",
380+
createdAt: CREATED_AT,
381+
entry: {
382+
id: "thought",
383+
runId,
384+
createdAt: CREATED_AT,
385+
label: "Thinking",
386+
tone: "thinking",
387+
itemType: "reasoning",
388+
detail: trace,
389+
toolLifecycleStatus: "inProgress",
390+
},
391+
},
392+
],
393+
{ isWorking: true, activeTurnInProgress: true, runningRunId: runId },
394+
);
395+
const row = () => screen.container.querySelector<HTMLElement>("button[aria-expanded]")!;
396+
await click(row());
397+
await vi.waitFor(() => expect(row().getAttribute("aria-expanded")).toBe("true"));
398+
399+
const label = row().textContent ?? "";
400+
expect(label.startsWith("Checking the parser first. Then the next file.")).toBe(true);
401+
// The label is one truncated line, so streaming a long trace must not flatten all of it.
402+
expect(label.length).toBeLessThan(trace.length / 4);
403+
});
404+
});
405+
371406
describe("compact reasoning math", () => {
372407
it("keeps formulas while flattening compact reasoning previews", () => {
373408
const tree = parseMarkdownWithMath("## Reasoning\n\nUse **norm** $|x|$ and \\[x^2\\]");
Collapse file

‎apps/web/src/components/chat/TimelineWorkEntryRow.logic.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/components/chat/TimelineWorkEntryRow.logic.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ export function workEntryIconName(workEntry: TimelineWorkEntry): WorkEntryIconNa
188188
return workToneIcon(workEntry.tone).iconName;
189189
}
190190

191+
/** The preview is one truncated line; bound parsing work while long traces stream. */
192+
export function thoughtPreviewSource(markdown: string): string {
193+
return markdown.slice(0, 1_500);
194+
}
195+
191196
/** Compact reasoning keeps formulas while flattening other Markdown into label text. */
192197
export function remarkThoughtPreview(fallback: string) {
193198
return (tree: Root) => {
Collapse file

‎apps/web/src/components/chat/TimelineWorkEntryRow.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/chat/TimelineWorkEntryRow.tsx
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import {
6464
buildToolCallExpandedBody,
6565
workEntryIconName,
6666
remarkThoughtPreview,
67+
thoughtPreviewSource,
6768
} from "./TimelineWorkEntryRow.logic";
6869

6970
export function useThreadReadTarget(entry: TimelineWorkEntry, environmentId: EnvironmentId) {
@@ -411,7 +412,7 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
411412
{isReasoning && !expanded ? (
412413
<ChatMarkdown
413414
inline
414-
text={workEntry.detail ?? previewText}
415+
text={thoughtPreviewSource(workEntry.detail ?? previewText)}
415416
cwd={ctx.markdownCwd}
416417
parseRawHtml={false}
417418
extraRemarkPlugins={[
Collapse file

‎apps/web/src/components/chat/TimelineWorkGroupRows.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/chat/TimelineWorkGroupRows.tsx
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {
5252
} from "./TimelineWorkEntryRow";
5353
import {
5454
remarkThoughtPreview,
55+
thoughtPreviewSource,
5556
toolGroupSummaryIconName,
5657
workEntryIconName,
5758
} from "./TimelineWorkEntryRow.logic";
@@ -558,7 +559,7 @@ export function LiveWorkEntryTimelineRow({
558559
) : row.entry.itemType === "reasoning" ? (
559560
<ChatMarkdown
560561
inline
561-
text={row.entry.detail ?? label}
562+
text={thoughtPreviewSource(row.entry.detail ?? label)}
562563
cwd={ctx.markdownCwd}
563564
parseRawHtml={false}
564565
extraRemarkPlugins={[[remarkThoughtPreview, row.active ? "Thinking" : "Thought"]]}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.