GeezerVison is showing github.com — fix(client-runtime): feedback trace durations near 10 s no longer sho… · only21mil/t3code@ebdfe94
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/client-runtime/src
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/client-runtime/src/feedbackRequest.test.ts +20Lines changed: 20 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,4 +78,24 @@ describe("feedback preview", () => { |
78 | 78 | "Adds the text of your messages and the agent's replies in the last 2 turns.", |
79 | 79 | ); |
80 | 80 | }); |
| 81 | + |
| 82 | + it("drops the decimal once a tool duration rounds to 10 seconds", () => { |
| 83 | + const lines = feedbackTraceLines({ |
| 84 | + turns: 1, |
| 85 | + textTurns: 0, |
| 86 | + truncated: false, |
| 87 | + entries: [9_949, 9_960, 10_000].map((durationMs) => ({ |
| 88 | + turn: 1, |
| 89 | + type: "tool" as const, |
| 90 | + tool: "shell", |
| 91 | + outcome: "ok" as const, |
| 92 | + durationMs, |
| 93 | + })), |
| 94 | + }); |
| 95 | + expect(lines.map((entry) => entry.line)).toEqual([ |
| 96 | + "Turn 1 · shell · ok · 9.9 s", |
| 97 | + "Turn 1 · shell · ok · 10 s", |
| 98 | + "Turn 1 · shell · ok · 10 s", |
| 99 | + ]); |
| 100 | + }); |
81 | 101 | }); |
Collapse file
Copy file name to clipboardExpand all lines: packages/client-runtime/src/feedbackRequest.ts +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -68,7 +68,10 @@ export function feedbackPreviewFields( |
68 | 68 | ].filter((field) => field.value !== ""); |
69 | 69 | } |
70 | 70 |
|
71 | | -const seconds = (ms: number) => `${(ms / 1_000).toFixed(ms < 10_000 ? 1 : 0)} s`; |
| 71 | +const seconds = (ms: number) => { |
| 72 | + const tenths = (ms / 1_000).toFixed(1); |
| 73 | + return `${Number(tenths) < 10 ? tenths : (ms / 1_000).toFixed(0)} s`; |
| 74 | +}; |
72 | 75 |
|
73 | 76 | /** One line per outline entry, plus the message text that goes with it. */ |
74 | 77 | export function feedbackTraceLines( |
|