From 81cd03b3b542ea4af291ef56d5084fbf6410eb9c Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Mon, 5 Oct 2026 21:09:09 -0500 Subject: [PATCH] test(ui): keep initial reasoning with the saved reply (#15107) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip helps people manage AI agents and their work. > - The issue thread shows saved replies and agent run history. > - History that appears after the reply can move the page. > - Master now waits for initial run history before it shows the thread in #15228. > - This pull request checks that reasoning and the saved reply appear together in the first visible frame. > - The test protects that behavior from a later change. ## Linked Issues or Issue Description No public issue tracks this report. This is a bug regression test. **What happened?** The issue thread showed a saved answer before its reasoning and tool history loaded. The later history moved the page. **Expected behavior** The first visible thread contains the initial reasoning and the saved reply in order. **Steps to reproduce** 1. Open an issue with an agent run and a saved reply. 2. Delay initial run-history hydration. 3. Observe the saved reply before its reasoning appears. Related work: #15228 now contains the reveal gate. This PR adds a direct regression assertion for that gate. #14667 takes a different loading approach and remains open. ## What Changed - Add a saved agent reply to the initial-history test. - Assert that the native run's reasoning appears before that reply when the thread becomes visible. - Assert that the thread stays inert until history is ready. ## Verification - `vitest run ui/src/components/TaskChatThread.test.tsx ui/src/pages/IssueDetail.test.tsx` passed: 353 tests. - `git diff --check origin/master...HEAD` passed. - GitHub CI checks are in progress for the rebased head. ## Risks - Low risk. This PR changes only a test. - The production fix is already in #15228. This PR must not restore the older code from the previous branch head. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used OpenAI Codex CLI assisted with tool use and code execution. The exact model ID and context window were not exposed to this agent session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes: #` / `Refs: #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My remote branch name describes the change and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes (no user-facing documentation changed) - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip --- ui/src/components/TaskChatThread.test.tsx | 29 +++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/ui/src/components/TaskChatThread.test.tsx b/ui/src/components/TaskChatThread.test.tsx index 11ca30d76a6..10854e06cc8 100644 --- a/ui/src/components/TaskChatThread.test.tsx +++ b/ui/src/components/TaskChatThread.test.tsx @@ -437,7 +437,15 @@ describe.each(["legacy", "native"] as const)("%s task history readiness", (runti async (status) => { const props = { issueId: "issue-1", - comments: createLongThreadComments(), + comments: [...createLongThreadComments(), { + ...createLongThreadComments()[3], + id: "agent-answer", + authorType: "agent" as const, + authorAgentId: "agent-1", + body: "Final saved reply", + runId: "started-run", + createdAt: new Date("2026-08-25T18:00:02.000Z"), + }], onAdd: async () => {}, linkedRuns: [ retryRun, @@ -455,9 +463,17 @@ describe.each(["legacy", "native"] as const)("%s task history readiness", (runti container.querySelector('[data-testid="task-chat-history-loading"]'), ).not.toBeNull(); expect(container.textContent).toContain("Thread message 1"); - + expect(container.querySelector('[data-thread-anchor="comment-1"]')?.closest('[inert]')).not.toBeNull(); transcriptState.hydratedRunIds = new Set(["started-run"]); nativeTranscriptState.hydratedRunIds = new Set(["started-run"]); + transcriptState.transcriptByRun.set("started-run", [{ + kind: "thinking", text: "Reasoning before the reply", + ts: "2026-08-25T18:00:01.000Z", + }]); + nativeTranscriptState.transcriptByRun.set("started-run", [{ + kind: "assistant", text: "Reasoning before the reply", channel: "progress", + ts: "2026-08-25T18:00:01.000Z", + }]); render(); await act(async () => { await new Promise((resolve) => requestAnimationFrame(resolve)); @@ -467,6 +483,15 @@ describe.each(["legacy", "native"] as const)("%s task history readiness", (runti expect( container.querySelector('[data-testid="task-chat-history-loading"]'), ).toBeNull(); + expect(container.querySelector('[data-thread-anchor="comment-1"]')?.closest('[inert]')).toBeNull(); + expect(container.textContent).toContain("Thread message 1"); + if (status === "succeeded" && runtimeMode === "native") { + expect(container.textContent).toContain("Reasoning before the reply"); + expect(container.textContent).toContain("Final saved reply"); + expect(container.textContent!.indexOf("Reasoning before the reply")).toBeLessThan( + container.textContent!.indexOf("Final saved reply"), + ); + } }, ); });