mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 09:39:53 +01:00
test(ui): keep initial reasoning with the saved reply (#15107)
## 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 <noreply@paperclip.ing>
This commit is contained in:
1 parent
45862dd210
commit
81cd03b3b5
1 file changed
+27
-2
@@ -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(<TaskChatThread {...props} />);
|
||||
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"),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user