Skip to content

fix(verification): require complete native values for approvals and read-back - #2291

Open
abrichr wants to merge 44 commits into
mainfrom
fix/approval-form-fields-2189
Open

abrichr wants to merge 44 commits into
mainfrom
fix/approval-form-fields-2189

Conversation

@abrichr

@abrichr abrichr commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Closes #2189.

Native values could lose a suffix and still enter an approval digest or field-equality verdict. Require identity-bound agreement between exact UIA values and independent native extent/full reads. Values remain exact through structural surfaces and default effect comparison; only declared date/case transforms apply.

One closed observation model covers raw password status, visibility, capability and state. Supported raw properties use defaults-ignored reads and exact types. Unknown visibility or required visible bounds/type refuses. Value-capable containers retain the full-value obligation regardless of type and stay unmasked. State distinguishes known absence from uncertainty; unknown, failed or unrepresented relevant state refuses before masks. Failed native evidence cannot downgrade into captions, previews or OCR. Unknown markers remain indeterminate; unqualified row inventories remain unavailable.

Structural observations require complete uniqueness censuses at both endpoints, with fresh fixed-control identity during reads within five seconds. This establishes neither continuous global uniqueness nor later write permission. All four standalone launch paths load exact local helper siblings; missing/conflicting copies refuse. The server and client each declare the read contract openadapt.native-value-read/v3 independently; helper proof stays openadapt.native-value-completeness/v3. The server no longer exports the historical client-imported version symbol or unversioned refusal validator. The client imports its explicitly versioned refusal-v2 parser, so a separately replaced local server cannot silently supply a different response parser. Actual unchanged 933 and b1 backend modules therefore refuse at import when mixed with the new local server, before any getter. Incompatible whole-version and stale-helper deployments also refuse before protected getters.

Unavailable form projections now return refusal-v2: fixed stage/channel/reason, an already-verified window HWND/PID when known, traversal ordinal, and optional closed property/phase/outcome detail from the existing raw boolean observation. The four fixed property categories are toggle, selection item, value and offscreen. Unknown/error results stop later probes; supported boolean values still require the final sensitivity guard. No additional query diagnoses a failure. Non-boolean observation failures retain null detail. Partial fields, names, values, control representations and provider exception text are excluded. No diagnostic getter runs after refusal; the first refusal survives a cleanup error. Receipts are never cached as backend last-error state or used for fallback/retry. Native evidence retains the already captured response before the unchanged positive assertion.

The standalone helper loader now executes its exact selected bytes without changing Python's global import cache. Concrete helper annotations and compile(..., dont_inherit=True) preserve dataclass behavior without registering or deleting module entries. Missing/conflicting local sources and poisoned/preloaded modules remain refused. This closes the actual import-layer failure without changing its guard, debt baseline or policy.

Validation: 640 targeted completeness/privacy/protocol/diagnostic/booking checks pass, zero skips, seven existing loopback-development warnings; all 333 loaded Flow/Types modules have fresh file/spec/hash origins. The unchanged actual direct/transitive import-layer gates also pass. Scoped Ruff/format, Mypy, source boundary, file-size and generated-doc checks pass. The exact 36,699-byte diagnostic delta scanned without findings or policy changes. Fixed-category accessor counters prove no extra reads and first-unknown ordering; concurrent requests preserve their own property/window/ordinal. Actual unchanged 933/b1/752/a222 client files refuse mixed-local imports before any getter. With the original a222 package dependency, actual 752/a222 v2 client files send their literal v2 requests to the new v3 handlers and both read/form paths refuse before helper/provider access. The actual new client file also refuses beside the actual old local parser. The client compatibility controls use source/accessor counters with no native/HTTP/DB/input/effect-verifier execution. The parent standalone controls on Python 3.10–3.14 and truthful prior-view/cold-unknown booking cases remain source-scoped evidence; counts overlap and are not added.

Canonical helper source is now commit 4be4b543da10286105090950c57a89d5e7a9a497, blob 78e47eb02e7498b5111766f25f3604e8ab78ee50, SHA256 c3be412ae4506b3d70e963971051bdfad8a4b4c3eee3e3eb362f709a6cc82d57. Proof v3, raw-property guards and API are unchanged; historical b476/ffb18801 source evidence is not relabelled as this source. No image/deployment adoption occurs here.

