Skip to content

Commit 67a7a32

Browse files
centdixclaude
andcommitted
revert: drop terminal-routed history polling (pending TUI questions aren't persisted)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2115eba commit 67a7a32

2 files changed

Lines changed: 0 additions & 89 deletions

File tree

frontend/src/lib/MobileChatSurface.svelte

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -280,37 +280,6 @@
280280
};
281281
});
282282
283-
// A freshly-created worktree runs Claude in the terminal (e.g. `claude -- "<prompt>"`),
284-
// not the web `claude -p` socket, so those turns never publish live stream events.
285-
// While that agent is actively working and we have no live stream, poll history so
286-
// its messages — including a pending AskUserQuestion — show up in the web chat.
287-
const agentWorking = $derived(worktree.agent === "working");
288-
289-
$effect(() => {
290-
if (!agentWorking) return;
291-
292-
let requestInFlight = false;
293-
const interval = window.setInterval(() => {
294-
if (requestInFlight) return;
295-
if (conversation?.provider !== "claudeCode") return;
296-
if (hasActiveConversationStream(conversation.conversationId)) return;
297-
requestInFlight = true;
298-
void (async () => {
299-
try {
300-
applyConversationResponse(await requestConversation("history"));
301-
} catch (error) {
302-
conversationError = error instanceof Error ? error.message : String(error);
303-
} finally {
304-
requestInFlight = false;
305-
}
306-
})();
307-
}, REFRESH_POLL_INTERVAL_MS);
308-
309-
return () => {
310-
window.clearInterval(interval);
311-
};
312-
});
313-
314283
$effect(() => {
315284
const pollingState = refreshPollingState;
316285
if (!pollingState) return;

frontend/src/lib/MobileChatSurface.test.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -265,64 +265,6 @@ describe("MobileChatSurface", () => {
265265
await screen.findByText("Done from terminal");
266266
});
267267

268-
it("polls Claude history for a terminal-routed run while the agent is working", async () => {
269-
vi.mocked(attachWorktreeConversation).mockResolvedValue(createConversationResponse("claudeCode"));
270-
vi.mocked(fetchWorktreeConversationHistory).mockResolvedValue(createConversationResponse("claudeCode", {
271-
messages: [
272-
{
273-
id: "ask-1",
274-
turnId: "turn-1",
275-
order: 0,
276-
role: "assistant",
277-
kind: "toolUse",
278-
toolName: "AskUserQuestion",
279-
toolCallId: "ask-1",
280-
text: JSON.stringify({
281-
questions: [
282-
{
283-
question: "Cats or dogs?",
284-
header: "Pet type",
285-
multiSelect: false,
286-
options: [{ label: "Cats" }, { label: "Dogs" }],
287-
},
288-
],
289-
}),
290-
status: "completed",
291-
createdAt: "2026-05-28T10:00:00.000Z",
292-
},
293-
],
294-
}));
295-
296-
render(MobileChatSurface, {
297-
props: {
298-
worktree: createWorktree({ agent: "working" }),
299-
},
300-
});
301-
302-
await vi.advanceTimersByTimeAsync(1000);
303-
304-
await waitFor(() => {
305-
expect(fetchWorktreeConversationHistory).toHaveBeenCalledWith("feature/mobile-chat");
306-
});
307-
await screen.findByRole("button", { name: "Cats" });
308-
});
309-
310-
it("does not poll history for an idle Claude worktree on mount", async () => {
311-
vi.mocked(attachWorktreeConversation).mockResolvedValue(createConversationResponse("claudeCode"));
312-
vi.mocked(fetchWorktreeConversationHistory).mockResolvedValue(createConversationResponse("claudeCode"));
313-
314-
render(MobileChatSurface, {
315-
props: {
316-
worktree: createWorktree({ agent: "waiting" }),
317-
},
318-
});
319-
320-
await screen.findByText("No messages yet. Send the first prompt to start this chat.");
321-
await vi.advanceTimersByTimeAsync(3000);
322-
323-
expect(fetchWorktreeConversationHistory).not.toHaveBeenCalled();
324-
});
325-
326268
it("does not poll Codex history after sending when the websocket stream is active", async () => {
327269
vi.mocked(attachWorktreeConversation).mockResolvedValue(createConversationResponse("codexAppServer"));
328270
vi.mocked(sendWorktreeConversationMessage).mockResolvedValue({

0 commit comments

Comments
 (0)