Repository navigation
fix(verify): require only written values, and a fresh view of the saved record, to verify a save - #2877
fix(verify): require only written values, and a fresh view of the saved record, to verify a save#2877abrichr wants to merge 9 commits into
Conversation
…tions are open finalize_on_step_cap looked up the v3 hooks as owner._v3_runtime, which never exists (the hooks live at owner._v3), so the open-obligation guard never ran. A passing end-state check could stamp VERIFIED at the step cap while every obligation compiled from the instruction was still unverified.
A phrase obligation verified on a page field only when every word of the
field's label was a free-text kind word, so 'Customer Details: <phrase>'
or 'Clinical Notes: <phrase>' rejected correct saves. A compound label now
names a phrase when its head noun (last word) is a free-text word and no
word before it points at another record or an unsaved state ('Previous
Notes', 'Draft Comment'). Amounts, dates, codes and IDs keep the full rule.
Adds adversarial tests, including 5 against 'Dose: 50 mg'.
…' into fix/write-intent-obligations-fresh-view
…ard' into fix/write-intent-obligations-fresh-view
…ed record, to verify a save Obligations came from every date, amount, ID and quoted phrase in the instruction and in any document seen mid-episode, so facts the task never saves blocked correct runs, and any passing read-back (same screen, wire receipt, a bare True) could verify a save. - compile_write_obligations: only values the instruction asks to be written or set, plus the record they go to, are required. - Document facts are tracked with required=False and never block or verify. - A GUI or remote save is VERIFIED only when a read-back from a fresh view (a recorded server fetch or a separate session) proves every required value with the strict matcher. Every verification entry point goes through one check; _mark_verified and _emit_receipt refuse without it. - SupervisorConfig(require_fresh_view_for_saves=False) keeps the old rule.
…ided by the whole line The shared matcher's label binding ends a value at ';' or a run of spaces, so 'Ships Monday' matched 'Remarks: Ships Monday; call first.' and a correct free-text value with ';' never matched. When the read-back has a line for the instruction's label, that line's whole value decides.
Independent adversarial review: REQUEST CHANGESFrom: Grok The direction is right: required obligations should come only from write intents, document facts should be This head is not mergeable: the verdict-fold ratchet fails on the unique commits. Blocker
The new This branch is also still a draft, stacked on #2851 and #2852, and its merge-base with What I checkedAgainst this worktree on Python 3.12 I ran I also probed the new matchers. Limitation, not the merge blocker
CI at this head: Evaluate review verdict, |
…iour change) The receipt backstop compares against ReceiptOutcome.VERIFIED.value, and the two new matcher reductions are explicit loops (the all() ran only on a non-empty list). check_verdict_folds.py is back at its baseline.
|
The blocker is fixed in
Checks at the new head:
Not addressed here:
|
…fier slice (#2851 review, no behaviour change)
Independent adversarial review: APPROVEFrom: Grok The two commits after my REQUEST CHANGES at Previous blockers
What I recheckedAgainst this worktree on Python 3.12 I ran The unique design is unchanged: required obligations come only from write intents, document facts stay Limitations and merge conditionsThis branch conflicts with current GitHub reports no check runs at this head ( This head still admits a fresh view from the shape of a verifier-supplied |
Stacked on #2851 and #2852, which are merged into this branch.
Bug
openadapt.wrap(agent)compiled an obligation for every date, amount, ID and quoted phrase it found. It searched the instruction and every document that appeared during the run (compile_obligations_from_spec,merge_obligations_from_document). This had two effects:True, and an obligation read-back with zero obligations plus a completeness audit. None of these is a fresh look at the record the save produced.Change
Required values come only from what the instruction asks to write. A new
openadapt.transducer_write_intents.compile_write_obligationsrecognizes these forms:set/change/update…X to 'v', includingX from 'a' to 'b', where onlybis required, andA to 'x', B to 'y';X should be 'v';enter/type…'v' into X;select 'v' as X;with X 'v', Y 'w';X: vlines under a write request;checkanduncheck X.It also compiles the record the values go to, from phrases such as
named 'v',with code 'v',whose X is 'v'andthe <noun> 'v'. That value must be the whole value of a field on the read-back, so a correct save on the wrong record does not verify.Declarative text compiles to nothing. That covers a letter's dates and amounts, and a form's
Phone:lines when no numbered list sits under a write request. One known limit: an imperative request with a quoted value inside a pasted document (please change the Delivery Address to '9 Quay St') is read as a write. Such a request can hold a run, because the record won't show it, but it can never verify one on its own. A test pins this.Facts from documents never block or verify.
merge_obligations_from_documentstill tracks document facts, but marks themrequired=False.compile_obligations_from_specis unchanged and is now documented as a fact extractor.Written values are matched strictly. On a read-back with one field per line, the whole line after the instruction's label decides. A free-text value with
;matches only the whole value, soShips Mondaydoesn't matchRemarks: Ships Monday; call first.. Otherwise a written value must equal its field's bound value under the shared strict matcher. If the page names the field differently, it must equal the whole value of a field whose label shares a word with the instruction's label.5never matchesDose: 50 mg.A save verifies only on a fresh view.
openadapt.transducer_fresh_view.evaluate_save_evidencedecides whether a read-back may verify a GUI or remote save. All of these must hold:{"kind": "server_reload", "fetches": [{url, status 2xx}, ...]}or{"kind": "separate_session", "session": "<id>"}.OpenAdapt checks only the shape of the fetch evidence. The caller that reloads the record must observe the fetch, for example from the browser's network events.
Every entry point uses the same check.
SimplexTransducerruns it from:The facts gate no longer verifies a save. As a backstop,
_mark_verifiedmarks nothing, and_emit_receiptturns a VERIFIED into COMPLETED_UNVERIFIED ("VERIFIED withheld: …"), unless fresh-view evidence was admitted after the latest commit.Other changes:
SupervisorConfig(require_fresh_view_for_saves=False)restores the old rule. Runs with only workspace commits or no commit are unaffected.Behaviour change. A Rung 2 or Rung 3 verifier that returns a bare
Trueno longer verifies a GUI save. It must return its read-back (readback_text) and how that read-back was fetched (fresh_view). The same applies when the value to save appears only in a document, not in the instruction (for example "record its supporting reference"): the run now ends unverified.Tests
tests/test_transducer_fresh_view.py(68 cases):from … to, and an apostrophe that must not open a quote;5againstDose: 5,5 mg,50 mgand0.5, and underPrevious Dose:;;matched as the whole line;evaluate_save_evidence: a bareTrue, no fresh view, a refusal, an editable read-back, a toast, a mismatch, the wrong record, a 304 or empty fetch list, and a separate session with no id;required=Falseon document facts makes these tests fail.require_fresh_view_for_saves=False.Set Reference to 'REF-20') where they usedRecord REF-20.pyteston the transducer, obligation, fact-ledger, v3-runtime, wrap and fail-closed test files gives 731 passed and 31 xfailed. Unchanged files that fail locally fail the same way onmain, becauseopenadapt_flowis not installed here.capabilities/10-computer-use-agents/0105-….Generality gate