@devries-cameron20 / t3code Mirror · read-only / commits / bfd37b774b
Fork 0

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 22, 09:30 UTC

fix(web): Queued messages can be edited during Compact and send (#27310)

Co-authored-by: maria-rcks <maria@kuuro.net>

Mike Olson committed Oct 31, 2026 at 22:18 UTC bfd37b774bc3402e2980f08e21381f96b4ba43ab
2 files changed +38 -3
apps/web/src/components/ChatView.logic.test.ts
+34
@@ -193,6 +193,40 @@ describe("hasServerAcknowledgedLocalDispatch", () => {
193 ).toBe(false);
194 });
195
196 + it.each([
197 + ["queued", "message-queued", true],
198 + ["queued", "message-before-send", false],
199 + ["preparing", "message-queued", false],
200 + ["starting", "message-queued", false],
201 + ] as const)("acknowledges %s with latest message %s: %s", (status, messageId, acknowledged) => {
202 + const localDispatch = createLocalDispatchSnapshot(
203 + makeThread({ latestRun: completedTurn, runtime: readySession }),
204 + { latestUserMessageId: MessageId.make("message-before-send") },
205 + );
206 + // The shell hides the silent compaction run, so its runtime reports the queued message's run.
207 + const queuedRun = {
208 + ...completedTurn,
209 + runId: RunId.make("turn-queued"),
210 + status: "queued" as const,
211 + requestedAt: "2026-03-29T00:01:00.000Z",
212 + startedAt: null,
213 + completedAt: null,
214 + };
215 +
216 + expect(
217 + hasServerAcknowledgedLocalDispatch({
218 + localDispatch,
219 + phase: "running",
220 + latestRun: queuedRun,
221 + latestUserMessageId: MessageId.make(messageId),
222 + runtime: { ...readySession, status },
223 + hasPendingApproval: false,
224 + hasPendingUserInput: false,
225 + threadError: null,
226 + }),
227 + ).toBe(acknowledged);
228 + });
229 +
230 it("waits for the matching running turn before acknowledging", () => {
231 const localDispatch = createLocalDispatchSnapshot(
232 makeThread({ latestRun: completedTurn, runtime: readySession }),
apps/web/src/components/ChatView.logic.ts
+4 -3
@@ -1101,14 +1101,15 @@ export function hasServerAcknowledgedLocalDispatch(input: {
1101 if (input.hasPendingApproval || input.hasPendingUserInput || Boolean(input.threadError)) {
1102 return true;
1103 }
1104 + const latestUserMessageChanged =
1105 + input.localDispatch.latestUserMessageId !== (input.latestUserMessageId ?? null);
1106 if (input.phase === "connecting" || derivePhase(input.runtime ?? null) === "connecting") {
1105 - return false;
1107 + // A message queued behind other work, such as an idle compaction the shell hides, has landed.
1108 + return input.runtime?.status === "queued" && latestUserMessageChanged;
1109 }
1110
1111 const latestRun = input.latestRun ?? null;
1112 const runtime = input.runtime ?? null;
1110 - const latestUserMessageChanged =
1111 - input.localDispatch.latestUserMessageId !== (input.latestUserMessageId ?? null);
1113 const latestRunChanged =
1114 input.localDispatch.latestRunId !== (latestRun?.runId ?? null) ||
1115 input.localDispatch.latestRunRequestedAt !== (latestRun?.requestedAt ?? null) ||