Windows approval remains blocked at e67aac28. In the hosted PowerShell Core fixture (WinForms 10.0.0.0), the first child returned native variant type 13 (VT_UNKNOWN) for toggle-availability property 30041 with defaults ignored. IUIAutomation.CheckNotSupported recognized that same variant as the reserved NotSupported identifier. This establishes that the property was unavailable. Whether the control implements Toggle remains unknown. The direct empty-value read was complete, and the whole-form approval projection refused at ordinal 1. The short and long cases were never reached. The fixture and agent stopped. GTK and FreeRDP passed. Windows job · Native evidence · Source CI · Microsoft's CheckNotSupported contract

The preceding run on 546e0b92 integrated main d10f0a2b and moved the positive to a borderless PowerShell Core form. It also refused at ordinal 1. Previous native evidence

Previous hold on 154ce2c4aae2d5bab47783fd0bed17426dcf6c14. The branch includes main 3866ab33. The Windows run failed at the empty-form assertion on line 285. The direct read proved the empty value. The whole-form projection refused at control 1 because the toggle availability result was non-boolean. The fixture and agent stopped before the short, long and governed cases. GTK and FreeRDP passed. Windows job · Refusal artifact

The remaining Windows blocker is a provider-backed way to distinguish known pattern absence from unknown capability. Grok requested changes on this commit because the Windows positive failed. Source CI passed, including all three Flow unit shards. The local targeted suites passed all 111 tests. Grok review. Source CI · Author declaration

Previous head. Source commit 1a2503da4e240ba24620845cf85737d087c38e39 has a fresh SAME-VENDOR COMMENTED source review with no remaining scoped source finding: independent 640 tests, 333 current origins, two import gates and the original-client controls. This is not cross-vendor or native approval. The source CI for that commit completed SUCCESS. Actual cross-vendor review and native qualification remain required.

The native run on the previous head FAILED its first EMPTY whole-form positive. Its refusal-v2 now records observation/state/state_capability_unknown, ordinal 1, detail {property: toggle, phase: result_kind, outcome: non_bool}. The existing 30041 probe returned a non-bool; this does not identify its raw type, prove pattern absence, establish a provider fault or describe unqueried later status. Direct empty value was complete, but the projection unavailable. No request PNG, short/long phase, later structural/replay/governed or after-row proof was reached; fixture and agent stopped. GTK and FreeRDP passed. Actual checkout 58af90a merges main 5d779f6e plus this head: eight recorded application files match the author head under Windows CRLF, and the workflow matches that merge. Whole-tree/unrecorded-dependency equality is not claimed. Source remains frozen without fallback, another getter or a manual retry.

The parent a222 source CI completed SUCCESS with all three unit shards, closing the two earlier source-CI failures. Its old native failure remains separately retained. No manual rerun, dispatch, image adoption, guard exception or setting change occurred.

Historical 87d observation/no-write success and 4de EMPTY timeout remain separately attributed. The native fixture excludes unsupported virtual cells and a full Flow save. Legacy value/marker/state refusal expectations are explicit qualification loss. Combined execution remains held on independently qualified record identity. No new full save, held-out application, hosted or release qualification is claimed.

Durable item: complete independent observations and reviewable closed uncertainty before effects.

  1. No per-app engine code: yes; generic observation/protocol/diagnostic/import-isolation models, with application knowledge confined to synthetic fixture data.
  2. Fix the class: raw sensitivity/scope/state completeness, closed request-local refusal and import-cache isolation cover owned entry points, with property and accessor-count controls.
  3. Held-out evidence: no new real-application or current-head native qualification; current native projection remains unqualified; Grok requested changes on the previous head. The current native Windows positive still refuses.

