From 2660614de188377f74721387e34e920ea02c10ab Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 24 Nov 2026 01:53:21 -0500 Subject: [PATCH 1/2] fix(flow): mark the identity-ladder VLM stub local and make the choice drift test deterministic The identity-ladder harness stub is in process, like the MLXIdentityVLM it stands in for. Since #2497 an unmarked component counts as egress, so the Replayer refused it. It now carries MAY_EGRESS = False. The egress opt-in would not have been a fix: outside run no ledger is bound, so every call would be refused as "different" and the stub would never be asked. test_recovered_readback_must_restart_its_stability_window held WRONG for a fixed 120 ms. Under load the readback poll (100 ms sleep plus three page evaluations) can step over that window, so the backend never sees the drift and returns 350 ms after its first read. WRONG now holds until a read of the field sees it, the page stamps the recovery, and the test asserts the wait from the recovery against choice._STABLE_S plus the 300 ms confirm delay. --- .../validation/identity_ladder.py | 7 +++ packages/flow/tests/test_choice_backend.py | 51 +++++++++++++++---- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/packages/flow/openadapt_flow/validation/identity_ladder.py b/packages/flow/openadapt_flow/validation/identity_ladder.py index e5fbf776f4..cb747cc911 100644 --- a/packages/flow/openadapt_flow/validation/identity_ladder.py +++ b/packages/flow/openadapt_flow/validation/identity_ladder.py @@ -257,6 +257,13 @@ class ProbeFaithfulVLM: same-value pairs -> "same". Under the VETO-ONLY contract a "same" answer no longer grants a pass (verify_vlm_identity folds it to abstain).""" + # In process, like the MLXIdentityVLM it stands in for: it sends nothing + # off the box. Unmarked, the Replayer refuses it without the egress opt-in + # (#2497), and the opt-in would not help here: outside ``run`` no egress + # ledger is bound, so every call would be refused as "different" and the + # stub's answers would never reach the identity ladder. + MAY_EGRESS = False + def __init__(self, is_same: bool) -> None: self._is_same = is_same diff --git a/packages/flow/tests/test_choice_backend.py b/packages/flow/tests/test_choice_backend.py index 121ae2edb3..98b38f1966 100644 --- a/packages/flow/tests/test_choice_backend.py +++ b/packages/flow/tests/test_choice_backend.py @@ -1044,15 +1044,41 @@ def prepare(page: Any) -> None: def test_recovered_readback_must_restart_its_stability_window( server: Server, browser: Any, kind: str ) -> None: + from openadapt_flow.backends import choice + + # The committed value drifts to WRONG, then recovers to CARD. WRONG holds + # until a read of the field has seen it: a fixed WRONG window can fall + # between two readback polls on a loaded machine, and then the backend + # never sees the drift at all and the test proves nothing. The page + # stamps when CARD came back, so the wait below is measured from the + # recovery on one clock, against the backend's own stable interval. def prepare(page: Any) -> None: page.evaluate( """kind => { const field = document.querySelector('[name=department]'); + const own = Object.getOwnPropertyDescriptor( + Object.getPrototypeOf(field), 'value'); + let drifted = null; + window.sawWrong = false; + window.recoveredAt = null; + Object.defineProperty(field, 'value', { + configurable: true, + get() { + const value = own.get.call(this); + if (value === 'WRONG' && !window.sawWrong) { + window.sawWrong = true; + setTimeout(() => { + drifted.value = 'CARD'; + window.recoveredAt = performance.now(); + }, 60); + } + return value; + }, + set(value) { own.set.call(this, value); }, + }); const drift = () => { - window.commitAt = performance.now(); - const target = kind === 'native' ? field.selectedOptions[0] : field; - setTimeout(() => target.value = 'WRONG', 60); - setTimeout(() => target.value = 'CARD', 180); + drifted = kind === 'native' ? field.selectedOptions[0] : field; + setTimeout(() => drifted.value = 'WRONG', 60); }; if (kind === 'native') field.addEventListener('change', drift); else document.addEventListener('mousedown', event => { @@ -1062,21 +1088,28 @@ def prepare(page: Any) -> None: kind, ) - elapsed: list[float] = [] + seen: list[Any] = [] outcome, value, confirmed = _choose( server, browser, kind, "Cardiology", prepare=prepare, - check=lambda page: elapsed.append(page.evaluate("performance.now()-commitAt")), + check=lambda page: seen.append( + page.evaluate( + "({sawWrong: window.sawWrong, since: window.recoveredAt === null" + " ? null : performance.now() - window.recoveredAt})" + ) + ), ) assert isinstance(outcome, dict), outcome assert value == "CARD" assert confirmed - # _choose includes its existing300ms final confirm delay; the choice - # itself must wait beyond the recovered state's full stable interval. - assert elapsed[0] >= 800 + assert seen[0]["sawWrong"], "the backend never read the drifted value" + # The choice returns no sooner than the stable interval after the first + # read of the recovered state, and _choose then waits 300 ms to confirm. + assert seen[0]["since"] is not None + assert seen[0]["since"] >= choice._STABLE_S * 1000 + 300 @pytest.mark.parametrize("prior", [None, False, True]) From 59772d725bcedde5a140ff79cae3fea186923ae6 Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 24 Nov 2026 01:53:56 -0500 Subject: [PATCH 2/2] docs(types, verify): cite #2616 in the late-publish notes --- packages/types/CHANGELOG.md | 7 ++++--- packages/verify/CHANGELOG.md | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 5cf78eda0e..345f21f30e 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,9 +5,10 @@ 0.24.1 was stamped on main but never published. 0.24.2 is the first published release with this content, and the version to install. Its first -main push runs failed on unrelated Flow jobs that #2423 broke, which -[#2589](https://github.com/OpenAdaptAI/OpenAdapt/pull/2589) and -[#2600](https://github.com/OpenAdaptAI/OpenAdapt/pull/2600) fixed, so it +main push runs failed on unrelated Flow jobs, which +[#2589](https://github.com/OpenAdaptAI/OpenAdapt/pull/2589), +[#2600](https://github.com/OpenAdaptAI/OpenAdapt/pull/2600) and +[#2616](https://github.com/OpenAdaptAI/OpenAdapt/pull/2616) fixed, so it publishes from the run after those fixes. openadapt-flow 3.4.0 imports `openadapt_types.receipt`, which 0.24.0 does not diff --git a/packages/verify/CHANGELOG.md b/packages/verify/CHANGELOG.md index 132225c26e..8cea26edba 100644 --- a/packages/verify/CHANGELOG.md +++ b/packages/verify/CHANGELOG.md @@ -2,9 +2,10 @@ ## v0.2.1 (2026-11-23) -Published after [#2589](https://github.com/OpenAdaptAI/OpenAdapt/pull/2589) -and [#2600](https://github.com/OpenAdaptAI/OpenAdapt/pull/2600): its first -main push runs failed on unrelated Flow jobs. +Published after [#2589](https://github.com/OpenAdaptAI/OpenAdapt/pull/2589), +[#2600](https://github.com/OpenAdaptAI/OpenAdapt/pull/2600) and +[#2616](https://github.com/OpenAdaptAI/OpenAdapt/pull/2616): its first main +push runs failed on unrelated Flow jobs. - Accept openadapt-flow 4: the openadapt-flow requirement and the `openai`, `claude` and `mcp` extras now allow `<5` (was `<4`), so openadapt-verify