Stabilize running task chain of thought

Keep live run chain-of-thought sections in the active Working state until the run itself completes, even during gaps between command executions. Add a regression test for a running run whose latest command already has a result.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-04-24 13:32:07 -05:00
1 parent e729c0b1fe
commit ef740acbae
2 files changed
+61 -2

No files matched your search

@@ -1460,6 +1460,66 @@ describe("IssueChatThread", () => {
});
});
it("keeps a running chain-of-thought in the Working state between commands", () => {
const root = createRoot(container);
act(() => {
root.render(
<MemoryRouter>
<IssueChatThread
comments={[]}
linkedRuns={[]}
timelineEvents={[]}
liveRuns={[{
id: "run-1",
issueId: "issue-1",
status: "running",
invocationSource: "comment",
triggerDetail: null,
startedAt: "2026-04-06T12:00:00.000Z",
finishedAt: null,
createdAt: "2026-04-06T12:00:00.000Z",
agentId: "agent-1",
agentName: "Agent 1",
adapterType: "codex_local",
}]}
transcriptsByRunId={new Map([
[
"run-1",
[
{
kind: "tool_call",
ts: "2026-04-06T12:00:10.000Z",
name: "command_execution",
toolUseId: "tool-1",
input: { command: "pnpm test" },
},
{
kind: "tool_result",
ts: "2026-04-06T12:00:20.000Z",
toolUseId: "tool-1",
toolName: "command_execution",
content: "Tests passed",
isError: false,
},
],
],
])}
onAdd={async () => {}}
enableLiveTranscriptPolling={false}
/>
</MemoryRouter>,
);
});
expect(container.textContent).toContain("Working");
expect(container.textContent).not.toContain("Worked");
act(() => {
root.unmount();
});
});
it("folds chain-of-thought when the same message transitions from running to complete", () => {
expect(resolveAssistantMessageFoldedState({
messageId: "message-1",
+1 -2
View File
@@ -768,8 +768,7 @@ function IssueChatChainOfThought({
(p): p is ToolCallMessagePart => p.type === "tool-call",
);
const hasActiveTool = toolParts.some((t) => t.result === undefined);
const isActive = isMessageRunning && hasActiveTool;
const isActive = isMessageRunning;
const [expanded, setExpanded] = useState(isActive);
const rawSegments = Array.isArray(custom.chainOfThoughtSegments)