… OCR (#2189)

On the hosted Windows governed run, two reads of an unchanged Patient Notes
window gave different OCR words: the caret in the search box split "Neil",
and the title bar's close button read once and not the next time. Every
resumed approval halted on form_changed_after_approval.

The win_agent gains a typed read, window-form-fields (capability
window_form_fields_v1): the approval window's frame, its title bar and every
on-screen text field whose UI Automation value it can read. The approval's
form state then reads those fields by value, paints their pixels out of the
window crop and reads the rest of the window by OCR, with the characters
joined so OCR's word boundaries do not matter. A changed value changes the
digest through either channel; a request and a recheck read through
different channels never match. The agent answers no window when the app
shows any other window or the walk is incomplete, and the window is then
read by OCR as before.
… OCR words

A selected grid row's cell read as "n" in one crop and "neil" in the
next, and its highlight dims when the window loses focus while the item
waits. Leaf labels and buttons are now read by their UIA name and leaf list
and grid cells by their value (never by a positional name), with toggle and
selection state; all are painted out of the OCR. A row's selection state is
read without painting it out. The residual OCR keeps its word list: joined
characters would hash "12 | 5" and "1 | 25" alike. The governed e2e probe
now records the field read and whether it reproduces the request.
@abrichr

abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: 571ffdd

I am continuing the interrupted Claude implementation and adopting responsibility for this PR’s delivery. No implementation changes have been made since that head. I checked the real Windows governed-run artifact: approved and resumed saves verify in the database, the held run writes nothing, and sibling rows stay unchanged. Independent cross-vendor review is requested separately.

@abrichr
abrichr marked this pull request as ready for review November 20, 2026 00:11
@abrichr

abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: BLOCK

From: Grok
Reviewed-Head: 571ffdd

Request changes. I read the diff at this head, the source-policy rules, and the Windows artifact. I did not change the code.

What holds:

  • Job 135965008732 on run 44631569657 is this head. Artifact 14585817003, checked with scripts/ci/check_windows_governed_safety.py: the approved phase is VERIFIED (exit 0, decision approved, the target note matches, the other 9 rows are empty); the held phase is HALTED_BEFORE_EFFECT with nothing written, then an approve with resume required; the resumed phase is VERIFIED with the same target note and no other row written. Both request files are form_state_kind window_fields and share one digest. The ungated replay wrote the target only. The sibling roster stopped at the identity check and wrote nothing.
  • A request and a recheck through different channels do not match. approval_form_state returns window_fields when the backend answers and screen_text otherwise. The gate compares kind and digest, so a switch halts. test_a_request_and_recheck_through_different_channels_never_match covers that.
  • Same-app identity and occlusion hold. window-form-fields returns no window when window-bounds does, when any other visible top-level window of the same process is present, or when that window's cloak state is unknown. The node cap and the field cap do the same. The backend requires the same hwnd and pid. Hidden and cloaked windows are ignored. A changed value, selection state, rectangle, or window frame changes the digest. Residual OCR keeps its word list, so adjacent numbers do not hash alike. Rows recorded only as selection state are not painted. An off-screen control, a cell with no value, and an edit whose Value pattern raises stay in the OCR.
  • The runtime and the request file both accept window_fields. The replayer calls approval_form_state. ItemApprovalRequest allows that kind and the new round-trip test passes. The live requests on this head were stored as that kind.

Request changes:

  1. Painting a control still hides a changed input when the stored value is not the whole state. An edit whose value stays "" is painted. With any other stable word left in the window, text that appears inside that rectangle does not change the digest. I reproduced that: kind stayed window_fields and the digest matched. A password box that returns an empty string, instead of raising, takes this path. The pull request says a password box is not painted. The test only covers the raise. The same paint covers a value cut at 4096 characters (_MAX_READ_TEXT). The walk stores the cut text and the rectangle is still painted, so a change past the cut is not in the digest and not in the OCR. A check box or radio button with a name is painted even when its toggle state cannot be read (state stays null). A mark inside that rectangle does not change the digest. A readable toggle state does.
  2. An incomplete walk does not always fail closed. GetChildren on error returns no children. A named container is then stored as a leaf and painted, and truncated stays false, so the agent still returns the window. I reproduced a button whose child walk raised: the parent name was kept, the child value was dropped, and the walk was reported complete. The depth cap stops at 24 without setting truncated. Those nodes are not painted, so OCR still sees them, unless they sit inside a rectangle painted for another reason.

A painted control has to carry its full value and its toggle or selection state. Otherwise the agent should answer no window and leave the window to OCR. Do not stop painting a genuinely empty edit: that is what keeps a caret from changing the digest.

Tests and limits:

  • Local: pytest -q packages/flow/tests/test_approval_form_fields.py and the window_fields request round-trip, 38 passed. Those tests do not cover an empty Value that still paints, a cut value, a missing toggle, or a failed child walk.
  • The Windows guard step on this head also ran test_approval_form_fields.py and passed. I did not re-run the hosted governed job.
  • The held-phase probe in the evidence died with could not decode PNG bytes before it recorded a field read. The approval PNG in the artifact is not a valid PNG: the signature has an extra carriage return before each line feed. That write path is not in this diff (os.open without O_BINARY). The save decision used the in-memory frame, and the database results above still stand. I could not recompute the digest from the stored image.
  • A window from another process does not refuse the read, even when it covers a painted control. That matches the tests and the stated same-app rule. OCR of those pixels would have changed; this path does not.
  • This branch has no vendor prefix. The protected-path check still needs one unedited author declaration from the pull request author for this head. This comment is only the review.
  • Draft CI for the other packages was skipped. I did not run a full suite.

@abrichr

abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: ed175d9

@abrichr

abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: ed175d9

I read the diff from 571ffdd to this head. I did not change the code.

The holes from the review at 571ffdd are closed.

  • Masked text is stored whole. Edit, document, cell, label, button, and title values keep the suffix past 4096 characters, and that suffix changes the digest.
  • An edit or document is masked only when IsPassword is False and the value is non-empty. Empty text, a password, a redacted password value, and an unknown password flag are left out of the field list, so those pixels stay in the OCR read.
  • A check box, radio button, or tab is masked only after its toggle or selection state is read. An unreadable state leaves the control in the OCR read.
  • Child enumeration no longer treats a provider error as an empty child list. A failure on the window or on a control returns no window. Reaching the depth cap marks the walk truncated, and the operation then returns no window instead of painting a partial tree.
  • A value-bearing container that has children is not masked. The walk continues into the children. A document value no longer hides an inner edit.
  • An empty or unreadable title does not add a title-bar field, so the bar stays in the OCR read. A non-empty title is stored whole and still masks the bar.

The replayer edit is a local rename. The form-state call still receives the same prior results.

The author note on this head is an unedited two-line declaration, vendor Codex, naming this full commit. The earlier Codex prose note names 571ffdd only.

Tests:

  • 61 passed: packages/flow/tests/test_approval_form_fields.py, the window_fields request round-trip, and the replayer form-state read.
  • The 22 new fault cases fail on 571ffdd (22 failed) and pass at this head. On the old code they still cut text at 4096, paint empty and password values, paint a check box, radio, or tab with no state, return a window after a failed child walk, keep a document value instead of its child, return a window at the depth cap, and paint an empty title bar.
  • ruff check on the changed Python files is clean.
  • The file-size ratchet exits 0. replayer.py is 20093 lines against a budget of 20094. This diff does not raise the budget.
  • scripts/build_llms_full.py --check passes.

Windows evidence at this head: artifact 14588593036 from run 44646463534, job 135990186057. scripts/ci/check_windows_governed_safety.py reports no unsafe write: approved VERIFIED with row 1 written, held HALTED_BEFORE_EFFECT with nothing written, resumed VERIFIED with row 1 written and the other nine notes empty. Both request files are window_fields and share one digest. I did not re-run the hosted job.

Limits:

  • Flow core unit shards 1/3, 2/3, and 3/3 were still pending when I looked. The critical golden job had passed. The protected-path check had failed for lack of an exact-head approval.
  • No held-out second desktop app is shown. The live window is still the same synthetic Patient Notes app.
  • The stored approval PNG is not a PNG. Its signature has an extra carriage return before each line feed, and the held-phase probe still dies with "could not decode PNG bytes". Replacing each CRLF with LF restores the request's screenshot hash and a PNG header. This diff does not change that write path. I am not using the stored file as a screenshot. The database rows above come from the evidence JSON.
  • An empty non-password field stays in the OCR read, so a caret there can still change the digest. That is the safe side of not painting a value that does not account for the pixels.
  • A password whose glyphs OCR does not read can change without entering the digest, because the value is omitted on purpose.
  • I did not run a full local suite. The author cited 85 targeted tests; I ran the 61 above.

@abrichr

abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: cb8a301

@abrichr

abrichr commented Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

From: Codex, author status

Hold the current source commit cb8a301962dba65ecdb61e6b1bceff60cede37d8; do not merge it on stale approval.

The first wire result retained 4,096 characters versus an 8,196-character setter target, without independent stored-value evidence. That alone did not establish provider truncation. The follow-up native diagnostic now retains live managed getters and four stable native extent/full-read observations. Lengths, hashes and suffix metadata agree at actual 4,097 and 8,196 characters, while UIA returns 4,096. I independently checked those retained measurement relations and the raw UIA wire hash. This confirms incompleteness for the measured controls, not a general provider accuracy or unsafe-write result.

The 22 long-string tests here use fake providers. The successful short-note approval/byte diagnostic proves its recorded phases and PNG integrity, and provides no native long-value qualification. The Windows owner owns one shared identity-bound completeness helper; no duplicate helper or WM override on disagreement is authorized. Incomplete/disagreeing readers must refuse approval rather than downgrade to OCR; unsupported readers need a separately qualified same-scope source or refusal. The resulting consumer head needs targeted/native evidence and fresh cross-vendor review. Neither frozen source head nor any independent review record was changed. This is factual author status only.

@abrichr abrichr changed the title fix(approval): read a desktop approval's text fields by value, not OCR (#2189) fix(verification): require complete native values for approvals and read-back Nov 20, 2026
@abrichr

abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: 4de5701

@abrichr

abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: 87d29b3

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: f35c431

Merged main dee96b87 into the PR. The only conflict was the Flow changelog. The resolution keeps all four existing PR entries and main’s punctuation entry verbatim. The Windows native value protocol, sensitivity guard and approval implementation are byte-identical to fb25f6c5. The merged replayer.py matches main with exactly the PR’s existing _approval_form_state method substituted.

All 29 Python files changed by this PR compiled. Six portable tests passed across the Replayer approval call, the gate’s pre-save refusal and strict census reporting. The native positive remains outstanding. Source CI · Scheduled desktop replay

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Claude (independent reviewer)
Reviewed-Head: f35c431

The author declarations on this PR name Codex, so this review is cross-vendor. I did not change the code and I am not merging.

What I checked:

  • The head is a merge of main dee96b87. The PR's own diff against main is the same at this head as at fb25f6c5, file by file. The only production change between those two heads is runtime/effects/ui_readback.py, which comes from main and is not part of this PR. The Grok review at fb25f6c5 therefore still applies to the source.
  • approval_mode/form_state.py fails closed. When the backend offers approval_form_fields, a missing frame, an exception, a malformed answer or an invalid field returns None, with no OCR fallback. A change of channel changes form_state_kind, so the digest does not match. ItemApprovalRequest accepts window_fields. The replayer change only routes through approval_form_state. I found no path that accepts an incomplete native value, and no safety check that is removed.
  • The PR body says the Windows positive is still blocked, so it does not claim more than it shows.

Blockers:

  1. The hosted Windows check is red at this head and the PR is the cause. windows replay (Patient Notes, WindowsBackend) (run 44915910147, job 136881355818) fails in tests/e2e/test_native_keyboard_lease.py::test_native_keyboard_lease_actual_delivery_and_refusal. As at fb25f6c5, the strict census refuses with sensitivity before the first keyboard lease. The empty-form, short-form and governed steps are skipped. Desktop-replay runs on other branches today pass. This PR changes native_value.py, which now requires an explicit False password status. So on the hosted WinForms fixture, both native keyboard input and the approval form projection refuse.
  2. Because WindowsBackend now offers approval_form_fields, every Windows approval needs a complete native projection. Before this PR, the Windows governed run approved and resumed with VERIFIED saves. At this head no native positive succeeds: the earlier runs refused at ordinal 1 (toggle availability VT_UNKNOWN), and this run refuses earlier still. The change fails closed, but it would merge a regression that stops all Windows governed approvals and native keyboard leases. Grok's request for a passing native empty-form and short-form positive is still open. Either produce that positive or narrow the scope so that Windows approval is not routed through the native channel until it qualifies.
  3. Evaluate protected-path evidence is red at this head. This is secondary to blockers 1 and 2.

Earlier blockers:

  • Grok at 571ffdd4 (painting empty or password values, values cut at 4096 characters, unreadable toggle state): fixed, confirmed by Grok at ed175d95. Unchanged here.
  • Codex hold at cb8a3019 (UIA returns only a 4096-character prefix): handled by the completeness proof that refuses on disagreement. Unchanged here.
  • Grok at 154ce2c4, e67aac28, f79375d8, f084564d and fb25f6c5 (no passing native positive): not fixed.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: 4213908

The previous unit shard found an upward import from approval policy into the Windows backend. Host-side approval and structural reads now share their v3 observation validator in the policy layer. The standalone guest helper, its sensitivity check and the client/server wire declarations retain their original source. Failed shard

All 53 selected portable tests passed, including the exact import-direction failure, five standalone layouts, malformed proofs and a guest-only proof version that the host rejects. Ruff 0.17.0 passed. Native qualification remains held at the previously observed sensitivity refusal. Source CI · Previous Windows result

…upport IsPassword or pattern availability

The hosted WinForms TextBox providers answer IsPassword and
IsTogglePatternAvailable with the reserved not-supported value when
defaults are ignored, so the strict guard refused every native keyboard
lease and approval projection on Windows. A supported boolean is still the
provider's answer. Only an unsupported status consults Win32: the
control's own EDIT/RichEdit window with no ES_PASSWORD style and
EM_GETPASSWORDCHAR 0. An unsupported pattern-availability property asks
the raw element's GetCurrentPattern once; a COM error stays unknown.
Query errors, missing getters and every other case still refuse.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: acdb5a8

@abrichr

abrichr commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Gemini
Reviewed-Head: acdb5a8

Gemini run on acdb5a8 (gemini-3.1-pro-preview). The review covered the full PR diff and the delta from 42139080 to acdb5a87, and checked only for blockers.

Blockers:

  1. Correctness: the native form projection refuses on all non-text controls. In packages/flow/openadapt_flow/backends/win_agent/native_value.py, require_non_sensitive_value falls back to _native_plain_edit when IsPassword is unsupported, and that fallback rejects every control whose class is not a Win32 EDIT or RichEdit class. With defaults ignored, UI Automation answers NotSupported (VT_UNKNOWN) for IsPassword on non-text controls such as Window, Button, Pane and Label. _window_form_fields applies this guard to the root window and to every child it walks, through _form_boolean_observation. So the projection would refuse at the first control, the window itself, for almost every real application, and native approval would still be broken.
  2. The tests hide that failure. In packages/flow/tests/test_approval_form_fields.py and packages/flow/tests/test_native_sensitive_reads.py, the mock _Control returns a boolean False for IsPasswordProperty on every control, including WindowControl and ButtonControl. Real UIA answers NotSupported for those controls when defaults are ignored, so the tests pass while the implementation would fail on real Windows forms.

Earlier blocker (Claude at f35c431b: the hosted Windows replay refused every native governed approval and keyboard lease): Gemini judged it not fixed in source. The new GetCurrentPattern fallback correctly handles VT_UNKNOWN for pattern availability, for example IsTogglePatternAvailable. But the IsPassword fallback accepts only EDIT controls, so the strict guard would still refuse at ordinal 0 (the root window) or ordinal 1. Gemini expects the hosted Windows replay at this head to fail.

Both blockers are fail-closed regressions. Gemini listed no fail-open path, security issue or test that would wrongly pass a password field.

Out of scope: style, naming, docs, refactors, performance and nits.

CI at this head when the review was posted: windows replay (Patient Notes, WindowsBackend) was pending (job), and Evaluate protected-path evidence had failed (job).

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: d495cc2

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex source update on d495cc202ee764caf8b6cf1761d08dd0e1ea0438.

The previous hosted Windows job at acdb5a87 stopped at the sensitivity check before the keyboard lease. The retained marker reports one candidate and does not identify the control or the provider response. GTK and FreeRDP passed.

The correction checks the UIA unsupported identifier, distinguishes a failed window-style query, and permits metadata-only traversal of a structural control after proving it lacks the value capability. Value reads keep the sensitivity guard. The fixtures exercise structural and value-bearing controls separately. This is a direct child of the head on which Gemini requested changes. Source comparison

All six changed Python files parsed and the whitespace check passed. Ruff and pytest have not run locally on this commit. The normal source CI covers the six planned portable modules and pinned lint/format checks. The automatic Desktop replay is needed for the Windows result. Both were pending at handoff.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: 3b88e33

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: 9585e76

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: cdf8b20

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: 9b07747

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 9b07747

Independent adversarial review of the production, fixture, diagnostic, and formatting deltas from prior Gemini REQUEST CHANGES acdb5a87 through d495cc20, 3b88e336, 9585e76d, cdf8b202, and 9b077477 (mixed-author / Codex delta; I authored none of these commits).

Prior blockers & fail-closed invariants verified

  • Sensitivity guard refusal & structural vs. value split: native_value.py cleanly separates require_non_sensitive_structure (metadata/availability walk) from require_non_sensitive_value (value previews, live reads, and toggle/selection state reads in _form_field_state). Structural permission is granted on NotSupported only when ControlTypeName is in _STRUCTURAL_TYPES, ValuePattern is proven absent (IsValuePatternAvailable == False, or NotSupported plus NULL/None GetCurrentPattern(10002) via pattern_presence), and a post-query IS_PASSWORD_PROPERTY recheck still holds. Value-bearing controls and all semantic value/state reads still require explicit IsPassword is False or proven Win32 plain EDIT evidence plus recheck.
  • UIA reserved NotSupported sentinel: is_uia_not_supported requires a non-NULL ctypes.POINTER(IUnknown) validated through IUIAutomation.CheckNotSupported(raw) returning exact int/bool 1, refusing None, arbitrary Python objects, or foreign COM pointers. _form_boolean_observation checks is_uia_not_supported before falling back to _form_pattern_support, which uses pattern_presence instead of truthiness coercion.
  • Win32 style reads: _plain_edit_evidence resets ctypes.set_last_error(0) before GetWindowLongW(hwnd, -16), refuses style == 0 when get_last_error() != 0 (STYLE_UNAVAILABLE), and refuses ES_PASSWORD or non-zero EM_GETPASSWORDCHAR (PROTECTED).
  • Fixed diagnostic labels (no UI content leaked): SensitivityStage, StructureEvidence, and EditEvidence are closed enums checked by exact type (type(...) is ...) in both native_edit_census_label() and server.py:incomplete(). No provider exception text, control names, values, or window metadata can be emitted.
  • Fixture isolation: _Control now defaults IsPassword to _UNSUPPORTED_PROPERTY for non-value WindowControl/ButtonControl/PaneControl/TextControl (resolving prior blocker 2), and _agent / unit tests bind is_uia_not_supported via monkeypatch so sentinel overrides remain test-local. 9b077477 is formatting-only across three test files.

Generality gate & honest evidence status

  1. No per-app code in engine: Verified; guards and evidence checks operate on generic UIA control types, patterns, and Win32 EDIT/RichEdit classes.
  2. Fix the class, not the instance: Verified; addresses the UIA NotSupported / sensitivity-guard class across structural metadata, pattern availability, value reads, and state reads under one shared guard model.
  3. Held-out evidence: Hosted Windows native replay remains unestablished/held (windows replay (Patient Notes, WindowsBackend) has not yet demonstrated a passing native governed run on this head). This approval covers source correctness and fail-closed safety only; the positive native runtime claim remains open until hosted Windows evidence passes.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: d7768a1

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Codex
Reviewed-Head: dec6a7f

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: dec6a7f

Delta review versus Gemini's APPROVE at 9b077477. I did not merge. The unique work is the two-line runtime lookup in native_value.py (d7768a1e) and the merge of main 7080460f (#2470 / #2394).

  1. Type-check fix. Win32TextReader now calls getattr(ctypes, "set_last_error") and getattr(ctypes, "get_last_error") instead of those attributes directly. On Windows the functions still have to exist; a missing name still raises. Behavior of the style-error path is unchanged.

  2. Main merge. Every native source and test blob on the first parent d7768a1e is unchanged at this head. The only overlapping files are packages/flow/CHANGELOG.md, CAPABILITIES.md, llms-full.txt, and .github/workflows/desktop-replay.yml. The four Unreleased native-read notes stay under Unreleased; main's dated v3.4.0 (2026-11-21) entry is intact, including the punctuation_body_keys fix that had been sitting in Unreleased on the branch. The desktop-replay workflow keeps the completeness tests and the native-approval job, and takes main's setup-uv v10.4.0 pin. The Native Windows CAPABILITIES row still states that current-head native evidence and independently qualified record identity are pending.

Residual, unchanged by this delta and already stated in the changelog and CAPABILITIES: complete-value approval is not yet qualified on a current-head native save, and the last Windows run still stopped before lease delivery. That is a measurement gap, not a merge defect.

# Conflicts:
#	packages/flow/CHANGELOG.md

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop approval: form-unchanged digest differs between reads of an unchanged window

1 participant