Repository navigation
Conversation
… YAML openadapt.auto_compile: Run 1 calls the agent through a recording driver, holds its one save for an optional on_before_commit card, checks the post-save screen, and compiles the trace into a JSON program (parameterized steps, the post-save check, the record's key fields). Run 2..N replay the program with 0 agent calls. Every run claims (app, item key) in SharedWorkLease and saves through BoundedSettleAndReconcile; results are VERIFIED, STOPPED or DUPLICATE_SKIPPED with an openadapt.wrap receipt.
Independent adversarial review: REQUEST CHANGESFrom: Grok Two blockers. The lease, compile, receipt, and "don't free a refuted save for retry" work I read looks sound, and all 21 tests in 1. Ungated
A callable agent written as a normal Playwright script — the PR's own example says "a Playwright script or a Browser Use wrapper" — that does
A step agent that emits If a trace both clicks the save control and later calls The intended path ( 2. Default
The in-repo tests hide this: Please do not stamp What I checked and it looks right
CI at |
What this adds
openadapt/auto_compile.py: run a Python agent once, then repeat its work with no agent and no YAML.agent(driver, params)(a Playwright script or a Browser Use wrapper) or a step agent withact(observation, task, history). Field fills are never gated. The one save (driver.submit(target)) is held for an optionalon_before_commit(card). If the card is refused, nothing is sent. After the save the post-save screen is read back. The run isVERIFIEDonly when every typed value shows as whole words and no new error text appeared. Then the trace is compiled into a JSON program undercache_dirthat carries its own SHA-256. The program holds the steps with each value replaced by its parameter, the post-save check, and the parameters that name the record.agent_calls == 0).(app, item key)inSharedWorkLeaseand save throughBoundedSettleAndReconcile. A repeat of a record, or two workers racing on one, givesDUPLICATE_SKIPPED. These all giveSTOPPED: a missing field, parameters that don't match the program, a changed program file, a refused card, or a failed post-save check. If a save was sent but not confirmed, the record stays held as uncertain, so a retry stops too until someone checks it.openadapt.wrapWrapReceipt. It is signed with this computer'sopenadapt trust initkey, or withsigning_key=. If there is no key it is digest-only, and it says so.verify_wrap_receipt(result.receipt, trusted_keys=[...])checks it offline. A refused card or a drift stop before the save maps toblocked. A failed screen check maps torefutedwith thechecked_howthat ran. A sent but unconfirmed save maps touncertain.openadapt_flow.verdict(Obligations+Result.from_observation+settle). Driver and agent calls go throughverdict.observe. Outcome words use theenum.auto()pattern fromReceiptOutcome.check_verdict_folds.pystays at baseline.PlaywrightDriver(page)is a thin sync-Page adapter. A driver that hasreopen_text(params)also gets the reopened record checked, and the receipt then saysreopened.Decisions a reviewer may question
check_before_submit=False: the lease carries idempotency, because a post-save screen can't show that a record is absent before it exists.UNKNOWN, neverABSENT. A refuted screen does not prove the record is missing: the save may have landed wrong. So even withsettle_options={"absent_is_final": True}the settle step can't release the lease for a resubmit. The testtest_refuted_screen_never_frees_the_record_for_a_retryfails if the oldABSENTmapping is put back (checked by hand).WAITorHELD_UNCERTAIN) waits up tolease_wait_s(default 30 s), then claims again. A commit ends inDUPLICATE_SKIPPED. A save left uncertain by a worker that died keeps the record held, so the wait runs out and the run stops.compiled=False."1"does not match"12". An empty value never counts as shown, and a check with no typed value never passes on "no error text" alone.openadapt flow wrap, the skill cache in capability rows 0130/0157) is unchanged.verdict. If flow is missing (Python 3.13 and later, where the launcher doesn't install it),run()raises anImportErrorwith the install hint.Files
openadapt/auto_compile.py(new).AutoCompiler,AutoRunOutcome,AutoRunResult,PlaywrightDriverandStagedCardare exported lazily fromopenadapt. The function stays atopenadapt.auto_compile.auto_compile, because a top-levelopenadapt.auto_compilewould collide with the submodule name.examples/zero_yaml_wrap_compile.py: runs with no browser and no model.tests/test_auto_compile.py: 21 tests.capabilities/10-computer-use-agents/0135-…md: new row. CAPABILITIES.md is not touched.Test results (local, macOS)
The tests ran with
PYTHONPATH=.:packages/flow:packages/types. The shared local env has openadapt-flow 2.6.0 installed from another worktree. The launcher floor is flow >= 4.1.0, andverdict.pyis in every 4.x tag.What the tests show:
VERIFIEDwith a signed receipt.VERIFIEDwith a receipt that verifies against the trusted key. An edited receipt and an untrusted key both fail.DUPLICATE_SKIPPED, and two threads racing on one record make 1 save.STOPPEDwith 0 saves, and the lease is released.STOPPED, and the retry is blocked.Example output:
Not tested here: a real browser (Playwright is covered only by a duck-typed stub) and a real model-driven agent.