Skip to content

Commit dd69556

Browse files
fix(server): keep synthetic errors out of native history
Only defer error context when its native item reference proves the provider already has it. Implemented With: Codex via GPT-6 Luna on OpenAI through T3 Code
1 parent 3f004d7 commit dd69556

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/nativeThreadHistory.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,34 @@ it("only treats retained provider input as native transcript history", () => {
116116
},
117117
}),
118118
).toBe(true);
119+
expect(
120+
itemIsInNativeThread({
121+
...shared,
122+
item: {
123+
type: "error",
124+
threadId,
125+
providerThreadId,
126+
runId: afterCompaction,
127+
nativeItemRef: null,
128+
},
129+
}),
130+
).toBe(false);
131+
expect(
132+
itemIsInNativeThread({
133+
...shared,
134+
item: {
135+
type: "error",
136+
threadId,
137+
providerThreadId,
138+
runId: afterCompaction,
139+
nativeItemRef: {
140+
driver: ProviderDriverKind.make("codex"),
141+
nativeId: "error-1",
142+
strength: "strong",
143+
},
144+
},
145+
}),
146+
).toBe(true);
119147
expect(
120148
itemIsInNativeThread({
121149
...shared,

‎apps/server/src/orchestration-v2/nativeThreadHistory.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ export const itemIsInNativeThread = (input: {
5656
if (
5757
item.type === "run_interrupt_result" ||
5858
item.kind === "run_interrupt_result" ||
59-
((item.type === "command_execution" || item.kind === "command_execution") &&
59+
((item.type === "command_execution" ||
60+
item.kind === "command_execution" ||
61+
item.type === "error" ||
62+
item.kind === "error") &&
6063
item.nativeItemRef?.nativeId == null) ||
6164
item.threadId !== input.threadId ||
6265
item.providerThreadId !== input.providerThreadId ||

0 commit comments

Comments
 (0)