Repository navigation
Browser scenarios: record once, replay without the model (ATO-960) - #1691
Draft
sosidudku1 wants to merge 3 commits into
Draft
sosidudku1 wants to merge 3 commits into
sosidudku1 wants to merge 3 commits into
Conversation
browser.scenario { action: "start" | "stop" | "cancel" | "run" | "list" |
"delete" } records a chat's successful navigate / search / click / type /
act calls and saves them as <stateDir>/browser-scenarios/<name>.json
(versioned JSON). Each step names its element by ARIA role and accessible
name from the page snapshot, never by ref, plus the page URL and snapshot
digest for information.
Text typed into a field the gate treats as browser_secret (password,
one-time code, card, or an unreadable field) is never stored: the step
gets a secret parameter that run requires. stop { params } turns other
typed text into {{placeholders}}. Uploads are never recorded.
run replays without a model call: each target is found in the current
snapshot by role and exact name, then by a case- and space-insensitive
name, waiting up to timeoutMs. No match or several matches stop the run
with an error naming the step. Every step calls the same browser tool the
model calls, so the commit / secret prompts, domain lists, offline mode
and landed-page checks apply unchanged.
ATO-960
…s recorded on (ATO-960)
…ms map in strict tools (ATO-960)
This branch has not been deployed
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.
First slice of ATO-960: show the agent a browser task once, then repeat it without the model.
What changes
New tool
browser.scenario { action: "start" | "stop" | "cancel" | "run" | "list" | "delete", name?, params?, timeoutMs? }.startrecords this chat's successfulbrowser.navigate,search,click,typeandactcalls. The recorder wraps those five tools. Before each call it reads the target ref's ARIA role and accessible name from the page snapshot. A chat that is not recording pays nothing. Failed, refused or denied calls are not recorded.act uploadis never recorded, andstopsays so.stop { name, params? }writes<stateDir>/browser-scenarios/<name>.json:{ version: 1, name, createdAt, params, steps }. A step stores its kind, the element's role and name (never a ref), and the page URL and snapshot digest (for information, not checked).paramsturns typed text into placeholders:{ "query": "running shoes" }makes that step type{{query}}at replay.browser_secretfor the existing classifier: password, one-time code, card, or a field that could not be read. Text typed into them is not written. The step gets a secret parameter instead (named from the field label, e.g.password), andrunrefuses to start until it is supplied.run { name, params?, timeoutMs? }looks up each step's element in the current snapshot by role and exact name. If that fails, it tries role and a name that matches when case and extra spaces are ignored. It waits up totimeoutMs(default 5 s, max 30 s) for the element to show up. If no element or more than one element matches, the run stops with an error naming the step (target_missing/target_ambiguous), so the model or the user can take over from there.browser.click.run(...)etc.). So everything applies unchanged: the commit and secret prompts (a secret parameter asks every time), blocked and allowed domains, offline mode, the landed-page re-check and the user's-own-Chrome rules. A "no" ends the run the same way it ends a model call.gate-browser-url.ts,browser-domain-policy.tsand theurl-data-guard*files are not touched.listshows saved scenarios (a broken file shows as unreadable), anddeleteremoves one.<name>" replays it in a background turn. Prompts in that turn follow the task's normal approval handling. This is written up insrc/tools/browser/README.md.Precedent copied
getByRole(role, { name })) instead of brittle selectors.Left for later
selectvalues (only typed text can be a parameter for now).Tests
src/tools/browser/scenario-format.test.ts: the role and name lookup (exact, normalized, wrong role, ambiguous, quoted YAML keys), name rules, and file parsing (rejects unknown kinds, upload steps, stray refs, text plus param).src/tools/browser/scenario.test.ts, on a fake page backend:browser_commit, and a "no" stops it before the click;browser_secret;Verification
origin_changed, naming both, when they differ. Another path on the same site is fine. Navigate and search steps are not checked (they set the page). Steps without a recorded URL (hand-written files) are not checked. Tests inscenario.test.ts.Not yet checked on the second Mac.