diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f917ad8c6..62b0aa0565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ## Unreleased +### Requirements + +- Accepts openadapt-flow 4: the launcher's Flow requirement and `openadapt + doctor`'s supported range are now `>=3.3.0,<5.0.0` (was `<4.0.0`). + ### Features - **Agent-to-agent handoffs.** diff --git a/docs/platform-compatibility-report.md b/docs/platform-compatibility-report.md index 1bef797137..ef8e68d17a 100644 --- a/docs/platform-compatibility-report.md +++ b/docs/platform-compatibility-report.md @@ -2,7 +2,7 @@ -- Generated: `2026-11-19T21:28:04+00:00` +- Generated: `2026-11-22T12:49:07+00:00` - Selection: `explicit-published` - Compatibility: **dependency-compatible** - Signature: `unsigned (signing infrastructure pending)` diff --git a/openadapt/cli.py b/openadapt/cli.py index bf64846eb6..ad6e329212 100644 --- a/openadapt/cli.py +++ b/openadapt/cli.py @@ -1341,8 +1341,9 @@ def _warn_about_launcher_conflicts() -> None: # public_seal module, and the quickstart's encrypted checkpoints rely on its # key derivation once per store. Launcher 1.23 requires Flow 3.3: the OpenEMR # quickstart's referral program checks its date picker against the run's -# clock (`Postcondition.text_clock`), which Flow 3.2 ignores. -_SUPPORTED_FLOW_RANGE = ">=3.3.0,<4.0.0" +# clock (`Postcondition.text_clock`), which Flow 3.2 ignores. Flow 4.0 +# removes and renames APIs the launcher doesn't use, so it is accepted too. +_SUPPORTED_FLOW_RANGE = ">=3.3.0,<5.0.0" _RDP_INSTALL_COMMAND = _pip_install("openadapt[rdp]") _CHROMIUM_SYSTEM_LIBS_COMMAND = ( f"{shlex.quote(sys.executable)} -m playwright install-deps chromium" @@ -1352,7 +1353,7 @@ def _warn_about_launcher_conflicts() -> None: def _supported_flow_version(value: str) -> bool: """Return whether a stable Flow version is in the launcher's supported range.""" parsed = _release_tuple(value) - return parsed is not None and (3, 3, 0) <= parsed < (4, 0, 0) + return parsed is not None and (3, 3, 0) <= parsed < (5, 0, 0) # The Python modules each native or remote Flow backend imports when its diff --git a/packages/flow/docs/HARNESS2.md b/packages/flow/docs/HARNESS2.md index 1ea885dc51..738f0a2ab6 100644 --- a/packages/flow/docs/HARNESS2.md +++ b/packages/flow/docs/HARNESS2.md @@ -43,7 +43,7 @@ they are, and turns the outcome into one number for ranking: | `wrong_effect`: reported saved, but no record landed | -0.5 | | A record landed on another patient | -1.0 | | The patient got more than one record | -1.0 | -| `escalated_after_effect`: the record landed as declared, then the agent stopped and asked | the receipt's scalar, the contract's `escalated_after_effect_reward` (default 0.5) | +| `escalated_after_effect`: the record landed as declared, then the agent stopped and asked | the receipt's scalar, the contract's `escalated_after_effect_reward` (0.5 in the synthetic bundle; 0 when a contract doesn't declare it) | | `reconciliation_required` or `failed_platform` | none (a person settles it) | The penalties are the caller's choice (`Penalties`). A write on another diff --git a/packages/flow/docs/REWARD_WORKER.md b/packages/flow/docs/REWARD_WORKER.md index b4e8a9bcb8..37645ecd04 100644 --- a/packages/flow/docs/REWARD_WORKER.md +++ b/packages/flow/docs/REWARD_WORKER.md @@ -111,7 +111,7 @@ this order. | Signal `completed`, every required effect CONFIRMED | `verified` | the declared positive reward | | Signal `completed`, a required effect REFUTED (absent, duplicated, wrong value) | `wrong_effect` | 0 or the declared penalty | | Signal `halted_before_effect`, `refused`, or `rejected_policy`, store shows no required effect | that outcome | 0 or the declared penalty | -| Same signals, and every required effect is present exactly as declared | `escalated_after_effect` | `escalated_after_effect_reward` (default 0.5) | +| Same signals, and every required effect is present exactly as declared | `escalated_after_effect` | `escalated_after_effect_reward` (0 unless the contract declares it; the synthetic bundle declares 0.5) | | Same signals, and a required effect is present but not as declared | `reconciliation_required`, uncertainty `effect_uncertain` | unscored | Unscored is never 0.0. The receipt carries `scalar_reward: null` and the diff --git a/packages/flow/openadapt_flow/reward/bundle.py b/packages/flow/openadapt_flow/reward/bundle.py index 01c57c1a86..e209b621d3 100644 --- a/packages/flow/openadapt_flow/reward/bundle.py +++ b/packages/flow/openadapt_flow/reward/bundle.py @@ -148,7 +148,13 @@ def write_bundle( "components": [{"name": "terminal_effect", "weight": 1.0}], # The synthetic banner lie yields 0, not the default -1 penalty: # this fixture demonstrates "no reward", not a tuned penalty. - "scoring": {"wrong_effect_reward": 0.0}, + # Asking a person after the right record landed earns half the + # verified reward. The contract declares it: an undeclared + # escalation earns nothing (openadapt-types 0.24.1). + "scoring": { + "wrong_effect_reward": 0.0, + "escalated_after_effect_reward": 0.5, + }, "certificate_policy": { "epsilon": 0.05, "delta": 0.05, diff --git a/packages/flow/openadapt_flow/reward/worker.py b/packages/flow/openadapt_flow/reward/worker.py index 43991dfce6..30cd36acf9 100644 --- a/packages/flow/openadapt_flow/reward/worker.py +++ b/packages/flow/openadapt_flow/reward/worker.py @@ -140,7 +140,8 @@ def judge_episode( * signal ``halted_before_effect`` / ``refused`` / ``rejected_policy``: no required effect present -> that outcome; every required effect CONFIRMED -> ``ESCALATED_AFTER_EFFECT``, the contract's partial credit - (default 0.5), because the work is done and the policy asked a person + (0 unless the contract declares it; the synthetic bundle declares + 0.5), because the work is done and the policy asked a person instead of declaring it; any other required effect present (a duplicate or wrong write, say) -> ``RECONCILIATION_REQUIRED`` with ``effect_uncertain``, since the runtime and the store disagree and a diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 5b49e96119..9f79909aa7 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,14 +1,81 @@ # CHANGELOG -## v0.24.1 (2026-11-22) +## v0.24.2 (2026-11-22) -### Features +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. + +openadapt-flow 3.4.0 imports `openadapt_types.receipt`, which 0.24.0 does not +have. This release adds it and the other modules Flow imports on main +(openadapt-flow 4.0.0 will require it). It stays +within the `<0.25.0` range every released Flow 3 accepts, so upgrading this +package repairs a Flow 3.4.0 install. -- **Run receipts (`openadapt_types.receipt`, `openadapt_types.receipt_callback`).** DSSE-wrapped in-toto `record/run/v1` run receipts with signer roles, public allow-list verification, counterparty confirmations, handoff payload and item-approval bindings, RFC 8785 `report.canonical` subject digests, follow-up receipt chains (`predicate.follows`), and shared verification vectors. -- **Exception cards, run ledger, and managed jobs (`openadapt_types.exception_card`, `openadapt_types.run_ledger`, `openadapt_types.managed_job`).** Closed exception-queue card models, per-run accounting ledger schemas, and generalized managed-job contracts shared across executors and surfaces. -- **Reward partial credit (`openadapt_types.reward`).** Configurable partial-credit scoring for a confirmed write followed by an escalation ([#1824](https://github.com/OpenAdaptAI/OpenAdapt/pull/1824)). +### Features +- `openadapt_types.receipt`: the `record/run/v1` signed run receipt. It + covers building, signing and verifying the statement, the public card + (`receipt.card.json`) with only allow-listed values opened, private + openings, role keys and a key registry, counterparty confirmation lines, + and follow-up statements. Signing and verifying import `cryptography` only + when called ([#2394](https://github.com/OpenAdaptAI/OpenAdapt/pull/2394), + [#2410](https://github.com/OpenAdaptAI/OpenAdapt/pull/2410), + [#2412](https://github.com/OpenAdaptAI/OpenAdapt/pull/2412), + [#2426](https://github.com/OpenAdaptAI/OpenAdapt/pull/2426)). +- `openadapt_types.receipt_callback`: checks a managed callback's settled + report against its pinned signer and final outcome + ([#2412](https://github.com/OpenAdaptAI/OpenAdapt/pull/2412)). +- `openadapt_types.run_ledger`: `openadapt.run-ledger/v1` (`RunLedgerRowV1`) + and `openadapt.agent-run-summary/v1` (`AgentRunSummaryV1`), one value-free + accounting row per run. Every string field is closed by a pattern or an + enum. The names are exported from `openadapt_types` + ([#2478](https://github.com/OpenAdaptAI/OpenAdapt/pull/2478)). +- `openadapt_types.exception_card`: `openadapt.exception-card/v1` and + `openadapt.exception-answer/v1`, with seven closed kinds and five closed + answers. Import it by its submodule path; it is not exported from + `openadapt_types` ([#2494](https://github.com/OpenAdaptAI/OpenAdapt/pull/2494)). +- Reward contracts: the `escalated_after_effect` outcome, for an episode + whose required effects are all in the system of record but which asked a + person instead of declaring the task done. It earns the contract's + `escalated_after_effect_reward`: at least 0, below 1 and below its + `verified_reward`. A declared value at or above `verified_reward` is + refused, because asking would then pay as much as finishing. The default + is 0: a contract that doesn't declare it earns nothing for this outcome + ([#1824](https://github.com/OpenAdaptAI/OpenAdapt/pull/1824)). +- `openadapt_types.managed_job`: domain-neutral inbox, outbox, tool result + and MCP tool contracts (`openadapt.managed-*/v1`), with four new packaged + schemas. `openadapt_types.clinic_job` stays as the compatibility module for + `openadapt.clinic-*/v1` payloads; its exception and enum names are now + aliases of the `Managed*` ones + ([#2487](https://github.com/OpenAdaptAI/OpenAdapt/pull/2487)). +- Domain-neutral names beside the v1 ones: `StepClass.HIGH_RISK_WRITE` + (wire value `clinical_write`), `ApproverPolicyRefusal.HIGH_RISK_WRITE_NEEDS_OPT_IN` + and `OutcomeSourceV1.MANAGED_TOOL_STATUS`. Approval records and policies + also accept the input keys `high_risk_write`, `high_risk_write_opt_in_sha256` + and step class `high_risk_write`; plain outcome inputs accept + `managed_tool_status`, and `plain_outcome()` takes a + `managed_tool_status=` argument beside `clinic_tool_status=`. Each is + stored and written as its v1 form, so + output is byte-identical to 0.24.0. The packaged schemas, and readers + older than 0.24.2, accept only the v1 forms + ([#2487](https://github.com/OpenAdaptAI/OpenAdapt/pull/2487)). + +### Compatibility + +- Contracts written or certified under 0.24.0 behave as before. They load + (including any positive `verified_reward`), hash to the same digest, keep + their certificates, and score every outcome 0.24.0 had the same way. The + new `escalated_after_effect` outcome earns 0 under them, since they never + declared it. A test checks this against contracts and certificates + issued by openadapt-types 0.24.0 from PyPI. +- Every 0.24.0 approval record, approver policy and identity, clinic payload + and plain outcome loads and serializes to the same bytes and digests, and + every 0.24.0 name and enum member still exists under its 0.24.0 name. +- `escalated_after_effect_reward` is serialized, and so hashed, only when it + differs from 0, so a file 0.24.2 writes for an undeclared contract is one + 0.24.0 can read. A contract that declares a non-zero value can't be read + by 0.24.0, which forbids unknown fields. ## v0.24.0 (2026-10-20) diff --git a/packages/types/docs/REWARD.md b/packages/types/docs/REWARD.md index f86ac4f064..0bbddb60b6 100644 --- a/packages/types/docs/REWARD.md +++ b/packages/types/docs/REWARD.md @@ -94,7 +94,7 @@ answer `score()` gave. | `refused` | zero or penalty | `refused_reward` (default 0.0) | | `rejected_policy` | zero or penalty | `rejected_policy_reward` (default 0.0) | | `wrong_effect` | zero or penalty | `wrong_effect_reward` (default -1.0) | -| `escalated_after_effect` | partial credit | `escalated_after_effect_reward` (default 0.5) | +| `escalated_after_effect` | partial credit | `escalated_after_effect_reward` (default 0) | | `reconciliation_required` | unscored | none | | `failed_platform` | unscored | none | @@ -109,17 +109,19 @@ failure this contract exists to stop. `escalated_after_effect` is an episode where every required effect is in the system of record exactly as declared and no forbidden effect is, but the policy halted, refused, or was rejected instead of declaring the task done. It earns -`escalated_after_effect_reward`, default 0.5. The value must be at least 0 and -below 1, and below `verified_reward`; anything else, including NaN and -infinity, makes the contract refuse to load. +`escalated_after_effect_reward`, default 0: a contract that doesn't declare +it earns nothing for this outcome, so a contract written before the outcome +existed never starts paying for it. The value must be at least 0 and below 1, +and below `verified_reward`; anything else, including NaN and infinity, makes +the contract refuse to load. The value sets how sure a policy has to be before it declares done rather than asks a person. Declaring done earns `verified_reward` (v) when the effect is right and `wrong_effect_reward` (w) when it is wrong; asking earns x. Done pays more in expectation only when the policy's confidence p satisfies -p * v + (1 - p) * w > x, that is p > (x - w) / (v - w). With v = 1, w = -1 and -the default x = 0.5, the threshold is 75%. With x = 0 it is 50%, and with -x = 0.25 it is 62.5%. A higher x makes the policy ask more often. +p * v + (1 - p) * w > x, that is p > (x - w) / (v - w). With v = 1 and w = -1, +the default x = 0 gives a threshold of 50%, x = 0.25 gives 62.5%, and x = 0.5 +gives 75%. A higher x makes the policy ask more often. An effect that is present but not as declared (a duplicate or a wrong value) after the policy stopped is still `reconciliation_required` and unscored, and a diff --git a/packages/types/openadapt_types/approval.py b/packages/types/openadapt_types/approval.py index b0e950ec10..d01c35ebcc 100644 --- a/packages/types/openadapt_types/approval.py +++ b/packages/types/openadapt_types/approval.py @@ -281,11 +281,13 @@ class StepClass(str, Enum): REVERSIBLE = "reversible" CONSEQUENTIAL = "consequential" IRREVERSIBLE = "irreversible" - #: An irreversible, high-risk write to a system of record. - #: Wire value remains ``clinical_write`` in v1 for signed-grant and receipt compatibility. - HIGH_RISK_WRITE = "clinical_write" - #: Legacy alias for ``HIGH_RISK_WRITE``. + #: An irreversible, high-risk write to a system of record. Declared + #: first so the member keeps its 0.24.0 name (``.name``, ``str()``, + #: ``repr()``); the wire value stays ``clinical_write`` in v1 for + #: signed-grant and receipt compatibility. CLINICAL_WRITE = "clinical_write" + #: Domain-neutral alias for ``CLINICAL_WRITE``. + HIGH_RISK_WRITE = "clinical_write" @classmethod def _missing_(cls, value: object) -> Optional["StepClass"]: @@ -305,10 +307,11 @@ class ApproverPolicyRefusal(str, Enum): """Closed reasons a policy refuses an approver.""" KIND_NOT_ALLOWED = "approver_kind_not_allowed" - #: Wire value remains ``clinical_write_needs_opt_in`` in v1 for Flow compatibility. - HIGH_RISK_WRITE_NEEDS_OPT_IN = "clinical_write_needs_opt_in" - #: Legacy alias for ``HIGH_RISK_WRITE_NEEDS_OPT_IN``. + #: Declared first so the member keeps its 0.24.0 name; the wire value + #: stays ``clinical_write_needs_opt_in`` in v1 for Flow compatibility. CLINICAL_WRITE_NEEDS_OPT_IN = "clinical_write_needs_opt_in" + #: Domain-neutral alias for ``CLINICAL_WRITE_NEEDS_OPT_IN``. + HIGH_RISK_WRITE_NEEDS_OPT_IN = "clinical_write_needs_opt_in" @classmethod def _missing_(cls, value: object) -> Optional["ApproverPolicyRefusal"]: diff --git a/packages/types/openadapt_types/plain_results.py b/packages/types/openadapt_types/plain_results.py index a2ed1031fd..f7841edf68 100644 --- a/packages/types/openadapt_types/plain_results.py +++ b/packages/types/openadapt_types/plain_results.py @@ -105,10 +105,11 @@ class OutcomeSourceV1(str, Enum): EXECUTION_OUTCOME = "execution_outcome" AGENT_STATUS = "agent_status" CONNECTOR_STATUS = "connector_status" - #: Domain-neutral alias; v1 wire key remains ``clinic_tool_status`` for - #: compatibility with deployed v1 readers and schemas. - MANAGED_TOOL_STATUS = "clinic_tool_status" + #: Declared first so the member keeps its 0.24.0 name; the v1 wire key + #: stays ``clinic_tool_status`` for deployed v1 readers and schemas. CLINIC_TOOL_STATUS = "clinic_tool_status" + #: Domain-neutral alias for ``CLINIC_TOOL_STATUS``. + MANAGED_TOOL_STATUS = "clinic_tool_status" PROGRAM_TERMINAL_STATE = "program_terminal_state" OVERLAY_PHASE = "overlay_phase" diff --git a/packages/types/openadapt_types/reward.py b/packages/types/openadapt_types/reward.py index 391f4a68bc..0d49a5199a 100644 --- a/packages/types/openadapt_types/reward.py +++ b/packages/types/openadapt_types/reward.py @@ -47,7 +47,9 @@ StrictFloat, StrictInt, StrictStr, + SerializerFunctionWrapHandler, field_validator, + model_serializer, model_validator, ) @@ -122,7 +124,7 @@ class RewardOutcomeV1(str, Enum): and no forbidden effect is, but the policy halted, refused, or was rejected instead of declaring the task done. Partial credit: the contract's ``escalated_after_effect_reward``, at least zero and below the - verified reward.""" + verified reward, and zero when the contract declares none.""" RECONCILIATION_REQUIRED = "reconciliation_required" """Delivery or effect is uncertain. UNSCORED. Never 0.0.""" @@ -253,6 +255,18 @@ def tier(self) -> OracleTier: return tier_of(self.channel) +#: The credit for asking after the work is done, when a contract declares none. +#: Zero: an outcome added in 0.24.1 never pays under a contract that was +#: written, or certified, without declaring it. +ESCALATED_AFTER_EFFECT_DEFAULT = 0.0 +#: Scoring fields added in 0.24.1, with the default a contract certified +#: under 0.24.0 implicitly has. They are not serialized at that default, so +#: every 0.24.0 digest stays the same and 0.24.0 can read what 0.24.1 writes. +_DIGEST_STABLE_SCORING_DEFAULTS: Mapping[str, float] = { + "escalated_after_effect_reward": ESCALATED_AFTER_EFFECT_DEFAULT, +} + + class RewardScoringPolicyV1(_StrictContract): """How each scoring class becomes a scalar. @@ -264,10 +278,13 @@ class RewardScoringPolicyV1(_StrictContract): the confidence a policy needs before it declares done rather than asks: with verified reward ``v``, wrong-effect reward ``w`` and this value ``x``, declaring done pays more in expectation only when the policy is - more than ``(x - w) / (v - w)`` sure the effect is right. With the - defaults (1, -1, 0.5) that is 75%. Zero gives no credit for asking; a - value at or above the verified reward is refused, because asking would - then pay as much as finishing. + more than ``(x - w) / (v - w)`` sure the effect is right. With + ``v = 1``, ``w = -1`` and ``x = 0.5`` that is 75%. The default is zero: + a contract that doesn't declare it gives no credit for asking, so a + contract certified before this outcome existed never starts paying for + it. The value is at least 0 and below 1; a value at or above the + verified reward is refused too, because asking would then pay as much as + finishing. """ verified_reward: StrictFloat = Field( @@ -301,7 +318,7 @@ class RewardScoringPolicyV1(_StrictContract): allow_inf_nan=False, ) escalated_after_effect_reward: StrictFloat = Field( - default=0.5, + default=ESCALATED_AFTER_EFFECT_DEFAULT, ge=0.0, lt=1.0, allow_inf_nan=False, @@ -317,6 +334,29 @@ def _partial_credit_below_verified(self) -> RewardScoringPolicyV1: ) return self + @model_serializer(mode="wrap") + def _omit_new_defaults( + self, handler: SerializerFunctionWrapHandler + ) -> dict[str, object]: + # A field added in 0.24.1 is written out only when it differs from + # its default, so a file this version writes stays readable by + # 0.24.0 (whose models forbid unknown fields) and hashes the same. + data = handler(self) + for name, default in _DIGEST_STABLE_SCORING_DEFAULTS.items(): + if data.get(name) == default: + del data[name] + return data + + @property + def escalated_after_effect_credit(self) -> float: + """The scalar an ``escalated_after_effect`` episode earns. + + The declared value, zero when the contract declares none. The + validator keeps it below the verified reward. + """ + + return self.escalated_after_effect_reward + def scalar_for(self, outcome: RewardOutcomeV1) -> float | None: """Return the declared scalar, or ``None`` for an unscored outcome.""" @@ -327,7 +367,7 @@ def scalar_for(self, outcome: RewardOutcomeV1) -> float | None: RewardOutcomeV1.REJECTED_POLICY: self.rejected_policy_reward, RewardOutcomeV1.WRONG_EFFECT: self.wrong_effect_reward, RewardOutcomeV1.ESCALATED_AFTER_EFFECT: ( - self.escalated_after_effect_reward + self.escalated_after_effect_credit ), } return declared.get(RewardOutcomeV1(outcome)) @@ -390,6 +430,14 @@ def component_names(self) -> tuple[str, ...]: @property def digest(self) -> str: + """The canonical digest certificates and receipts bind. + + A scoring field added after a contract version shipped is serialized, + and so hashed, only when it differs from its default + (``RewardScoringPolicyV1._omit_new_defaults``). A contract written + before the field existed keeps the digest it was certified under. + """ + return _digest_payload(self.model_dump(mode="json")) diff --git a/packages/types/openadapt_types/schemas/reward-contract-v1.json b/packages/types/openadapt_types/schemas/reward-contract-v1.json index 3dcda5b92f..2d65305d63 100644 --- a/packages/types/openadapt_types/schemas/reward-contract-v1.json +++ b/packages/types/openadapt_types/schemas/reward-contract-v1.json @@ -113,10 +113,10 @@ }, "RewardScoringPolicyV1": { "additionalProperties": false, - "description": "How each scoring class becomes a scalar.\n\nUncertain episodes and platform failures are fixed to ``unscored`` in\nthis version. A contract cannot declare them to be zero.\n\n``escalated_after_effect_reward`` is the credit for an episode that did\nthe work and then asked a person instead of declaring it done. It sets\nthe confidence a policy needs before it declares done rather than asks:\nwith verified reward ``v``, wrong-effect reward ``w`` and this value\n``x``, declaring done pays more in expectation only when the policy is\nmore than ``(x - w) / (v - w)`` sure the effect is right. With the\ndefaults (1, -1, 0.5) that is 75%. Zero gives no credit for asking; a\nvalue at or above the verified reward is refused, because asking would\nthen pay as much as finishing.", + "description": "How each scoring class becomes a scalar.\n\nUncertain episodes and platform failures are fixed to ``unscored`` in\nthis version. A contract cannot declare them to be zero.\n\n``escalated_after_effect_reward`` is the credit for an episode that did\nthe work and then asked a person instead of declaring it done. It sets\nthe confidence a policy needs before it declares done rather than asks:\nwith verified reward ``v``, wrong-effect reward ``w`` and this value\n``x``, declaring done pays more in expectation only when the policy is\nmore than ``(x - w) / (v - w)`` sure the effect is right. With\n``v = 1``, ``w = -1`` and ``x = 0.5`` that is 75%. The default is zero:\na contract that doesn't declare it gives no credit for asking, so a\ncontract certified before this outcome existed never starts paying for\nit. The value is at least 0 and below 1; a value at or above the\nverified reward is refused too, because asking would then pay as much as\nfinishing.", "properties": { "escalated_after_effect_reward": { - "default": 0.5, + "default": 0.0, "exclusiveMaximum": 1.0, "minimum": 0.0, "title": "Escalated After Effect Reward", diff --git a/packages/types/pyproject.toml b/packages/types/pyproject.toml index 00ee930196..0b5ae956bc 100644 --- a/packages/types/pyproject.toml +++ b/packages/types/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "openadapt-types" -version = "0.24.1" +version = "0.24.2" description = "Pydantic models for computer-use agents: screen state (ComputerState, UINode), actions (Action), and results (ActionResult)" readme = "README.md" license = "MIT" diff --git a/packages/types/tests/fixtures/reward_issued_0_24_0.json b/packages/types/tests/fixtures/reward_issued_0_24_0.json new file mode 100644 index 0000000000..d5c97fa3dc --- /dev/null +++ b/packages/types/tests/fixtures/reward_issued_0_24_0.json @@ -0,0 +1,227 @@ +{ + "cases": [ + { + "certificate": { + "calibration_corpus_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "calibration_scope": "synthetic", + "certificate_id": "reward.certificate.default", + "checker_configuration_digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "delta": 0.05, + "epsilon": 0.0114, + "expiry_policy_updates": 50, + "issued_at": "2026-09-01T12:00:00Z", + "issued_at_policy_update": 100, + "issuer": "self_signed", + "issuer_key_id": "key.reference.0001", + "reward_contract_digest": "sha256:15844d27bd5d12fe71868b2753a31292c676f878dc379562956176fea8e5246c", + "schema_version": "openadapt.reward-certificate/v1", + "signature": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "signature_algorithm": "ed25519", + "threshold": 0.5 + }, + "certificate_digest": "sha256:08f3123efd5a42a90993d5ab34d10b9adcea8accc449f4d260e5d9b5887b9e40", + "certificate_state_at_update_120": "current", + "contract": { + "certificate_policy": { + "calibration_corpus_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "delta": 0.05, + "epsilon": 0.0114, + "expiry_policy_updates": 50, + "threshold": 0.5 + }, + "components": [ + { + "name": "halt_on_uncertainty", + "weight": 0.25 + }, + { + "name": "terminal_effect", + "weight": 1.0 + } + ], + "contract_id": "reward.contract.default", + "contract_version": "reward.contract.default.v1", + "environment_digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "environment_id": "environment.local.0001", + "forbidden_effect_contract_digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "oracle": { + "channel": "file", + "identity_keys": [ + "record_id" + ], + "oracle_contract_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "required_effect_contract_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "schema_version": "openadapt.reward-contract/v1", + "scoring": { + "halted_before_effect_reward": 0.0, + "platform_failures": "unscored", + "refused_reward": 0.0, + "rejected_policy_reward": 0.0, + "uncertain_episodes": "unscored", + "verified_reward": 1.0, + "wrong_effect_reward": -1.0 + }, + "task_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "task_id": "task.reference.0001" + }, + "contract_digest": "sha256:15844d27bd5d12fe71868b2753a31292c676f878dc379562956176fea8e5246c", + "scores_tier_2_update_120": { + "failed_platform": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": null + }, + "halted_before_effect": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 0.0 + }, + "reconciliation_required": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": null + }, + "refused": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 0.0 + }, + "rejected_policy": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 0.0 + }, + "verified": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 1.0 + }, + "wrong_effect": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": -1.0 + } + } + }, + { + "certificate": { + "calibration_corpus_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "calibration_scope": "synthetic", + "certificate_id": "reward.certificate.low-verified", + "checker_configuration_digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "delta": 0.05, + "epsilon": 0.0114, + "expiry_policy_updates": 50, + "issued_at": "2026-09-01T12:00:00Z", + "issued_at_policy_update": 100, + "issuer": "self_signed", + "issuer_key_id": "key.reference.0001", + "reward_contract_digest": "sha256:7ed7ab3a5f17daa0ed06d77e59e21d1fbdd306d1e0cb0c2e16380dd779884650", + "schema_version": "openadapt.reward-certificate/v1", + "signature": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "signature_algorithm": "ed25519", + "threshold": 0.5 + }, + "certificate_digest": "sha256:31e200581cd5cb5866affc5f847557b7d4235b198eeb2c1fddb78edf24715d89", + "certificate_state_at_update_120": "current", + "contract": { + "certificate_policy": { + "calibration_corpus_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "delta": 0.05, + "epsilon": 0.0114, + "expiry_policy_updates": 50, + "threshold": 0.5 + }, + "components": [ + { + "name": "halt_on_uncertainty", + "weight": 0.25 + }, + { + "name": "terminal_effect", + "weight": 1.0 + } + ], + "contract_id": "reward.contract.low-verified", + "contract_version": "reward.contract.low-verified.v1", + "environment_digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "environment_id": "environment.local.0001", + "forbidden_effect_contract_digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "oracle": { + "channel": "file", + "identity_keys": [ + "record_id" + ], + "oracle_contract_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "required_effect_contract_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "schema_version": "openadapt.reward-contract/v1", + "scoring": { + "halted_before_effect_reward": 0.0, + "platform_failures": "unscored", + "refused_reward": 0.0, + "rejected_policy_reward": 0.0, + "uncertain_episodes": "unscored", + "verified_reward": 0.5, + "wrong_effect_reward": -1.0 + }, + "task_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "task_id": "task.reference.0001" + }, + "contract_digest": "sha256:7ed7ab3a5f17daa0ed06d77e59e21d1fbdd306d1e0cb0c2e16380dd779884650", + "scores_tier_2_update_120": { + "failed_platform": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": null + }, + "halted_before_effect": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 0.0 + }, + "reconciliation_required": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": null + }, + "refused": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 0.0 + }, + "rejected_policy": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 0.0 + }, + "verified": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": 0.5 + }, + "wrong_effect": { + "certification_refusals": [], + "certified": true, + "development_only": false, + "scalar": -1.0 + } + } + } + ], + "issued_with": "openadapt-types 0.24.0 from PyPI" +} diff --git a/packages/types/tests/test_reward.py b/packages/types/tests/test_reward.py index b578b6db11..2b55abcc4f 100644 --- a/packages/types/tests/test_reward.py +++ b/packages/types/tests/test_reward.py @@ -4,6 +4,7 @@ import json from importlib.resources import files +from pathlib import Path import pytest from pydantic import ValidationError @@ -42,7 +43,7 @@ # Pinned once from the payload below. A change here means the canonical form # changed, which breaks every digest a consumer has stored. _PINNED_CONTRACT_DIGEST = ( - "sha256:52eb5a011dabede8b11fdef0da7b0d34ee52a33e3ca9a231e075ff51f67a84ea" + "sha256:4dd42acff78802d1815798dfe04b95fe27847b972d348dcdafa7bbabc5d6be15" ) @@ -704,7 +705,7 @@ def test_default_scalar_for_each_scored_outcome() -> None: contract = _contract() expected = { RewardOutcomeV1.VERIFIED: 1.0, - RewardOutcomeV1.ESCALATED_AFTER_EFFECT: 0.5, + RewardOutcomeV1.ESCALATED_AFTER_EFFECT: 0.0, RewardOutcomeV1.HALTED_BEFORE_EFFECT: 0.0, RewardOutcomeV1.REFUSED: 0.0, RewardOutcomeV1.REJECTED_POLICY: 0.0, @@ -736,18 +737,86 @@ def test_escalated_after_effect_reward_out_of_range_is_refused(value: float) -> def test_escalated_after_effect_reward_must_stay_below_verified() -> None: with pytest.raises(ValidationError, match="below verified_reward"): - _contract_with_scoring(verified_reward=0.5, escalated_after_effect_reward=0.5) + _contract_with_scoring(verified_reward=0.5, escalated_after_effect_reward=0.6) contract = _contract_with_scoring( verified_reward=0.8, escalated_after_effect_reward=0.4 ) assert contract.scoring.escalated_after_effect_reward == 0.4 +def test_an_undeclared_escalation_earns_nothing() -> None: + # A contract written without the field never pays for the new outcome. + escalated = RewardOutcomeV1.ESCALATED_AFTER_EFFECT + assert _contract().scoring.escalated_after_effect_reward == 0.0 + assert _contract().scoring.scalar_for(escalated) == 0.0 + # 0.24.0 accepted any positive verified_reward; 0.24.1 still does. + low = _contract_with_scoring(verified_reward=0.5) + assert low.scoring.scalar_for(escalated) == 0.0 + declared = _contract_with_scoring(escalated_after_effect_reward=0.25) + assert declared.scoring.escalated_after_effect_credit == 0.25 + assert declared.scoring.scalar_for(escalated) == 0.25 + with pytest.raises(ValidationError, match="below verified_reward"): + _contract_with_scoring(verified_reward=0.5, escalated_after_effect_reward=0.5) + + +_ISSUED_0_24_0 = Path(__file__).parent / "fixtures" / "reward_issued_0_24_0.json" + + +@pytest.mark.parametrize( + "case", + json.loads(_ISSUED_0_24_0.read_text(encoding="utf-8"))["cases"], + ids=lambda case: case["contract"]["contract_id"], +) +def test_contracts_and_certificates_issued_under_0_24_0_verify_unchanged( + case: dict[str, object], +) -> None: + """Contracts and certificates openadapt-types 0.24.0 issued (from PyPI). + + A patch release must not move a stored digest: each one parses, hashes + to the digest 0.24.0 computed, and its certificate still binds it. + """ + + contract = RewardContractV1.model_validate(case["contract"]) + certificate = RewardCertificateV1.model_validate(case["certificate"]) + assert contract.digest == case["contract_digest"] + assert certificate.digest == case["certificate_digest"] + assert certificate.reward_contract_digest == contract.digest + assert ( + certificate_state(certificate, 120).value + == case["certificate_state_at_update_120"] + ) + # Every outcome 0.24.0 knew scores as it did, and the one it didn't + # earns nothing under a contract that never declared it. + for outcome, expected in case["scores_tier_2_update_120"].items(): + scored = score(RewardOutcomeV1(outcome), 2, certificate, 120, contract=contract) + assert scored.scalar == expected["scalar"], outcome + assert scored.certified == expected["certified"], outcome + assert scored.development_only == expected["development_only"], outcome + assert list(scored.certification_refusals) == ( + expected["certification_refusals"] + ), outcome + escalated = score( + RewardOutcomeV1.ESCALATED_AFTER_EFFECT, 2, certificate, 120, contract=contract + ) + assert escalated.scalar == 0.0 + + +def test_a_default_contract_serializes_as_0_24_0_did() -> None: + # 0.24.0 forbids unknown fields, so a file this version writes must not + # carry the new field at its default. + case = json.loads(_ISSUED_0_24_0.read_text(encoding="utf-8"))["cases"][0] + contract = RewardContractV1.model_validate(case["contract"]) + assert contract.model_dump(mode="json") == case["contract"] + assert "escalated_after_effect_reward" not in contract.scoring.model_dump() + custom = _contract_with_scoring(escalated_after_effect_reward=0.25) + assert custom.scoring.model_dump()["escalated_after_effect_reward"] == 0.25 + + def test_escalated_after_effect_reward_is_part_of_the_contract_digest() -> None: - half = _contract_with_scoring(escalated_after_effect_reward=0.5) + zero = _contract_with_scoring(escalated_after_effect_reward=0.0) quarter = _contract_with_scoring(escalated_after_effect_reward=0.25) - assert half.digest == _contract().digest - assert quarter.digest != half.digest + assert zero.digest == _contract().digest + assert quarter.digest != zero.digest def test_receipt_partial_credit_is_never_negative_or_uncertain() -> None: diff --git a/packages/types/uv.lock b/packages/types/uv.lock index e477b27312..84e833960a 100644 --- a/packages/types/uv.lock +++ b/packages/types/uv.lock @@ -346,7 +346,7 @@ wheels = [ [[package]] name = "openadapt-types" -version = "0.24.1" +version = "0.24.2" source = { editable = "." } dependencies = [ { name = "pydantic" }, diff --git a/packages/verify/CHANGELOG.md b/packages/verify/CHANGELOG.md index cfd62ae739..ec1eeac43b 100644 --- a/packages/verify/CHANGELOG.md +++ b/packages/verify/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## v0.2.1 (2026-11-22) + +- Accept openadapt-flow 4: the openadapt-flow requirement and the `openai`, + `claude` and `mcp` extras now allow `<5` (was `<4`), so openadapt-verify + installs beside the next Flow major instead of holding Flow at 3.x + (#2535). + ## v0.2.0 (2026-11-14) ### Install without the vision stack diff --git a/packages/verify/pyproject.toml b/packages/verify/pyproject.toml index 373d63930c..e86f2c4729 100644 --- a/packages/verify/pyproject.toml +++ b/packages/verify/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "openadapt-verify" -version = "0.2.0" +version = "0.2.1" description = "Verify an agent's writes through an independent system-of-record read path" readme = "README.md" requires-python = ">=3.10,<3.13" @@ -13,7 +13,7 @@ license = "MIT" # the vision stack (NumPy, OpenCV, Pillow, RapidOCR), which is Flow's `vision` # extra. tests/test_import_boundary.py proves the verify path never imports it. dependencies = [ - "openadapt-flow[receipts]>=3.0.0,<4", + "openadapt-flow[receipts]>=3.0.0,<5", "cryptography>=50.0.0", ] @@ -24,9 +24,9 @@ dependencies = [ # yourself for a PostgreSQL read path. mysql = ["PyMySQL>=1.1,<2"] # Agent frameworks. Each extra is only that framework's SDK. -openai = ["openadapt-flow[openai-agents]>=3.0.0,<4"] -claude = ["openadapt-flow[claude-agent-sdk]>=3.0.0,<4"] -mcp = ["openadapt-flow[agent]>=3.0.0,<4"] +openai = ["openadapt-flow[openai-agents]>=3.0.0,<5"] +claude = ["openadapt-flow[claude-agent-sdk]>=3.0.0,<5"] +mcp = ["openadapt-flow[agent]>=3.0.0,<5"] dev = ["pytest>=8", "ruff>=0.4", "mypy>=1.10", "build>=1.2"] [project.scripts] @@ -78,7 +78,7 @@ ignore_missing_imports = true # package never use, so the overrides also keep it out of the lock (a marker # no environment matches). override-dependencies = [ - "openadapt-flow[receipts,agent,openai-agents,claude-agent-sdk]>=2.6.0,<4", + "openadapt-flow[receipts,agent,openai-agents,claude-agent-sdk]>=2.6.0,<5", "numpy; python_version < '3'", "opencv-python; python_version < '3'", "pillow; python_version < '3'", diff --git a/packages/verify/scripts/check_distribution.py b/packages/verify/scripts/check_distribution.py index 5085542e6c..5edb85d23e 100644 --- a/packages/verify/scripts/check_distribution.py +++ b/packages/verify/scripts/check_distribution.py @@ -75,7 +75,7 @@ def check(dist: Path, root: Path) -> dict: if requirement.marker is None } assert base["openadapt-flow"].extras == {"receipts"} - assert base["openadapt-flow"].specifier == SpecifierSet(">=3.0.0,<4") + assert base["openadapt-flow"].specifier == SpecifierSet(">=3.0.0,<5") assert base["cryptography"].specifier == SpecifierSet(">=50.0.0") # Flow 3's base install has no vision stack; nothing here adds one. assert set(base) == {"openadapt-flow", "cryptography"}, set(base) diff --git a/packages/verify/src/openadapt_verify/__init__.py b/packages/verify/src/openadapt_verify/__init__.py index 5fb1d8a7a0..f718907963 100644 --- a/packages/verify/src/openadapt_verify/__init__.py +++ b/packages/verify/src/openadapt_verify/__init__.py @@ -27,7 +27,7 @@ from openadapt_verify.guard import checked_write, verified -__version__ = "0.2.0" +__version__ = "0.2.1" __all__ = [ "Actor", diff --git a/packages/verify/uv.lock b/packages/verify/uv.lock index ad39d6f1a6..0f77a336aa 100644 --- a/packages/verify/uv.lock +++ b/packages/verify/uv.lock @@ -18,7 +18,7 @@ required-markers = [ [manifest] overrides = [ { name = "numpy", marker = "python_full_version < '3'" }, - { name = "openadapt-flow", extras = ["receipts", "agent", "openai-agents", "claude-agent-sdk"], specifier = ">=2.6.0,<4" }, + { name = "openadapt-flow", extras = ["receipts", "agent", "openai-agents", "claude-agent-sdk"], specifier = ">=2.6.0,<5" }, { name = "opencv-python", marker = "python_full_version < '3'" }, { name = "pillow", marker = "python_full_version < '3'" }, { name = "rapidocr-onnxruntime", marker = "python_full_version < '3'" }, @@ -853,7 +853,7 @@ wheels = [ [[package]] name = "openadapt-verify" -version = "0.2.0" +version = "0.2.1" source = { editable = "." } dependencies = [ { name = "cryptography" }, @@ -885,10 +885,10 @@ requires-dist = [ { name = "build", marker = "extra == 'dev'", specifier = ">=1.2" }, { name = "cryptography", specifier = ">=50.0.0" }, { name = "mypy", marker = "extra == 'dev'", specifier = ">=1.10" }, - { name = "openadapt-flow", extras = ["agent"], marker = "extra == 'mcp'", specifier = ">=3.0.0,<4" }, - { name = "openadapt-flow", extras = ["claude-agent-sdk"], marker = "extra == 'claude'", specifier = ">=3.0.0,<4" }, - { name = "openadapt-flow", extras = ["openai-agents"], marker = "extra == 'openai'", specifier = ">=3.0.0,<4" }, - { name = "openadapt-flow", extras = ["receipts"], specifier = ">=3.0.0,<4" }, + { name = "openadapt-flow", extras = ["agent"], marker = "extra == 'mcp'", specifier = ">=3.0.0,<5" }, + { name = "openadapt-flow", extras = ["claude-agent-sdk"], marker = "extra == 'claude'", specifier = ">=3.0.0,<5" }, + { name = "openadapt-flow", extras = ["openai-agents"], marker = "extra == 'openai'", specifier = ">=3.0.0,<5" }, + { name = "openadapt-flow", extras = ["receipts"], specifier = ">=3.0.0,<5" }, { name = "pymysql", marker = "extra == 'mysql'", specifier = ">=1.1,<2" }, { name = "pytest", marker = "extra == 'dev'", specifier = ">=8" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.4" }, diff --git a/platform-manifest.json b/platform-manifest.json index 8d8881fe95..665be1f848 100644 --- a/platform-manifest.json +++ b/platform-manifest.json @@ -1,7 +1,7 @@ { "manifest_kind": "openadapt-platform-release-manifest", "schema_version": "2.0.0", - "generated_at": "2026-11-19T21:28:04+00:00", + "generated_at": "2026-11-22T12:49:07+00:00", "generation": { "files": [ { @@ -1171,7 +1171,7 @@ ">=0.1.0" ], "openadapt-flow": [ - ">=3.3.0,<4.0.0" + ">=3.3.0,<5.0.0" ], "openadapt-grounding": [ ">=0.1.0" diff --git a/pyproject.toml b/pyproject.toml index c94a17552d..0e9dc01e03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,7 @@ dependencies = [ # (tests/test_flow_floor.py). Flow 3 # moved its vision stack to the `vision` extra; its `browser` and other # surface extras include it, and the `flow` extra below names it. - "openadapt-flow[browser,hosted]>=3.3.0,<4.0.0; python_version < '3.13'", + "openadapt-flow[browser,hosted]>=3.3.0,<5.0.0; python_version < '3.13'", # Day-1 partner kit: `pip install openadapt` must expose the # `openadapt-agent` command without a second package. 2.1.0 adds Seal checks; # `--bundles`; the bundle-free tutorial `serve --allow-run` needs a later @@ -94,7 +94,7 @@ browser = [ # launcher now selects this Flow contract because the bundled quickstart # uses the browser. OpenAdapt requests Chromium on first browser use after # the host dependency check passes. - "openadapt-flow[browser]>=3.3.0,<4.0.0; python_version < '3.13'", + "openadapt-flow[browser]>=3.3.0,<5.0.0; python_version < '3.13'", ] # Local human desktop recording. Flow owns the supported capture adapter # contract; the direct floor prevents an already-installed pre-1.0 Capture @@ -102,22 +102,22 @@ browser = [ # separately provisioned executable, not a Python-package dependency. capture = [ "openadapt-capture>=1.2.0,<2.0.0", - "openadapt-flow[capture]>=3.3.0,<4.0.0; python_version < '3.13'", + "openadapt-flow[capture]>=3.3.0,<5.0.0; python_version < '3.13'", ] # Replay substrate dependencies stay separate from capture: recording observes # the human on the local interactive desktop, while replay may target a WAA # agent, a native app, or a remote framebuffer. windows = [ - "openadapt-flow[windows]>=3.3.0,<4.0.0; python_version < '3.13'", + "openadapt-flow[windows]>=3.3.0,<5.0.0; python_version < '3.13'", ] macos = [ - "openadapt-flow[macos]>=3.3.0,<4.0.0; sys_platform == 'darwin' and python_version < '3.13'", + "openadapt-flow[macos]>=3.3.0,<5.0.0; sys_platform == 'darwin' and python_version < '3.13'", ] linux = [ - "openadapt-flow[linux]>=3.3.0,<4.0.0; sys_platform == 'linux' and python_version < '3.13'", + "openadapt-flow[linux]>=3.3.0,<5.0.0; sys_platform == 'linux' and python_version < '3.13'", ] rdp = [ - "openadapt-flow[rdp]>=3.3.0,<4.0.0; python_version < '3.13'", + "openadapt-flow[rdp]>=3.3.0,<5.0.0; python_version < '3.13'", ] ml = [ "openadapt-ml>=0.2.0", @@ -135,13 +135,13 @@ retrieval = [ "openadapt-retrieval>=0.1.0", ] privacy = [ - "openadapt-flow[privacy]>=3.3.0,<4.0.0; python_version < '3.13'", + "openadapt-flow[privacy]>=3.3.0,<5.0.0; python_version < '3.13'", ] # `flow` now ships in the base install (see `dependencies` above). This # extra is kept for backward compatibility so `pip install openadapt[flow]` # and the `all` bundle still resolve. flow = [ - "openadapt-flow[vision]>=3.3.0,<4.0.0; python_version < '3.13'", + "openadapt-flow[vision]>=3.3.0,<5.0.0; python_version < '3.13'", ] # `openadapt-agent` also ships in the base install. Keep the extra so # `pip install openadapt[agent]` still resolves. diff --git a/tests/test_cli_smoke.py b/tests/test_cli_smoke.py index 9a69fe6785..14b357cc7e 100644 --- a/tests/test_cli_smoke.py +++ b/tests/test_cli_smoke.py @@ -391,29 +391,29 @@ def test_launcher_flow_and_substrate_extras_metadata(): assert ( metadata["dependencies"].count( - f"openadapt-flow[browser,hosted]>=3.3.0,<4.0.0; {supported}" + f"openadapt-flow[browser,hosted]>=3.3.0,<5.0.0; {supported}" ) == 1 ) assert ( metadata["dependencies"].count(f"openadapt-agent>=2.1.0,<3; {supported}") == 1 ) - assert extras["flow"] == [f"openadapt-flow[vision]>=3.3.0,<4.0.0; {supported}"] + assert extras["flow"] == [f"openadapt-flow[vision]>=3.3.0,<5.0.0; {supported}"] assert extras["agent"] == [f"openadapt-agent>=2.1.0,<3; {supported}"] - assert extras["browser"] == [f"openadapt-flow[browser]>=3.3.0,<4.0.0; {supported}"] - assert extras["privacy"] == [f"openadapt-flow[privacy]>=3.3.0,<4.0.0; {supported}"] + assert extras["browser"] == [f"openadapt-flow[browser]>=3.3.0,<5.0.0; {supported}"] + assert extras["privacy"] == [f"openadapt-flow[privacy]>=3.3.0,<5.0.0; {supported}"] assert extras["capture"] == [ "openadapt-capture>=1.2.0,<2.0.0", - f"openadapt-flow[capture]>=3.3.0,<4.0.0; {supported}", + f"openadapt-flow[capture]>=3.3.0,<5.0.0; {supported}", ] - assert extras["windows"] == [f"openadapt-flow[windows]>=3.3.0,<4.0.0; {supported}"] + assert extras["windows"] == [f"openadapt-flow[windows]>=3.3.0,<5.0.0; {supported}"] assert extras["macos"] == [ - f"openadapt-flow[macos]>=3.3.0,<4.0.0; sys_platform == 'darwin' and {supported}" + f"openadapt-flow[macos]>=3.3.0,<5.0.0; sys_platform == 'darwin' and {supported}" ] assert extras["linux"] == [ - f"openadapt-flow[linux]>=3.3.0,<4.0.0; sys_platform == 'linux' and {supported}" + f"openadapt-flow[linux]>=3.3.0,<5.0.0; sys_platform == 'linux' and {supported}" ] - assert extras["rdp"] == [f"openadapt-flow[rdp]>=3.3.0,<4.0.0; {supported}"] + assert extras["rdp"] == [f"openadapt-flow[rdp]>=3.3.0,<5.0.0; {supported}"] assert extras["all"] == [ "openadapt[browser,core,grounding,retrieval,privacy,flow,windows,rdp,agent]", "openadapt[macos]; sys_platform == 'darwin'", @@ -451,7 +451,7 @@ def test_launcher_accepts_flow_versions_in_the_supported_range(version): @pytest.mark.parametrize( "version", - ["1.28.9", "1.35.1", "2.1.0", "2.7.1", "3.1.0", "3.2.1", "4.0.0", "invalid"], + ["1.28.9", "1.35.1", "2.1.0", "2.7.1", "3.1.0", "3.2.1", "5.0.0", "invalid"], ) def test_launcher_rejects_flow_versions_outside_the_supported_range(version): assert not _supported_flow_version(version) @@ -824,7 +824,7 @@ def test_deploy_preflight_fails_without_rdp_transport(monkeypatch): @pytest.mark.parametrize( - "flow_version", ["1.35.1", "2.1.0", "4.0.0", "4.1.0", "invalid"] + "flow_version", ["1.35.1", "2.1.0", "5.0.0", "5.1.0", "invalid"] ) def test_deploy_preflight_fails_for_unsupported_flow(monkeypatch, flow_version): monkeypatch.setattr("importlib.util.find_spec", lambda _name: object()) @@ -834,7 +834,7 @@ def test_deploy_preflight_fails_for_unsupported_flow(monkeypatch, flow_version): assert result.exit_code != 0 assert "[UNSUPPORTED]" in result.output - assert ">=3.3.0,<4.0.0" in result.output + assert ">=3.3.0,<5.0.0" in result.output assert "Preflight passed" not in result.output diff --git a/tests/test_flow_floor.py b/tests/test_flow_floor.py index f0561c6759..2a3ee72812 100644 --- a/tests/test_flow_floor.py +++ b/tests/test_flow_floor.py @@ -87,6 +87,7 @@ def test_doctor_and_deploy_accept_the_fixed_release() -> None: assert Requirement(f"openadapt-flow{_SUPPORTED_FLOW_RANGE}").specifier.contains( ACCEPTED ) - # Later Flow 3 releases are accepted; 4 is unknown. + # Later Flow 3 and Flow 4 releases are accepted; 5 is unknown. assert _supported_flow_version("3.99.0") - assert not _supported_flow_version("4.0.0") + assert _supported_flow_version("4.0.0") + assert not _supported_flow_version("5.0.0") diff --git a/uv.lock b/uv.lock index d3b54a112c..23db188f6a 100644 --- a/uv.lock +++ b/uv.lock @@ -3463,15 +3463,15 @@ requires-dist = [ { name = "openadapt-agent", marker = "python_full_version < '3.13' and extra == 'agent'", specifier = ">=2.1.0,<3" }, { name = "openadapt-capture", marker = "extra == 'capture'", specifier = ">=1.2.0,<2.0.0" }, { name = "openadapt-evals", marker = "extra == 'evals'", specifier = ">=0.1.0" }, - { name = "openadapt-flow", extras = ["browser"], marker = "python_full_version < '3.13' and extra == 'browser'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["browser", "hosted"], marker = "python_full_version < '3.13'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["capture"], marker = "python_full_version < '3.13' and extra == 'capture'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["linux"], marker = "python_full_version < '3.13' and sys_platform == 'linux' and extra == 'linux'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["macos"], marker = "python_full_version < '3.13' and sys_platform == 'darwin' and extra == 'macos'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["privacy"], marker = "python_full_version < '3.13' and extra == 'privacy'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["rdp"], marker = "python_full_version < '3.13' and extra == 'rdp'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["vision"], marker = "python_full_version < '3.13' and extra == 'flow'", specifier = ">=3.3.0,<4.0.0" }, - { name = "openadapt-flow", extras = ["windows"], marker = "python_full_version < '3.13' and extra == 'windows'", specifier = ">=3.3.0,<4.0.0" }, + { name = "openadapt-flow", extras = ["browser"], marker = "python_full_version < '3.13' and extra == 'browser'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["browser", "hosted"], marker = "python_full_version < '3.13'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["capture"], marker = "python_full_version < '3.13' and extra == 'capture'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["linux"], marker = "python_full_version < '3.13' and sys_platform == 'linux' and extra == 'linux'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["macos"], marker = "python_full_version < '3.13' and sys_platform == 'darwin' and extra == 'macos'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["privacy"], marker = "python_full_version < '3.13' and extra == 'privacy'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["rdp"], marker = "python_full_version < '3.13' and extra == 'rdp'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["vision"], marker = "python_full_version < '3.13' and extra == 'flow'", specifier = ">=3.3.0,<5.0.0" }, + { name = "openadapt-flow", extras = ["windows"], marker = "python_full_version < '3.13' and extra == 'windows'", specifier = ">=3.3.0,<5.0.0" }, { name = "openadapt-grounding", marker = "extra == 'grounding'", specifier = ">=0.1.0" }, { name = "openadapt-ml", marker = "extra == 'ml'", specifier = ">=0.2.0" }, { name = "openadapt-retrieval", marker = "extra == 'retrieval'", specifier = ">=0.1.0" },