Let Pilot, not Planner, name the item a test acts on - #156
Merged
Conversation
The Planner wrote the concrete record into the scenario title, so a plan carried that name for as long as it lived. By the time the test ran the record could be renamed, deleted, or replaced, and the run went hunting for a name the page no longer had: search returning nothing, clicks on absent text, and a correct detail overlay closed again because the item on screen was not the one the title asked for. Scenarios now say what behavior to test and describe the item by kind and role. Pilot picks the concrete item — one the page already shows, or one it creates through precondition() — and passes its exact name to Tester. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XsPDpDQrWdgDLGXkzkgGQr
Pilot cannot act on how the Planner writes scenarios. It only needs the instruction that picking the concrete item is its job. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XsPDpDQrWdgDLGXkzkgGQr
DavertMik
commented
Aug 28, 2026
Co-authored-by: Michael Bodnarchuk <DavertMik@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Diagnosed from Langfuse trace
aa327eeaef94d32e8582a7802368ce92— a 3m34s run that ended instop→ fail without ever attempting the action it was testing.The Planner had written a concrete record name into the scenario title. By the time the test ran, that name was not on the page — the closest item differed. The tester noticed the mismatch in its first turn and went looking for the literal anyway, because Pilot's opening plan told it to search for that name:
clicktool calls (20I.clicksteps), 4see, 3xpathCheckseecall answered "yes, it's there" for a name that was not on the page, its own reasoning admitting it had inferred a character it could not readxpathCheckcalls then proved the name absent, and the guidance still did not changeThe scenario title is written once and read much later. Anything named in it is stale by the time it is used.
Change
Two lines.
src/ai/planner.ts— thescenariofield description now asks for the behavior, with the item described by kind and role rather than by title, id, or value.src/ai/pilot.ts— one line in Pilot's system prompt: scenarios name behavior, not data; Pilot picks the concrete item (from the page, or viaprecondition()) and gives Tester its exact name.This moves item selection to the agent that is looking at the page when the test runs. It closes a gap rather than adding machinery: the reset prompt already prefers
precondition()when the page lacks target data (pilot.ts:392), the precondition-unavailable fallback already says "continue with what the page already shows" (pilot.ts:737), and the skip-on-missing-data path already exists (pilot.ts:807).Not addressed here
src/ai/planner.ts:96(focusExistingDataDirective) still tells the planner to use item names visible in page research. It fires only under--focusand did not cause this trace.seetool over-committing on a name it could not read is downstream of the hunt.I.pressKey(['Meta','a'])on a search input deleted one character per press instead of selecting all — the query shortened by one character on each of three clear attempts.Testing
bun test tests/integration/— 82 pass, 1 skip, 0 failbun run formatcleanPrompt-only change; behavior is best confirmed by replaying the scenario. Worth the
regressionlabel if you want that coverage.🤖 Generated with Claude Code
https://claude.ai/code/session_01XsPDpDQrWdgDLGXkzkgGQr