+36
![github-actions[bot]](/assets/img/avatar_default.png)








Julius Marminge
maria-rcks
Bilal Bakr
shivam
Vitalii Yehorov
Jake Leventhal
Claude Opus 5
Alex Southwell
github-actions[bot]
Nicholas Wasmiller
PB
Exotic
Yash Singh
Devin
Theo Browne
Gabriel De Andrade
Dara Adedeji
scratchyone
Dominic Roy
chukfinley
Primož Ajdišek
benthecarman
NaveDanan
aaditagrawal
Aditya Garud
Nick Anisimov
MacKinley Smith
Yordis Prieto
t3-code[bot]
AKolenda
Guillermo Casanova
Otavio Salvador
Shirish Pothi
Ishaan Kothari
Bob Fowler
Anton Bezdenezhnykh
ValeraZSD
Ephraim
Ryan Ilano
Alex
maco
Cursor
Tristan Knight
PR Batch Tester
oliver
kamkm
de34391427
Co-authored-by: maria-rcks <[email protected]> Co-authored-by: Bilal Bakr <[email protected]> Co-authored-by: shivam <[email protected]> Co-authored-by: Vitalii Yehorov <[email protected]> Co-authored-by: Jake Leventhal <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Alex Southwell <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Nicholas Wasmiller <[email protected]> Co-authored-by: PB <[email protected]> Co-authored-by: Exotic <[email protected]> Co-authored-by: Yash Singh <[email protected]> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Theo Browne <[email protected]> Co-authored-by: Gabriel De Andrade <[email protected]> Co-authored-by: Dara Adedeji <[email protected]> Co-authored-by: scratchyone <[email protected]> Co-authored-by: Dominic Roy <[email protected]> Co-authored-by: chukfinley <[email protected]> Co-authored-by: Primož Ajdišek <[email protected]> Co-authored-by: benthecarman <[email protected]> Co-authored-by: NaveDanan <[email protected]> Co-authored-by: aaditagrawal <[email protected]> Co-authored-by: Aditya Garud <[email protected]> Co-authored-by: Nick Anisimov <[email protected]> Co-authored-by: MacKinley Smith <[email protected]> Co-authored-by: Yordis Prieto <[email protected]> Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com> Co-authored-by: AKolenda <[email protected]> Co-authored-by: Guillermo Casanova <[email protected]> Co-authored-by: Otavio Salvador <[email protected]> Co-authored-by: Shirish Pothi <[email protected]> Co-authored-by: Ishaan Kothari <[email protected]> Co-authored-by: Bob Fowler <[email protected]> Co-authored-by: Anton Bezdenezhnykh <[email protected]> Co-authored-by: ValeraZSD <[email protected]> Co-authored-by: Ephraim <[email protected]> Co-authored-by: Ryan Ilano <[email protected]> Co-authored-by: Alex <[email protected]> Co-authored-by: maco <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Tristan Knight <[email protected]> Co-authored-by: PR Batch Tester <[email protected]> Co-authored-by: oliver <[email protected]> Co-authored-by: kamkm <[email protected]> Signed-off-by: Yordis Prieto <[email protected]>
172 lines
5.4 KiB
TypeScript
172 lines
5.4 KiB
TypeScript
import { RunId, ThreadId, TurnItemId, type OrchestrationV2TurnItem } from "@t3tools/contracts";
|
|
import * as DateTime from "effect/DateTime";
|
|
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { deriveTimelineEntriesFromVisibleTurnItems } from "./session-logic";
|
|
import {
|
|
deriveMessagesTimelineRows,
|
|
workEntryDisplayLabel,
|
|
} from "./components/chat/MessagesTimeline.logic";
|
|
|
|
const retainedMessage =
|
|
"2026-03-14T16:11:12.550224Z ERROR codex_core::codex: failed to load skill /home/sebherrerabe/repos/devsuite/.agent/skills/monorepo-scaffolding/SKILL.md: invalid YAML: mapping va...";
|
|
const warningSummary =
|
|
"2026-03-14T16:11:12.550224Z ERROR codex_core::codex: failed to load skill /home/sebherrerabe/repos/devsuite/.agent/sk...";
|
|
const now = DateTime.makeUnsafe("2026-09-05T00:00:00.000Z");
|
|
const baseItem = {
|
|
id: TurnItemId.make("diagnostic"),
|
|
threadId: ThreadId.make("thread-1"),
|
|
runId: RunId.make("run-1"),
|
|
nodeId: null,
|
|
providerThreadId: null,
|
|
providerTurnId: null,
|
|
nativeItemRef: null,
|
|
parentItemId: null,
|
|
ordinal: 0,
|
|
status: "completed" as const,
|
|
title: "Runtime error",
|
|
startedAt: now,
|
|
completedAt: now,
|
|
updatedAt: now,
|
|
};
|
|
|
|
function workEntry(item: OrchestrationV2TurnItem) {
|
|
const [entry] = deriveTimelineEntriesFromVisibleTurnItems({
|
|
visibleTurnItems: [
|
|
{
|
|
position: 0,
|
|
visibility: "local",
|
|
sourceThreadId: item.threadId,
|
|
sourceItemId: item.id,
|
|
item,
|
|
},
|
|
],
|
|
optimisticMessages: [],
|
|
});
|
|
if (entry?.kind !== "work") throw new Error("Expected a work-log entry");
|
|
return entry.entry;
|
|
}
|
|
|
|
function errorItem(
|
|
overrides: Partial<Extract<OrchestrationV2TurnItem, { type: "error" }>> = {},
|
|
): Extract<OrchestrationV2TurnItem, { type: "error" }> {
|
|
return {
|
|
...baseItem,
|
|
type: "error",
|
|
failure: {
|
|
class: "provider_error",
|
|
message: retainedMessage,
|
|
code: "runtime_error",
|
|
retryable: false,
|
|
},
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe("runtime diagnostics in the v2 work log", () => {
|
|
it("shows the retained error message in place of a generic row label", () => {
|
|
const entry = workEntry(errorItem());
|
|
|
|
expect(entry).toMatchObject({ label: "Runtime error", detail: retainedMessage });
|
|
expect(workEntryDisplayLabel(entry, undefined)).toBe(retainedMessage);
|
|
});
|
|
|
|
it("shows the retained diagnostic message beyond its truncated title", () => {
|
|
const entry = workEntry(errorItem({ title: warningSummary }));
|
|
|
|
expect(entry).toMatchObject({ label: warningSummary, detail: retainedMessage });
|
|
expect(workEntryDisplayLabel(entry, undefined)).toBe(retainedMessage);
|
|
});
|
|
|
|
it("uses the full system notice instead of a truncated warning title", () => {
|
|
const entry = workEntry({
|
|
...baseItem,
|
|
type: "system_notice",
|
|
title: warningSummary,
|
|
message: retainedMessage,
|
|
});
|
|
|
|
expect(entry.label).toBe(retainedMessage);
|
|
expect(workEntryDisplayLabel(entry, undefined)).toBe(retainedMessage);
|
|
expect(entry.detail).toBeUndefined();
|
|
});
|
|
|
|
it("keeps retry progress visible while retaining its diagnostic detail", () => {
|
|
const entry = workEntry(
|
|
errorItem({
|
|
title: "Provider retry",
|
|
status: "running",
|
|
retry: { attempt: 2, maxAttempts: 5, retryDelayMs: 1_500 },
|
|
}),
|
|
);
|
|
|
|
expect(workEntryDisplayLabel(entry, undefined)).toBe("Retrying provider (2/5)");
|
|
expect(entry.detail).toBe(`${retainedMessage} Retrying in 1.5s.`);
|
|
});
|
|
|
|
it("keeps a diagnostic separate from adjacent tool summaries", () => {
|
|
const entries = deriveTimelineEntriesFromVisibleTurnItems({
|
|
visibleTurnItems: [
|
|
{
|
|
...baseItem,
|
|
type: "command_execution" as const,
|
|
id: TurnItemId.make("command-before"),
|
|
input: "git status",
|
|
output: "clean",
|
|
exitCode: 0,
|
|
},
|
|
errorItem(),
|
|
{
|
|
...baseItem,
|
|
type: "command_execution" as const,
|
|
id: TurnItemId.make("command-after"),
|
|
input: "git diff",
|
|
output: "",
|
|
exitCode: 0,
|
|
},
|
|
].map((item, position) => ({
|
|
position,
|
|
visibility: "local" as const,
|
|
sourceThreadId: item.threadId,
|
|
sourceItemId: item.id,
|
|
item,
|
|
})),
|
|
optimisticMessages: [],
|
|
});
|
|
const rows = deriveMessagesTimelineRows({
|
|
timelineEntries: entries,
|
|
isWorking: true,
|
|
activeTurnStartedAt: DateTime.formatIso(now),
|
|
latestRun: {
|
|
runId: baseItem.runId,
|
|
status: "running",
|
|
startedAt: DateTime.formatIso(now),
|
|
completedAt: null,
|
|
},
|
|
turnDiffSummaries: [],
|
|
supportsConversationRollback: false,
|
|
});
|
|
const diagnostic = rows.find((row) => row.id === baseItem.id);
|
|
|
|
expect(diagnostic?.kind).toBe("work");
|
|
if (diagnostic?.kind !== "work") throw new Error("Expected a diagnostic row");
|
|
expect(diagnostic.isExpandedToolGroup).toBe(false);
|
|
expect(diagnostic.groupedEntries).toHaveLength(1);
|
|
expect(workEntryDisplayLabel(diagnostic.groupedEntries[0]!, undefined)).toBe(retainedMessage);
|
|
});
|
|
|
|
it("does not turn an unrelated tool payload message into a diagnostic", () => {
|
|
const entry = workEntry({
|
|
...baseItem,
|
|
type: "dynamic_tool",
|
|
title: "Read file",
|
|
toolName: "read_file",
|
|
input: {},
|
|
output: { message: retainedMessage },
|
|
});
|
|
|
|
expect(entry.label).toBe("Read file");
|
|
expect(entry.detail).toBeUndefined();
|
|
});
|
|
});
|