The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 08:45 UTC
fix: avoid duplicating streamed assistant completion text (#465)
James committed
Mar 9, 2026 at 10:29 UTC
57aa6bf16cd0dcfbe9037a5ca29ad61bdd2a857e
2 files changed
+6
-1
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts
+1
@@ -834,6 +834,7 @@ describe("ProviderRuntimeIngestion", () => {
834
payload: {
835
itemType: "assistant_message",
836
status: "completed",
837
+ detail: "hello live",
838
},
839
});
840
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
+5
-1
@@ -951,6 +951,10 @@ const make = Effect.gen(function* () {
951
if (assistantCompletion) {
952
const assistantMessageId = assistantCompletion.messageId;
953
const turnId = toTurnId(event.turnId);
954
+ const existingAssistantMessage = thread.messages.find((entry) => entry.id === assistantMessageId);
955
+ const shouldApplyFallbackCompletionText =
956
+ !existingAssistantMessage ||
957
+ existingAssistantMessage.text.length === 0;
958
if (turnId) {
959
yield* rememberAssistantMessageId(thread.id, turnId, assistantMessageId);
960
}
@@ -963,7 +967,7 @@ const make = Effect.gen(function* () {
967
createdAt: now,
968
commandTag: "assistant-complete",
969
finalDeltaCommandTag: "assistant-delta-finalize",
966
- ...(assistantCompletion.fallbackText !== undefined
970
+ ...(assistantCompletion.fallbackText !== undefined && shouldApplyFallbackCompletionText
971
? { fallbackText: assistantCompletion.fallbackText }
972
: {}),
973
});