test(e2e): find the native Plan chip in the Coordinator chat thread (#21727)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The QA Cloud plan-revise-accept journey checks that a person can
revise and approve an agent's Plan
> - It first checks that the saved Plan chip is visible, scoped to a
settled `task-chat-turn` so a live "Writing plan" chip cannot count
> - The Coordinator workspace renders the Plan chip directly in the chat
thread; there is no `task-chat-turn` element and no `data-settled`
attribute
> - So the journey never finds the chip and fails before the person
reviews the plan
> - This pull request also accepts the chip in the chat thread
> - The benefit is that the plan journey reaches the revision and
approval steps it exists to test

## Linked Issues or Issue Description

**What happened?**
On QA Cloud (build 5acf27bc), plan-revise-accept failed with
`journey_operation_failed`, no checks passed, one run. The agent saved a
correct two-step Plan and a revision-bound confirmation. The
confirmation stayed pending until cleanup closed the task, so the
browser never reached it.

**Steps to reproduce**
1. Open the failed journey task on QA (Coordinator workspace).
2. Query `[data-testid="task-chat-turn"][data-settled="true"]
[data-testid="task-chat-plan-preview"]`: 0 matches.
3. Query `[data-testid="task-chat-thread"]
[data-testid="task-chat-plan-preview"]`: 1 visible match, aria-label
"Open Plan revision 1 in task sidebar".

**Expected behavior**
The journey finds the saved Plan chip and continues to "Request
changes".

## What Changed

- `planStageRootSelector(native)`: native root is a settled task-chat
turn or the task chat thread. `expectPlanStageVisible` uses it. The
revision-name check from #21701 is unchanged.

Why this still detects the failure that matters:
`runPlanRevisionAcceptance` waits through the API until every task run
is terminal before this check, and the aria-label must name the exact
revision, which a live "Writing plan" chip does not.

## Verification

- On the live failed QA page: old scope finds 0 chips; new scope finds 1
visible chip whose label matches `planPreviewLabel(1)`.
- `tests/runner-e2e` plan-revision tests: 4 pass (new selector test
included).
- QA Cloud rerun of plan-revise-accept follows after merge and the
harness pin update.

## Risks

- Low risk: journey code only.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and
code execution.

## 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 branch name describes the change (e.g. `docs/...`, `fix/...`)
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
- [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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 authored and GitHub committed 2026-11-15 06:12:41 +00:00
1 parent 61c315ebab
commit 6400698a8e
2 files changed
+11 -2

No files matched your search

+6 -1
View File
@@ -1,6 +1,6 @@
import { expect, it, vi } from "vitest"; import { expect, it, vi } from "vitest";
import type { Page } from "@playwright/test"; import type { Page } from "@playwright/test";
import { planPreviewLabel, runPlanRevisionAcceptance } from "./plan-revision-flow.js"; import { planPreviewLabel, planStageRootSelector, runPlanRevisionAcceptance } from "./plan-revision-flow.js";
const state = { const state = {
currentIssue: { status: "in_progress" }, currentIssue: { status: "in_progress" },
@@ -44,3 +44,8 @@ it("accepts the classic and Coordinator Plan preview names for the exact revisio
expect(planPreviewLabel(2).test("Open Plan revision 1 in task sidebar")).toBe(false); expect(planPreviewLabel(2).test("Open Plan revision 1 in task sidebar")).toBe(false);
expect(planPreviewLabel(1).test("Open Plan in task sidebar")).toBe(false); expect(planPreviewLabel(1).test("Open Plan in task sidebar")).toBe(false);
}); });
it("finds the native Plan chip in a settled turn or directly in the Coordinator chat thread", () => {
expect(planStageRootSelector(true).split(", ")).toEqual(['[data-testid="task-chat-turn"][data-settled="true"]', '[data-testid="task-chat-thread"]']);
expect(planStageRootSelector(false)).toBe("body");
});
+5 -1
View File
@@ -23,8 +23,12 @@ export function planPreviewLabel(revision: number): RegExp {
return new RegExp(`^Open Plan revision ${revision}(?: in task sidebar)?$`); return new RegExp(`^Open Plan revision ${revision}(?: in task sidebar)?$`);
} }
export function planStageRootSelector(native: boolean): string {
return native ? '[data-testid="task-chat-turn"][data-settled="true"], [data-testid="task-chat-thread"]' : "body";
}
export async function expectPlanStageVisible(page: Page, options: { native: boolean; revision: number | null }) { export async function expectPlanStageVisible(page: Page, options: { native: boolean; revision: number | null }) {
const root = options.native ? page.locator('[data-testid="task-chat-turn"][data-settled="true"]') : page.locator("body"); const root = page.locator(planStageRootSelector(options.native));
const preview = root.getByTestId("task-chat-plan-preview").last(); const preview = root.getByTestId("task-chat-plan-preview").last();
await expect(preview).toBeVisible({ timeout: 30_000 }); await expect(preview).toBeVisible({ timeout: 30_000 });
if (options.revision !== null) await expect(preview).toHaveAttribute("aria-label", planPreviewLabel(options.revision)); if (options.revision !== null) await expect(preview).toHaveAttribute("aria-label", planPreviewLabel(options.revision));