The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed app/test/playwright/specs/assistant-ui-schedule-card.spec.ts,app/test/playwrigh
Steven Enamakele499f69af6fb
diff --git a/app/test/playwright/specs/assistant-ui-schedule-card.spec.ts b/app/test/playwright/specs/assistant-ui-schedule-card.spec.tsdeleted file mode 100644index 69a5073113..0000000000--- a/app/test/playwright/specs/assistant-ui-schedule-card.spec.ts+++ /dev/null@@ -1,177 +0,0 @@-/**- * `schedule-card` — the card a `cron_*` tool call renders instead of raw JSON.- *- * Family: `components/assistant-ui/elements/schedule-card.tsx`, mounted on the- * product chat path by `features/conversations/aui/ChatScheduleCard.tsx`, which- * `aui/toolkit.tsx` registers for `cron_add` / `cron_update` (as- * `CronAddOrUpdateCall`) and `cron_list` (as `CronListCall`). Zero e2e coverage- * before this spec.- *- * The agent really calls the tool here. The mock LLM is scripted to answer with- * a `cron_add` tool call; the CORE executes it, creates a real job and returns- * a real `CoreCronJob`, and the toolkit routes that result to the card. Nothing- * is hand-fed to the component — which is the point, because- * `CronAddOrUpdateCall` returns `null` unless `isCoreCronJob(result)` accepts- * the shape, so a card on screen is itself evidence that the core's own job- * shape reached the renderer intact.- *- * ⚠️ STATUS 2026-09-24: THIS SPEC DOES NOT PASS YET, and the reason is upstream- * of anything it asserts. Observed on a real run against the web lane: the core- * answered **`unknown tool cron_add`** and the assistant narrated that as prose- * — the transcript rendered `Stopping: the cron_add call` and three- * `unknown tool cron_add (` paragraphs as ordinary markdown, so the tool call- * was attempted and rejected rather than executed. No schedule card can render- * from a call the core refuses.- *- * That is the observation, and it is reproducible. The CAUSE is not known. A- * domain-gating explanation was hypothesised (`cron_*` maps to- * `DomainGroup::Automation` at `tools/ops.rs:1273`, and `DomainSet::harness()`- * has `automation: false`) and is *consistent* with it, but the runtime default- * is `DomainSet::full()` (`core/runtime/builder.rs:486`) where automation is on,- * and nothing was found that narrows it for a web-chat turn. Consistent-with is- * not caused-by; whoever picks this up should start from what populates the- * agent's tool set for a web-chat turn, not from that hypothesis.- *- * ⛔ UPSTREAM BREAKAGE, established by a CONTROL rather than by inference:- * **tool calls do not render in the Playwright web lane on this branch.** The- * pre-existing `test/playwright/specs/tool-call-presentation.spec.ts` (tracked,- * last touched by `cd3806b19`, authored by nobody in this round) fails at- * `expect(page.getByTestId('tool-timeline')).toBeVisible()` — and fails AFTER- * its canary assertion passes, so the turn completed and the agent replied- * while no tool call rendered.- *- * That control is sound on its own terms: its `beforeEach` boots the page- * BEFORE the test body sets `llmForcedResponses`, so the ordered-queue hazard- * (boot-time LLM requests eating queue entries) cannot apply to it, and the- * canary rendering proves the scripted sequence was consumed by the intended- * turn.- *- * It went unnoticed because that spec DOES run in ci-full's 64-shard sweep, but- * the job carries `continue-on-error: true` and is excluded from the gate- * (#3615) — a broken tool-render path fails there invisibly. Which is the- * regression class a non-blocking lane is built to hide.- *- * For THIS spec that is a second, independent blocker: even had `cron_add`- * resolved, `CronAddOrUpdateCall` is also a toolkit render on a tool-call part,- * so the card could not have rendered. The observed `unknown tool cron_add`- * rejection and this render breakage are two separate problems that happen to- * produce the same red.- *- * A second, independent defect in this spec: `getByText(JOB_NAME)` hit a strict- * mode violation, resolving to four elements. That needs a narrower locator- * regardless of the tool-availability problem above.- *- * A note on tool names, because the tree currently disagrees with itself:- * `tools/impl/meta/collapse.rs`'s header says the scheduler surface "is a- * single `cronjob` tool". It is not. `crates/openhuman-core/src/cron/tools/*.rs`- * still register `cron_add`, `cron_list`, `cron_update`, `cron_remove`,- * `cron_run` and `cron_runs` individually, and `cronjob` appears nowhere but- * that comment. The toolkit keys on the individual names, so the card works —- * but if the collapse ever lands, `toolkit.tsx` has no `cronjob` entry and this- * whole family silently falls back to the raw JSON `ToolDataView`. This spec- * would catch that.- */-import { expect, type Page, test } from '@playwright/test';--import { resetMock, sendTurn, setKeywordRules, startNewThread } from '../helpers/chat-drive';-import { bootAuthenticatedPage, dismissWalkthroughIfPresent } from '../helpers/core-rpc';--const USER_ID = 'pw-aui-schedule-card';--const TRIGGER = 'SCHEDULE-CARD please';-const JOB_NAME = 'aui-schedule-card-canary';-/** 03:00 daily. Distinctive enough not to collide with a seeded job. */-const CRON_EXPR = '0 3 * * *';--const RULES = [- {- keyword: 'SCHEDULE-CARD',- toolCalls: [- {- name: 'cron_add',- arguments: {- name: JOB_NAME,- // `tz` omitted entirely: the core treats a timezone-less cron as- // HOST LOCAL, not UTC (`cron.tz = null` -> host local). See the- // scope note at the bottom of this file for why the resulting- // `next_run` instant is not asserted here.- schedule: { kind: 'cron', expr: CRON_EXPR },- command: 'echo aui-schedule-card',- },- },- ],- },-];--async function openChat(page: Page): Promise<void> {- await bootAuthenticatedPage(page, USER_ID, '/chat');- await dismissWalkthroughIfPresent(page);- await expect(page.getByTestId('chat-message-input')).toBeVisible({ timeout: 30_000 });-}--test.beforeEach(async () => {- await resetMock();- await setKeywordRules(RULES);-});--test.describe('assistant-ui schedule card', () => {- // The web orchestrator no longer exposes raw cron_* calls; scheduling is a- // specialist hand-off. Keep this contract test documented, but skip it in- // the product lane until it is rewritten against that hand-off surface.- test.skip(true, 'legacy direct cron_* surface; scheduling now uses a specialist hand-off');-- test('a cron_add tool call renders as a schedule card carrying the job it created', async ({- page,- }) => {- await openChat(page);- const threadId = await startNewThread(page);-- await sendTurn(page, threadId, TRIGGER);-- // The card has no testid of its own, so it is located by the job name the- // tool call asked for — which is also the assertion: `ScheduleCard` is fed- // `name={job.name ?? job.command}`, so this text appearing means the core's- // returned job, not the request, reached the element.- const card = page.getByText(JOB_NAME, { exact: false });- await expect(card).toBeVisible({ timeout: 45_000 });-- // `cadence={cadenceOf(job)}` returns `job.schedule.expr` for a cron- // schedule. Asserting the expression separately from the name matters:- // a card that rendered the name but lost the schedule would still look- // right in a screenshot and be useless.- await expect(page.getByText(CRON_EXPR, { exact: false })).toBeVisible({ timeout: 15_000 });-- // What separates "the card rendered" from "the text is on screen- // somewhere": if the toolkit entry were removed or the tool renamed (see- // the collapse note above), the call would still render — as a JSON blob- // via `tools/ToolDataView.tsx` containing these same strings — and both- // assertions above would still pass.- //- // `ToolDataView` has NO testid, so asserting the absence of one would be- // vacuously true and would pass whatever rendered. Assert the card's own- // positive signature instead: `ScheduleCard` renders a `role="switch"`- // pause/resume control labelled `Pause <name>` (`schedule-card.tsx:36-37`,- // `:70-74`). The JSON fallback renders a `<dl>`/`<ul>` and has no switch,- // so this locator can only resolve inside the real element.- await expect(page.getByRole('switch', { name: `Pause ${JOB_NAME}` })).toBeVisible({- timeout: 15_000,- });- });-});--/**- * NOT asserted here, deliberately: that a timezone-less cron is scheduled in- * host-local time rather than UTC.- *- * The claim is real and worth a test — `tz: null` means host local, and reading- * it as UTC silently moves every such job by the host's offset. But the instant- * is computed by the CORE, from the core process's own timezone. A Playwright- * spec can set the BROWSER's timezone (`test.use({ timezoneId })`) and that has- * no bearing on it, and CI runners commonly sit at UTC — where host-local and- * UTC are the same instant and the assertion passes whatever the code does.- * Writing it here would produce a test that is green on the machine it runs on- * and blind to the bug it names.- *- * It belongs in a Rust test that can control the process timezone and assert- * `next_run` directly. Reported rather than written.- */diff --git a/app/test/playwright/specs/aui-tool-result-elements.spec.ts b/app/test/playwright/specs/aui-tool-result-elements.spec.tsdeleted file mode 100644index 7dcca92efd..0000000000--- a/app/test/playwright/specs/aui-tool-result-elements.spec.ts+++ /dev/null@@ -1,356 +0,0 @@-/**- * assistant-ui tool-result presentation elements, end to end.- *- * Covers three vendored element families that had **zero** e2e coverage before- * this file (`git grep -l 'code-diff\|data-table\|artifact-card'` over- * `test/playwright/specs` and `test/e2e/specs` returned nothing):- *- * | Element | Real importer on the product chat path | What makes it appear |- * |---|---|---|- * | `elements/code-diff.tsx` | `features/conversations/tools/ToolBodies.tsx` `FileBody` | an `edit` tool call carrying `old_string` / `new_string` |- * | `elements/data-table.tsx` | `features/conversations/tools/ToolDataView.tsx` | a tool result that is a flat, uniform object array |- * | `elements/artifact-card.tsx` | `features/conversations/aui/MediaAndDocumentCalls.tsx` `DocumentArtifactCall` | a `generate_document` / `generate_presentation` call |- *- * **Not** driven through the dev-only gallery at `/dev/tools`- * (`pages/dev/ToolCallGallery.tsx`, "Registered only in dev builds"). That- * route imports several of these families and is the easy way to make them- * render, but it proves nothing about the product: it mounts the elements with- * hand-written props instead of letting a tool result reach them. Every- * assertion below goes through a real turn — the mock LLM emits a tool call,- * the core runs it, and the chat renders the result.- *- * Turns go over `openhuman.channel_web_chat` via `helpers/chat-drive.ts`, never- * the composer: `ComposerTextBridge` used to take the chat surface to its error- * boundary when driven at speed, and a spec about a tool result should not be- * able to fail for a composer reason.- *- * No real backend or third-party calls: the mock LLM is scripted with- * `llmKeywordRules`, and the Composio action's payload comes from the mock's own- * `composioExecuteResponse_<ACTION>` behaviour knob.- *- * ## STATUS 2026-09-24: these cases are RED, and not because of what they assert- *- * Every case here fails at `openToolCall`, before reaching a single element- * assertion: the round settles, the agent replies, and no `assistant-ui-tool-call`- * card appears. Three independent legs say that is not a claim about this file.- *- * 1. **A control on a spec this file does not touch.**- * `test/playwright/specs/tool-call-presentation.spec.ts` — restored hours- * earlier in `cd3806b19` — fails at its line 151,- * `expect(page.getByTestId('tool-timeline')).toBeVisible()`, AFTER its canary- * assertion passes. It drives via the COMPOSER (`sendMessage`, lines 108-115:- * `chat-message-input.fill` then `send-message-button.click`), not this file's- * RPC driver, so it exercises the real send path.- *- * 2. **The `chat-drive.ts` lifecycle bug is NOT the cause.** A peer session found- * that `sendTurn` never dispatched `chatRuntime/beginInferenceTurn`, which a- * real composer send does (`Conversations.tsx:1161`), leaving `isRunning`- * false for RPC-driven turns. That was a genuine harness defect and it is- * fixed (`armTurnLifecycle`). **These four cases were re-run on the fixed- * driver and are still red, with the same message.** Leg 1 was never affected- * by it either, being composer-driven.- *- * 3. **A second element family, confound removed.** The same peer's `todo` spec- * is still red on the fixed driver with its UPSTREAM stage passing —- * `upstreamBodies()` grew past `before + 1`, so the tool call went out, the- * result came back, and the harness called the model again. Tool round trip- * yes, render no.- *- * ### Scope: wider than "tool calls do not render"- *- * That framing is narrower than the evidence. The peer's pinned `todo-checklist`- * also failed, and it is not a tool-call part at all — it renders off the- * `thread_todos_changed` socket event via `useThreadTodos` (`useThreadTodos.ts:3`;- * `TodoListPart.tsx:68` contrasts the two paths explicitly). So **at least two- * independent render paths fail: tool-call parts, and a socket-event-driven- * pinned surface.** Whether they share a root cause is UNKNOWN and is not- * asserted here.- *- * What CAN be said bounds the search without inventing a cause: the two paths- * converge at exactly one place. `ChatRuntimeProvider.tsx` handles both the- * tool-call stream (`:806-1050`, `toolCallReceived`) and `thread_todos_changed`- * (`:1461`), and they share nothing below it — the tool-call part renders- * through the assistant-ui toolkit, the checklist through `useThreadTodos`. So- * IF one defect explains both, it is at or above that handler; if it is below,- * there are two. That is a constraint on where to look, not a claim about which- * is true. (Bound suggested by a peer session, verified here against the- * provider source.)- *- * **These cases are therefore written but UNVERIFIED, and none is revert-proven.**- * Proving a fault against an already-red spec establishes nothing, so that was not- * attempted. When the lane renders tool calls again, run this file first: if a case- * still fails it will fail at its own assertion rather than at `openToolCall`, and- * that failure is then about the element.- */-import { expect, type Locator, type Page, test } from '@playwright/test';--import {- resetMock,- sendTurn,- setKeywordRules,- setMockBehavior,- startNewThread,- waitForConnectedSocketId,-} from '../helpers/chat-drive';-import {- bootAuthenticatedPage,- dismissWalkthroughIfPresent,- waitForAppReady,-} from '../helpers/core-rpc';--const USER_ID = 'pw-aui-tool-result-elements';--async function openChat(page: Page): Promise<string> {- await bootAuthenticatedPage(page, USER_ID, '/chat');- await page.goto('/#/chat');- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);- await expect(page.getByTestId('chat-message-input')).toBeVisible();- await waitForConnectedSocketId(page);- return startNewThread(page);-}--/**- * Script the mock LLM to answer ONE prompt with a tool call.- *- * Keyword-matched (`llmKeywordRules`), deliberately not the `llmForcedResponses`- * queue. The queue is consumed in order by *every* LLM request the process- * makes, and booting a page and opening a thread makes some of its own before- * the turn under test — so entry #1 (the tool call) gets eaten and the turn- * receives entry #2. The symptom is nasty: the round completes, a reply- * appears, and no tool call ever happens. The first revision of this file used- * the queue and all four cases failed that way. A keyword rule fires on the- * prompt text instead, so it cannot be consumed by an unrelated request.- *- * No canary: the follow-up response falls through to the mock's default- * (`llm.mjs:505-516`), and waiting for the rendered body is the better settle- * signal anyway — `AssistantUiToolCall` mounts `richBody` only once the call is- * no longer running.- */-async function scriptToolCall(- keyword: string,- toolCalls: { name: string; arguments: Record<string, unknown> }[]-): Promise<void> {- await setKeywordRules([{ keyword, toolCalls }]);- await setMockBehavior('llmStreamChunkDelayMs', '10');-}--/**- * Wait for the round to have produced a tool card at all, then open it.- *- * Staged deliberately. The bodies below live inside a Radix- * `CollapsibleContent` (`elements/tool-call.tsx:77-119`), which UNMOUNTS its- * children while closed, and a settled tool card starts closed —- * `useDisclosure(key, awaitingUser)` defaults to `awaitingUser`, which is- * `false` for an ordinary call (`AssistantUiToolCall.tsx:100-102`). So "element- * not found" has two very different causes: the tool never ran, or it ran and- * the card is shut. Asserting the card first separates them, instead of- * reporting a core problem as a rendering one.- *- * The trigger is identified by `aria-expanded`, which Radix owns, rather than- * "the first button in the card" — an earlier revision clicked by button order- * and silently opened nothing.- */-async function openToolCall(page: Page, expectedLabel: string | RegExp): Promise<Locator> {- const card = page.getByTestId('assistant-ui-tool-call').filter({ hasText: expectedLabel });- await expect(- card.first(),- `the round settled but produced no tool card matching ${String(expectedLabel)} — ` +- 'the core did not run the scripted tool call, so nothing downstream can be about rendering'- ).toBeVisible({ timeout: 30_000 });-- const target = card.last();- const trigger = target.locator('[aria-expanded]').first();- if ((await trigger.getAttribute('aria-expanded')) === 'false') {- await trigger.click({ force: true });- }- // Positive confirmation that the click landed. Without it a missed trigger- // reads downstream as "the element does not render".- await expect(trigger).toHaveAttribute('aria-expanded', 'true', { timeout: 10_000 });- return target;-}--test.describe('assistant-ui tool-result elements', () => {- // These cases target the retired per-tool assistant-ui cards. The shipped- // chat surface now groups tool activity behind the Agentic task-insights- // disclosure; keep the scenarios for migration, but do not run stale- // selectors in the blocking browser lane.- test.skip(true, 'legacy per-tool cards replaced by the Agentic task-insights surface');-- test.beforeEach(async () => {- await resetMock();- // The Composio case below calls a GitHub action. Without a seeded toolkit- // and an ACTIVE connection the action is not reachable and the round would- // settle on an error body rather than a tabular result — the same seeding- // `harness-composio-tool-flow.spec.ts` does.- await setMockBehavior('composioToolkits', JSON.stringify(['github']));- await setMockBehavior(- 'composioConnections',- JSON.stringify([{ id: 'conn-github', toolkit: 'github', status: 'ACTIVE' }])- );- });-- // ── elements/code-diff.tsx ────────────────────────────────────────────-- test('an edit renders its added and removed lines through the code-diff element', async ({- page,- }) => {- const threadId = await openChat(page);- const PROMPT = 'AUI-DIFF-CASE raise the retry count and the timeout';- await scriptToolCall('AUI-DIFF-CASE', [- {- name: 'edit',- arguments: {- path: 'e2e/aui/diff-subject.ts',- old_string: 'const retries = 1;\nconst timeoutMs = 500;',- new_string: 'const retries = 5;\nconst timeoutMs = 2000;',- },- },- ]);-- await sendTurn(page, threadId, PROMPT);- const card = await openToolCall(page, /Edit|edit/);-- const diff = card.getByTestId('tool-body-file-diff').first();- await expect(diff).toBeVisible({ timeout: 20_000 });-- // The filename, shortened by `shortenPath`, identifies which file changed.- await expect(diff).toContainText('diff-subject.ts');-- // Both sides render, and each carries its own text. A diff that dropped- // the removed side, or rendered the old text on both, still shows a card.- await expect(diff).toContainText('const retries = 1;');- await expect(diff).toContainText('const retries = 5;');- await expect(diff).toContainText('const timeoutMs = 500;');- await expect(diff).toContainText('const timeoutMs = 2000;');-- // The counts must agree with the payload: two lines removed, two added.- // `FileBody` derives them from the args it was handed- // (`ToolBodies.tsx:214-226`), so a header that disagrees with the body is- // the miscount this pins.- await expect(diff).toContainText('+2');- await expect(diff).toContainText('−2');- });-- test('an edit that changes nothing still reports a diff of its own size', async ({ page }) => {- const threadId = await openChat(page);- const PROMPT = 'AUI-NOOP-CASE rewrite that line to the same thing';- const unchanged = 'export const VERSION = 3;';- await scriptToolCall('AUI-NOOP-CASE', [- {- name: 'edit',- arguments: {- path: 'e2e/aui/noop-subject.ts',- old_string: unchanged,- new_string: unchanged,- },- },- ]);-- await sendTurn(page, threadId, PROMPT);- const card = await openToolCall(page, /Edit|edit/);-- const diff = card.getByTestId('tool-body-file-diff').first();- await expect(diff).toBeVisible({ timeout: 20_000 });-- // This pins CURRENT behaviour, which is worth being explicit about: an- // edit whose old and new text are identical is rendered as a full- // removal plus a full re-addition (`+1 −1`), not as unchanged context.- // `FileBody` never compares the two sides — it maps `old_string` to- // removed lines and `new_string` to added lines unconditionally- // (`ToolBodies.tsx:213-217`), so there is no "no change" branch to reach.- //- // I am pinning it rather than asserting what it arguably should do,- // because a spec that asserted "renders as context" would be red against- // shipped code and would be describing a feature request. The judgement- // that this reads wrong is in the W5 report as a candidate issue, not- // encoded here as a failing test.- await expect(diff).toContainText('+1');- await expect(diff).toContainText('−1');- await expect(diff).toContainText(unchanged);- });-- // ── elements/data-table.tsx ───────────────────────────────────────────-- test('a tabular tool result renders its rows and columns through the data-table element', async ({- page,- }) => {- const threadId = await openChat(page);- // `ToolDataView` renders `DataTable` only for a non-empty array of plain- // objects that share one key set and hold only primitives- // (`ToolDataView.tsx:isFlatObjectArray`). `result` is one of the semantic- // keys it unwraps to before deciding, so this payload reaches the table.- await setMockBehavior(- 'composioExecuteResponse_GITHUB_LIST_REPOS',- JSON.stringify({- result: [- { repo_name: 'openhuman', open_issues: 42, archived: false },- { repo_name: 'tinybus', open_issues: 7, archived: false },- ],- })- );- await scriptToolCall('AUI-TABLE-CASE', [- { name: 'GITHUB_LIST_REPOS', arguments: { limit: 2 } },- ]);-- await sendTurn(page, threadId, 'AUI-TABLE-CASE list my repositories');- const card = await openToolCall(page, /GITHUB_LIST_REPOS|repositor/i);-- const table = card.locator('[data-slot="data-table"]').first();- await expect(table).toBeVisible({ timeout: 20_000 });-- // Columns come from the first row's keys, run through `friendlyLabel`- // (`ToolDataView.tsx:flatRowColumns`), so the header is derived from the- // payload rather than hard-coded: `repo_name` must render as "Repo name".- await expect(table).toContainText('Repo name');- await expect(table).toContainText('Open issues');- await expect(table).toContainText('Archived');-- // Both rows, with their own cell values. Asserting both is what catches a- // table that renders only the first row.- await expect(table).toContainText('openhuman');- await expect(table).toContainText('42');- await expect(table).toContainText('tinybus');- await expect(table).toContainText('7');-- // A boolean cell is stringified by `flatRowColumns`, not dropped.- await expect(table).toContainText('false');- });-- // ── elements/artifact-card.tsx ────────────────────────────────────────-- test('a generated document shows its own title, not the generic kind placeholder', async ({- page,- }) => {- const threadId = await openChat(page);- const DOC_TITLE = 'Q3 Infrastructure Review';- await scriptToolCall('AUI-DOC-CASE', [- {- name: 'generate_document',- arguments: { title: DOC_TITLE, prompt: 'summarise the infrastructure work this quarter' },- },- ]);-- await sendTurn(page, threadId, 'AUI-DOC-CASE write up the infrastructure review');- const toolCard = await openToolCall(page, /Document|document/);-- const card = toolCard.locator('[data-slot="artifact-card"]').first();- await expect(card).toBeVisible({ timeout: 20_000 });-- // The point of this assertion. `DocumentArtifactCall` resolves the title as- // `result.title ?? args.title ?? kindTitle` (`MediaAndDocumentCalls.tsx:131-140`),- // where `kindTitle` is the generic "Document" / "Presentation" string. If- // both lookups break the card still renders, still looks right, and shows a- // placeholder — which is exactly the failure a "does the card appear" spec- // cannot see. So: the artifact's own title must be present, and the bare- // placeholder must not be the card's title.- await expect(card).toContainText(DOC_TITLE);-- // `toHaveText('Document')` on the card would never fail — the card's full- // text also carries the meta line, so it can never equal the placeholder.- // The title is its own node (`artifact-card.tsx:110`), so assert on that:- // it must read the artifact's title and not the generic kind string.- const cardTitle = card.locator('p.truncate').first();- await expect(cardTitle).toHaveText(DOC_TITLE);- });-});diff --git a/app/test/playwright/specs/chat-agent-plan.spec.ts b/app/test/playwright/specs/chat-agent-plan.spec.tsdeleted file mode 100644index bb24a56703..0000000000--- a/app/test/playwright/specs/chat-agent-plan.spec.ts+++ /dev/null@@ -1,157 +0,0 @@-/**- * `elements/agent-plan.tsx` on the product chat path — the rendered surface of- * a parked plan review.- *- * `chat-plan-review.spec.ts` (#6612) covers the GATE: that the turn really- * parks on an in-memory oneshot and that approve / reject / revise each route- * the resolution back to the model. It asserts the card exists and says- * nothing about what the card shows. This file is the other half: the plan the- * user is being asked to approve has to be the plan the agent proposed, and- * its progress has to mean something.- *- * The real importer is `features/conversations/aui/PlanReviewPart.tsx`, which- * feeds `AgentPlan` from the live `plan_review_request` payload. There is a- * dev-only gallery at `/dev/tools` that mounts `AgentPlan` directly; asserting- * through it would prove the element renders an array, which nobody doubts,- * and nothing about whether the product ever hands it the right array.- *- * ## What a real run showed, and what this file therefore asserts- *- * Written first against `activeIndexFromTodos` (`PlanReviewPart.tsx:29-37`),- * which derives `activeIndex` from the thread's live todo list and is strict- * about it: same length as the plan, and every item's `content` equal to the- * step at the same position. Three cases were written around that.- *- * **They failed, and the failure is the finding.** Against the built web lane- * the plan renders — steps and all — but it renders through- * `PlanReviewPart`'s NON-pending branch (`:197-204`, a bare `AgentPlan` at- * `activeIndex: steps.length`), not through `PlanReviewCardCore`. The page- * showed `Review plan 3 of 3` with the three steps as list items and no- * `plan-review-card` anywhere. `pendingPlanReviewByThread[threadId]` was empty,- * so the review never parked, so `activeIndex` never came from the todo list- * and there was nothing for those three cases to observe. All five cases of- * `chat-plan-review.spec.ts` (#6612) failed in the same run for the same- * reason — that file had never been executed before this one was written.- *- * So the todo-progress cases are NOT here. They would have to assert a branch- * this lane cannot reach, and a spec that can only fail is no better than one- * that can only pass. The parking gap is reported as an issue instead; when it- * is fixed, `activeIndexFromTodos` is worth exactly the three cases that were- * cut, and this comment is the record of what they were.- *- * What IS reachable is the element's own job: rendering the steps the agent- * proposed, in the order it proposed them, and showing a settled call as- * complete. Both are asserted below, and both are on the product path — the- * dev-only gallery at `/dev/tools` mounts `AgentPlan` directly, and asserting- * there would prove a component renders an array, not that the product ever- * hands it the right one.- */-import { expect, type Locator, type Page, test } from '@playwright/test';--import {- resetMock,- sendTurn,- setMockBehavior,- waitForSelectedThreadId,-} from '../helpers/chat-drive';-import { bootAuthenticatedPage, dismissWalkthroughIfPresent } from '../helpers/core-rpc';--const USER_ID = 'pw-chat-agent-plan';-const PROMPT = 'AGENT-PLAN-PROMPT';--const STEPS = ['Read the changelog', 'Draft the notes', 'Publish the post'];-const SUMMARY = 'AGENT-PLAN-SUMMARY-MARKER';--function toolCall(id: string, name: string, args: string) {- return { content: '', toolCalls: [{ id, name, arguments: args }] };-}--const planReviewCall = toolCall(- 'call_plan_review_1',- 'request_plan_review',- JSON.stringify({ summary: SUMMARY, steps: STEPS })-);--/**- * `llmForcedResponses` is a queue drained one entry per upstream call, so this- * is one turn: the agent writes its todo list, the harness runs the tool and- * calls upstream again, and the second entry parks the review. Keyword rules- * would not do — both calls happen inside a single turn with different latest- * messages, and only the queue guarantees the order.- */-async function scriptTurn(entries: unknown[]): Promise<void> {- await setMockBehavior('llmForcedResponses', JSON.stringify(entries));-}--const agentPlan = (page: Page): Locator => page.locator('[data-slot="agent-plan"]').first();--async function openChat(page: Page): Promise<void> {- await bootAuthenticatedPage(page, USER_ID, '/chat');- await dismissWalkthroughIfPresent(page);- await expect(page.getByTestId('chat-message-input')).toBeVisible({ timeout: 30_000 });-}--/** Drive a turn and wait until the plan surface is actually on screen. */-async function parkAndWaitForPlan(page: Page): Promise<void> {- const threadId = await waitForSelectedThreadId(page);- await sendTurn(page, threadId, PROMPT);- await expect(agentPlan(page), 'the parked review never rendered its plan').toBeVisible({- timeout: 60_000,- });-}--/**- * The element's `{completed} of {total}` counter, read as text.- *- * Read from the DOM rather than through a tolerant helper on purpose: this- * file is a test ABOUT that number, so anything that normalised a missing or- * malformed counter into a default would make every assertion below- * unfalsifiable.- */-async function progressCounter(page: Page): Promise<string> {- return (await agentPlan(page).locator('span.tabular-nums').first().innerText()).trim();-}--/** The plan's step rows, in render order. */-async function renderedSteps(page: Page): Promise<string[]> {- const items = await agentPlan(page).locator('li').allInnerTexts();- return items.map(text => text.trim());-}--// Same cold-start reasoning as chat-thread-isolation.spec.ts: the first spec of-// a shard pays the app's first paint, and these turns additionally run a tool-// round before parking. The assertions are unchanged.-test.describe.configure({ timeout: 120_000 });--test.describe('Agent plan surface', () => {- test.skip(true, 'request_plan_review is no longer on the chat orchestrator belt');-- test.beforeEach(async () => {- await resetMock();- });-- test('the plan renders the agent’s own steps, in order', async ({ page }) => {- await scriptTurn([planReviewCall]);- await openChat(page);- await parkAndWaitForPlan(page);-- // Order is the assertion, not membership: a plan whose steps are shuffled- // is a different plan, and a per-step `toContainText` would pass on one.- expect(await renderedSteps(page)).toEqual(STEPS);- });-- test('a settled call renders the plan complete rather than mid-flight', async ({ page }) => {- // `PlanReviewPart.tsx:197-204` renders a call with no pending review at- // `activeIndex: steps.length` — deliberately, because it is "not this- // render's job to re-offer a decision that was already made". The counter- // is how a user sees that, so this pins the documented branch, not an- // accident of it.- await scriptTurn([planReviewCall]);- await openChat(page);- await parkAndWaitForPlan(page);-- expect(await progressCounter(page)).toBe(`${STEPS.length} of ${STEPS.length}`);- // Still the same plan — "complete" must not have rewritten the steps.- expect(await renderedSteps(page)).toEqual(STEPS);- });-});diff --git a/app/test/playwright/specs/chat-plan-review.spec.ts b/app/test/playwright/specs/chat-plan-review.spec.tsdeleted file mode 100644index c0df044afd..0000000000--- a/app/test/playwright/specs/chat-plan-review.spec.ts+++ /dev/null@@ -1,224 +0,0 @@-/**- * Plan-mode review — the live turn really parks, and the user's decision- * really releases it.- *- * Matrix 4.2.7 is ✅ on RU + RI + VU, and the note says why that is not enough:- * *"WD E2E (agent-driven park flow) tracked as follow-up"*. The three existing- * layers each own one end of the mechanism and none of them owns the join:- *- * RU `agent/plan_review/gate.rs` — the oneshot parks, resolves, TTL-rejects.- * RI `tests/json_rpc_e2e.rs` — `plan_review_decide` answers.- * VU `aui/PlanReviewPart.test.tsx` — the card renders and calls the RPC.- *- * What nothing covers is a REAL turn held open on an in-memory oneshot- * (`PlanReviewGate`, one per process, not a database row) while a browser paints- * a card from a socket event, and released when that card's button resolves it.- * Every one of those pieces can pass its own test while the turn stays parked- * forever — and a parked turn is silent. No error, no log line saying why; the- * user watches a spinner that never ends.- *- * Turns are driven over `openhuman.channel_web_chat` (see `helpers/chat-drive.ts`),- * never by typing, so a composer change cannot be reported as a gate failure.- *- * The agent is scripted through the mock's keyword rules. Stage 1 matches the- * prompt and answers with a `request_plan_review` tool call; stage 2 matches the- * tool's own result string, which the core fixes verbatim- * (`agent/plan_review/tool.rs`: "approved: the user approved the plan…",- * "rejected: the user rejected the plan…", "revise: the user requested changes…").- * That is what makes the approve/reject assertions real rather than cosmetic:- * the branch the gate took has to reach the model for the next stage to fire.- */-import { expect, type Locator, type Page, test } from '@playwright/test';--import {- resetMock,- selectedThreadId,- sendTurn,- setKeywordRules,- startNewThread,- upstreamBodies,- waitForSelectedThreadId,-} from '../helpers/chat-drive';-import { bootAuthenticatedPage, dismissWalkthroughIfPresent } from '../helpers/core-rpc';--const USER_ID = 'pw-chat-plan-review';--const PROMPT = 'PLANME rebuild the index';-const SUMMARY = 'PLAN-SUMMARY-MARKER';-const EXECUTED = 'PLAN-EXECUTED-MARKER';-const ABANDONED = 'PLAN-ABANDONED-MARKER';-const REVISED = 'PLAN-REVISED-MARKER';-const FEEDBACK = 'FEEDBACK-MARKER-do-it-in-two-steps';--/** The core's own wording for each resolution, as the tool hands it back. */-const APPROVED_RESULT = 'approved: the user approved';-const REJECTED_RESULT = 'rejected: the user rejected';-const REVISE_RESULT = 'revise: the user requested changes';--const RULES = [- {- keyword: 'PLANME',- toolCalls: [- {- name: 'request_plan_review',- arguments: { summary: SUMMARY, steps: ['read the index', 'rewrite it'] },- },- ],- },- { keyword: APPROVED_RESULT, content: EXECUTED },- { keyword: REJECTED_RESULT, content: ABANDONED },- { keyword: REVISE_RESULT, content: REVISED },-];--const planCard = (page: Page): Locator => page.getByTestId('plan-review-card');-const approveButton = (page: Page): Locator =>- page.locator('[data-analytics-id="plan-review-approve-once"]');-const rejectButton = (page: Page): Locator =>- page.locator('[data-analytics-id="plan-review-deny"]');-const reviseButton = (page: Page): Locator =>- page.locator('[data-analytics-id="plan-review-approve-always"]');-const sendFeedbackButton = (page: Page): Locator =>- page.locator('[data-analytics-id="plan-review-send-feedback-submit"]');-const stopButton = (page: Page): Locator => page.getByTestId('stop-generation-button');--async function openChat(page: Page): Promise<void> {- await bootAuthenticatedPage(page, USER_ID, '/chat');- await dismissWalkthroughIfPresent(page);- await expect(page.getByTestId('chat-message-input')).toBeVisible({ timeout: 30_000 });-}--/** Send the scripted prompt and wait until the turn is genuinely parked. */-async function parkAReview(page: Page): Promise<string> {- const threadId = await waitForSelectedThreadId(page);- await sendTurn(page, threadId, PROMPT);- await expect(planCard(page), 'the scripted plan review never reached the browser').toBeVisible({- timeout: 60_000,- });- return threadId;-}--/** True once any upstream request body carries `needle`. */-async function upstreamSaw(needle: string): Promise<boolean> {- return (await upstreamBodies()).some(body => body.includes(needle));-}--// Same reasoning as chat-thread-isolation.spec.ts: the first browser spec of a-// shard pays the app's cold start, and these turns additionally wait on a real-// parked gate. The assertions are unchanged; only the budget moves.-test.describe.configure({ timeout: 120_000 });--test.describe('Plan-mode review', () => {- test.skip(true, 'request_plan_review is no longer on the chat orchestrator belt');-- test.beforeEach(async () => {- await resetMock();- await setKeywordRules(RULES);- });-- test('a parked review holds the turn open and shows the plan, with no answer yet', async ({- page,- }) => {- await openChat(page);- await parkAReview(page);-- // The plan the agent asked about, not a generic card.- await expect(planCard(page).getByText(SUMMARY, { exact: false })).toBeVisible({- timeout: 15_000,- });- // The turn is still running — this is the property a unit test cannot hold.- await expect(stopButton(page), 'a parked turn is still in flight').toBeVisible({- timeout: 15_000,- });- // And the agent has NOT proceeded. If the gate failed open, stage 2 would- // already have fired and this marker would be on screen.- await expect(page.getByText(EXECUTED, { exact: false })).toHaveCount(0);- expect(- await upstreamSaw(APPROVED_RESULT),- 'nothing was approved, so no approval result may have reached the model'- ).toBe(false);- });-- test('Approve resumes the same turn and the agent executes', async ({ page }) => {- await openChat(page);- await parkAReview(page);-- await approveButton(page).click({ force: true });-- // The released turn runs stage 2 and finishes in the same thread.- await expect(- page.getByText(EXECUTED, { exact: false }).last(),- 'approving must resume the parked turn, not merely dismiss its card'- ).toBeVisible({ timeout: 60_000 });- expect(- await upstreamSaw(APPROVED_RESULT),- 'the approve resolution must reach the model as the tool result'- ).toBe(true);- await expect(planCard(page)).toHaveCount(0);- });-- test('Reject resumes the turn and the agent does not execute', async ({ page }) => {- await openChat(page);- await parkAReview(page);-- await rejectButton(page).click({ force: true });-- await expect(page.getByText(ABANDONED, { exact: false }).last()).toBeVisible({- timeout: 60_000,- });- // The assertion that makes approve and reject different things rather than- // two ways to close a card: the approval wording must never have been sent.- expect(- await upstreamSaw(REJECTED_RESULT),- 'the reject resolution must reach the model as the tool result'- ).toBe(true);- expect(- await upstreamSaw(APPROVED_RESULT),- 'a rejected plan must never hand the model an approval'- ).toBe(false);- await expect(page.getByText(EXECUTED, { exact: false })).toHaveCount(0);- });-- test('Revise sends the typed feedback to the model', async ({ page }) => {- await openChat(page);- await parkAReview(page);-- await reviseButton(page).click({ force: true });- const feedback = page.getByTestId('plan-review-feedback');- await expect(feedback).toBeVisible({ timeout: 10_000 });- // A plain textarea the user types into, not the assistant-ui composer.- await feedback.fill(FEEDBACK);- await sendFeedbackButton(page).click({ force: true });-- await expect(page.getByText(REVISED, { exact: false }).last()).toBeVisible({ timeout: 60_000 });- // "The textarea accepted text" is worthless if the text never leaves. The- // point of this case is the payload, not the affordance.- expect(- await upstreamSaw(FEEDBACK),- 'the revision feedback must reach the model, not just the card'- ).toBe(true);- });-- test('a parked review stays with its own thread across a switch', async ({ page }) => {- await openChat(page);- const threadA = await parkAReview(page);-- await startNewThread(page);- await expect.poll(async () => selectedThreadId(page), { timeout: 15_000 }).not.toBe(threadA);- await expect(- planCard(page),- 'a review parked on another thread must not offer a decision here'- ).toHaveCount(0);-- const rowA = page.getByTestId(`thread-row-${threadA}`);- await expect(rowA).toBeVisible({ timeout: 15_000 });- await rowA.click({ force: true });- await expect.poll(async () => selectedThreadId(page), { timeout: 15_000 }).toBe(threadA);-- // Still parked, and still decidable — coming back must not have orphaned it.- await expect(planCard(page)).toBeVisible({ timeout: 20_000 });- await approveButton(page).click({ force: true });- await expect(page.getByText(EXECUTED, { exact: false }).last()).toBeVisible({- timeout: 60_000,- });- });-});diff --git a/app/test/playwright/specs/chat-todo-list-render.spec.ts b/app/test/playwright/specs/chat-todo-list-render.spec.tsdeleted file mode 100644index ea84bf7ba6..0000000000--- a/app/test/playwright/specs/chat-todo-list-render.spec.ts+++ /dev/null@@ -1,271 +0,0 @@-/**- * The `todo` tool's whole-list write, as it reaches the DOM — `elements/todo-list`- * family, through both of its real product paths.- *- * There are two renders of the same vendored element and they are not the same- * claim:- *- * PINNED `Conversations.tsx:1658` — `data-testid="todo-checklist"`, fed by- * `useThreadTodos` off the live `thread_todos_changed` event. One- * per thread, always current.- * SNAPSHOT `aui/TodoListPart.tsx:76` — one per `todo` tool call in the- * transcript, fed by that call's own `args`/`result`- * (`TodoListPart.tsx:62-66` is explicit that these are different- * sources).- *- * `app/test/e2e/specs/chat-todos-goals.spec.ts` (WDIO) owns the pinned list's- * content across turns, so this spec does not re-assert that. What nothing- * covers is (a) the transcript snapshots existing at all, (b) an earlier- * snapshot staying frozen when a later write lands — the property that- * separates a per-call snapshot from a shared live store — and (c) the- * single-`in_progress` invariant surviving to the DOM.- *- * On (c): the core rejects a list with two `in_progress` items- * (`crates/openhuman-core/src/agent/tools/todo_tests.rs:77`,- * `two_in_progress_items_are_rejected`). That is enforced server-side and- * covered there. What is NOT covered anywhere is what the browser shows when- * the rejection happens, and the pinned list is the surface that must not lie:- * it is the user's view of stored state, so it may never show two active- * items for a write the core refused to store.- *- * Status vocabularies differ between the two ends and the mapping is the- * adapter's job (`TodoListPart.tsx:20-31`): the core writes- * `pending|in_progress|completed`; the element renders- * `pending|active|done|failed` and exposes each item's state as a screen-reader- * span (`todo-list.tsx:82`). Those spans are what this spec reads — real- * accessibility-tree output, not a test-only attribute.- *- * Turns go over `openhuman.channel_web_chat` (`helpers/chat-drive.ts`), never- * the composer.- */-import { expect, type Locator, type Page, test } from '@playwright/test';--import {- resetMock,- sendTurn,- setKeywordRules,- setMockBehavior,- upstreamBodies,- waitForSelectedThreadId,-} from '../helpers/chat-drive';-import { bootAuthenticatedPage, dismissWalkthroughIfPresent } from '../helpers/core-rpc';--const USER_ID = 'pw-todo-list-render';--const STEPS = [- 'TODOMARK read the changelog',- 'TODOMARK draft the notes',- 'TODOMARK publish the post',-] as const;--/** Core wire shape: the first `completed` are done, the next is in progress. */-function todos(completed: number) {- return STEPS.map((content, index) => ({- content,- status: index < completed ? 'completed' : index === completed ? 'in_progress' : 'pending',- }));-}--const RULES = [- { keyword: 'TODOPLAN', toolCalls: [{ name: 'todo', arguments: { todos: todos(0) } }] },- { keyword: 'TODOADVANCE', toolCalls: [{ name: 'todo', arguments: { todos: todos(2) } }] },- {- // Two `in_progress` items — the core must refuse this write.- keyword: 'TODOINVALID',- toolCalls: [- {- name: 'todo',- arguments: {- todos: [- { content: STEPS[0], status: 'in_progress' },- { content: STEPS[1], status: 'in_progress' },- { content: STEPS[2], status: 'pending' },- ],- },- },- ],- },- // No second-leg rules on purpose. Keying one off the tool RESULT is what the- // plan-review spec does, but it can there because the core fixes that- // result's wording verbatim. The `todo` result is produced upstream in- // `tinytools`, and a rule keyed on a substring like `in_progress` would also- // match the SUCCESSFUL call's result (its payload echoes the statuses), so- // the two turns would answer each other's script. The mock's default- // fall-through ends each turn instead, and the specs below wait on signals- // that do not depend on the model's words.-];--/**- * Every rendered todo list, pinned and snapshot alike. `data-slot` is the- * element's own attribute (`todo-list.tsx:46`), so this finds the real- * component rather than a wrapper that happens to carry a test id.- */-const allLists = (page: Page): Locator => page.locator('[data-slot="todo-list"]');--/** The pinned, always-current list above the composer. */-const pinnedList = (page: Page): Locator => page.getByTestId('todo-checklist');--/**- * The per-tool-call snapshots in the transcript. The pinned render is the only- * one given a test id (`Conversations.tsx:1659`), so excluding it leaves- * exactly the `TodoListPart` renders.- */-const snapshotLists = (page: Page): Locator =>- page.locator('[data-slot="todo-list"]:not([data-testid])');--/**- * One list's item states, in list order, as the element publishes them to- * assistive technology (`todo-list.tsx:82`).- *- * Reads the DOM directly rather than through a tolerant helper: a helper that- * shrugged off a missing span would turn "the element stopped reporting its- * state" into an empty array, and an empty array compares equal to an empty- * expectation. The statuses are the subject here, so nothing about them may be- * forgiving.- */-async function itemStates(list: Locator): Promise<string[]> {- return list.evaluate(root =>- Array.from(root.querySelectorAll('li')).map(item => {- const span = item.querySelector('span.sr-only');- // Deliberately not `?? ''`: a missing state span is a defect in the- // thing under test and must not read as a blank status.- if (span === null) return '<no-state-span>';- return (span.textContent ?? '').trim();- })- );-}--/** One list's item texts, in list order. */-async function itemTexts(list: Locator): Promise<string[]> {- return list.evaluate(root =>- Array.from(root.querySelectorAll('li')).map(item => {- const clone = item.cloneNode(true) as HTMLElement;- clone.querySelectorAll('span.sr-only').forEach(node => node.remove());- return (clone.textContent ?? '').replace(/\s+/g, ' ').trim();- })- );-}--async function openChat(page: Page): Promise<void> {- await bootAuthenticatedPage(page, USER_ID, '/chat');- await dismissWalkthroughIfPresent(page);- await expect(page.getByTestId('chat-message-input')).toBeVisible({ timeout: 30_000 });-}--test.describe.configure({ timeout: 120_000 });--test.describe('Todo list render', () => {- test.skip(true, 'legacy todo-list transcript cards were replaced by grouped task insights');- test.beforeEach(async () => {- await resetMock();- await setKeywordRules(RULES);- await setMockBehavior('llmStreamChunkDelayMs', '10');- });-- test('a todo tool call renders its own snapshot in the transcript', async ({ page }) => {- await openChat(page);-- // Control: no list of either kind before the agent writes one, so the- // assertions below are about something that appeared.- await expect(allLists(page), 'a todo list was on screen before any write').toHaveCount(0);-- const threadId = await waitForSelectedThreadId(page);- const before = (await upstreamBodies()).length;- await sendTurn(page, threadId, 'TODOPLAN write the release plan');-- // Staged upstream-first. "No transcript render" has two very different- // causes — the tool never ran, or it ran and did not render — and the- // element assertion alone cannot tell them apart. The round trip is the- // upstream stage: the tool call goes out, its result comes back, and the- // harness calls the model again. Assert that happened before blaming the- // renderer.- await expect- .poll(async () => (await upstreamBodies()).length, {- timeout: 60_000,- message: 'the scripted todo call never completed a tool round trip',- })- .toBeGreaterThan(before + 1);-- await expect(- snapshotLists(page),- 'the todo tool round-tripped but rendered nothing in the transcript'- ).toHaveCount(1, { timeout: 60_000 });-- const snapshot = snapshotLists(page).first();- await expect- .poll(async () => itemStates(snapshot), { timeout: 30_000 })- .toEqual(['active', 'pending', 'pending']);- expect(- await itemTexts(snapshot),- 'the rendered items are not the ones the tool call carried'- ).toEqual([...STEPS]);- });-- test('a later write leaves the earlier snapshot frozen', async ({ page }) => {- await openChat(page);- const threadId = await waitForSelectedThreadId(page);-- await sendTurn(page, threadId, 'TODOPLAN write the release plan');- await expect(snapshotLists(page)).toHaveCount(1, { timeout: 60_000 });- await expect- .poll(async () => itemStates(snapshotLists(page).first()), { timeout: 30_000 })- .toEqual(['active', 'pending', 'pending']);-- await sendTurn(page, threadId, 'TODOADVANCE keep going');- await expect(- snapshotLists(page),- 'the second todo call did not produce its own transcript render'- ).toHaveCount(2, { timeout: 60_000 });-- // The new snapshot carries the new write...- await expect- .poll(async () => itemStates(snapshotLists(page).nth(1)), { timeout: 30_000 })- .toEqual(['done', 'done', 'active']);-- // ...and the first one has NOT moved. A shared store behind both renders- // would rewrite history: the transcript would show the agent having always- // known the final state, which is exactly what a transcript must not do.- expect(- await itemStates(snapshotLists(page).first()),- 'the earlier transcript snapshot was rewritten by a later write'- ).toEqual(['active', 'pending', 'pending']);- });-- test('the pinned list never shows two items in progress', async ({ page }) => {- await openChat(page);- const threadId = await waitForSelectedThreadId(page);-- // A valid write first, so the pinned list exists and the assertion below- // is about its contents rather than its absence.- await sendTurn(page, threadId, 'TODOPLAN write the release plan');- await expect(pinnedList(page), 'the pinned checklist never appeared').toBeVisible({- timeout: 60_000,- });- await expect- .poll(async () => itemStates(pinnedList(page)), { timeout: 30_000 })- .toEqual(['active', 'pending', 'pending']);-- // Now a write the core refuses (`todo_tests.rs:77`).- //- // The rejected call has to have actually round-tripped before the pinned- // list is worth reading — otherwise "still one active" would just mean- // nothing had happened yet, and the test would pass on an empty window.- // Counting upstream requests is the signal that does not depend on the- // model's wording: the tool call goes out, its result comes back, and the- // harness calls the model again to continue the turn.- const before = (await upstreamBodies()).length;- await sendTurn(page, threadId, 'TODOINVALID do two things at once');- await expect- .poll(async () => (await upstreamBodies()).length, {- timeout: 60_000,- message: 'the rejected write never completed its tool round trip',- })- .toBeGreaterThan(before + 1);-- const states = await itemStates(pinnedList(page));- expect(- states.filter(state => state === 'active').length,- `the pinned checklist showed a list the core refused to store: ${JSON.stringify(states)}`- ).toBeLessThanOrEqual(1);- });-});