Skip to content

fix(flow): fail closed on remote model calls, egress counting and transport - #2497

Open
abrichr wants to merge 31 commits into
mainfrom
claude/model-failclosed
Open

abrichr wants to merge 31 commits into
mainfrom
claude/model-failclosed

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Fixes the seven fail-open findings from the remote-model review (on main 576f87b). tests/test_model_failclosed.py reproduces each one; those tests failed on main and pass here.

What changes

  1. Drift oracle. A model "yes" no longer clears a failed postcondition, including on read-only and navigation steps. The step halts for a person, and the "yes" is recorded on postcondition_drift_rescues as a hint. The three tests/test_drift_oracle.py tests that pinned the old rescue now check the opposite.
  2. Unmarked components. A component with no MAY_EGRESS marker counts as egress and needs allow_model_grounding. MLXIdentityVLM is marked MAY_EGRESS = False.
  3. Model-call counts by placement. The replayer wraps the grounder, the identity VLM and the state verifier (runtime/model_egress.py).
    • Off-box identity-VLM calls and off-box grounder calls, abstentions and failed or halted steps included, go into model_calls.
    • In-process calls go into local_model_calls.
    • The receipt rule now lives in model_call_evidence.py: off-box calls require external_network_calls == "observed", and in-process calls never do. The run-receipt/v2 wire format is unchanged; in-process calls stay on the run report and are not added to the receipt.
  4. VLM service. The service passes VLM_VLLM_URL (cfg.vllm_url) to VLLMBackend.
  5. Regulated transport. Under the regulated profile, read from the authorization or from runtime.profile, the runner wires an appliance or a grounding model only over https or over loopback http (model_transport.py). It checks the URL the built client actually sends to, so a client library that reads its URL from its own environment can't get around the check.
  6. No fallback. A pinned grounding model that can't be wired never falls back to the appliance. An empty grounding_model.model is refused instead of becoming _DEFAULT_MODEL.
  7. Egress ledger. Before each off-box call the runner appends a line to egress-ledger.jsonl beside the run directory: hashes and sizes only, append-only, mode 0600, fsynced. If the line can't be written, or no run or OPENADAPT_FLOW_EGRESS_LEDGER names a ledger, the frame is not sent. Halted runs are on the ledger too.

Budgets: none raised. replayer.py is lowered to 19217 and ir.py to 6829. New code is in model_egress.py, model_transport.py and model_call_evidence.py. CAPABILITIES.md and llms-full.txt are updated.

Commits and fail-open class

The commits up to 8b0c712 were pushed before the tagging rule applied, and the branch can't be force-pushed, so their classes are listed here.

Commit Fail-open class
6a5a08a, f0078d6, edbe4a6 tests (reproductions)
7675ad7 unmarked component treated as local
b583ff1 unreported egress (identity-VLM and abstaining grounder calls not counted; no ledger)
8972556 model answer turns a failed check into a pass
a873de8 misdirected model endpoint (vLLM URL ignored)
74fe91b cleartext off-box transport; silent model fallback
db1f3e5, 8b0c712 tests, docs
0b70133, d872a91 none (refactor to stay within the ir.py budget)
bede781 silent model fallback (empty model); transport check bypass
7c770d3 unreported egress (receipt rule split by placement)
ae517cf misattributed model calls (a raised step's counts carried into the next run)
94cf681 transport check bypass (client URL taken from the environment), from the Gemini review
5ed33ba unledgered egress (replayer driven outside a run), from the Gemini review
916e42b, d10be25, a57af17, e565505 none (docs)

| 45a0b3a | none (correctness: the ledger opens as a binary descriptor, so Windows writes no CRLF) |

| fbbea65 | none (test: the in-process fuzz grounder stub is marked local) |

Fail-open class: unknown-treated-as-safe.

component_may_egress read a missing marker as local, so an unmarked
grounder, identity VLM or state verifier was wired without the egress
opt-in. Only an explicit MAY_EGRESS = False is local now, as in
seal_batch. MLXIdentityVLM runs in process and is marked False.
…ff-box frames

Fail-open classes: uncounted-egress, unrecorded-egress.

The identity VLM's calls were never counted, so a loopback web run whose
identity crops went to an appliance reported external_network_calls
"none". A remote grounder call counted only on a step that passed.

runtime/model_egress.py wraps each model component the replayer is
given. Before an off-box call it appends a line (frame SHA-256 and size,
component, destination host, run, step, time; no pixels or text) to an
append-only, fsynced, 0600 ledger beside the run directory
(OPENADAPT_FLOW_EGRESS_LEDGER overrides). If the line can't be written
the call isn't made and the component gives its fail-safe answer. Calls
are counted onto the StepResult by placement: off-box identity-VLM and
grounder calls go into model_calls, in-process identity-VLM calls into
local_model_calls. The new StepResult fields are omitted from JSON when
zero, so existing reports and receipts keep their bytes.
Fail-open class: model-verdict-overrides-deterministic-refutation.

On read-only and navigation steps a state-verifier "yes" cleared a
failed text_present or region_stable postcondition. Now every failed
postcondition stays failed and the step halts for a person; the yes is
recorded on postcondition_drift_rescues (field kept for compatibility)
and printed as a hint. The three tests that pinned the rescue now pin
the halt.
Fail-open class: config-silently-ignored.

create_app built the vLLM backend without cfg.vllm_url, so it always
sent frames to localhost:8000 whatever the operator configured.
…lback from a pinned model

Fail-open classes: cleartext-phi-warned-not-refused,
weaker-fallback-on-unavailable.

Under the regulated profile an appliance (or grounding_model base_url)
over http to a non-loopback host is now not wired; only https, or http
to loopback, is allowed. When a grounding model is pinned and can't be
wired (unavailable or refused) the appliance grounder no longer stands
in for it: the grounding rung stays off and an unresolved target halts
for a person.
…no-fallback rule

Fail-open classes: cleartext-phi-warned-not-refused, unrecorded-egress,
weaker-fallback-on-unavailable (documentation only).
…ts budget

Fail-open class: none (refactor). Inline the three counts, drop the extra
module that cost ir.py an import, regenerate the schema surface.
…rom either source

Fail-open class: silent model fallback (an empty grounding_model.model became
the shipped default) and transport check bypass (the regulated check read only
the authorization's profile and the env URL, not the URL the appliance client
sends to).
Fail-open class: unreported egress. Off-box model calls require observed
external calls on the receipt; in-process calls never do. The transport rule
moves down to the policy layer next to deployment.
Fail-open class: misattributed model calls. Counts from a step that raised
never land on the next run's first step. Tests pin the empty-model refusal,
the receipt placement split, and mark the resume test's verifier as remote.
…ty-model rules

Fail-open class: none (docs).
Fail-open class: none (docs).
Fail-open class: transport check bypass. The regulated and PHI checks read the
configured base_url, so an Anthropic client taking ANTHROPIC_BASE_URL from the
environment could send cleartext off the box. Found by the Gemini review.
Fail-open class: unledgered egress. A replayer driven outside run() sent
frames with no ledger line; now it sends only when OPENADAPT_FLOW_EGRESS_LEDGER
names a ledger. Found by the Gemini review.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: e565505

Gemini run on e565505 (gemini-3.1-pro-preview, sent the full diff against origin/main, excluding llms-full.txt and the regenerated schema fixture).

First round, on d10be25: REQUEST CHANGES, three blockers.

  1. Gemini said exclude_if is not a valid pydantic Field argument. Not changed: pydantic added exclude_if in 2.12, the lock files pin 2.12.5 and 2.13.4, and main already uses it 20 times. The schema-surface and serialization tests pass.
  2. EgressRecorder.admit let a frame be sent when no run had bound a ledger. Fixed in 5ed33ba: with no ledger bound and no OPENADAPT_FLOW_EGRESS_LEDGER, the frame is not sent.
  3. The regulated transport check was skipped when the configured base_url was empty, so a client that reads its URL from the environment (ANTHROPIC_BASE_URL) could send cleartext off the box. Fixed in 94cf681: the regulated and PHI checks read the URL the built client sends to.

First-round non-blocking note, not changed: drift-oracle calls always count as off-box, even for a local state verifier. That is the conservative direction, since it can only over-report egress.

Re-review, on e565505: APPROVE, no blockers and no non-blocking notes. Gemini found that admit now fails closed when no ledger is bound, that the transport check reads the URL the built client actually uses, and that the drift oracle's "yes" is only a hint and never clears a failed postcondition. It found the other fail-closed requirements met.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: e565505

Author declaration for this head. Claude wrote the changes on this branch.

Local checks on this head, single-process through the shared CPU slots:

  • tests/test_model_failclosed.py: 31 passed. These are the fail-open reproductions; they failed on main 576f87b.
  • 24 related flow suites passed: 700 passed, 5 skipped. They cover the drift oracle, BYO grounding, receipts, remote VLM, the VLM service, deployment wiring, the egress guard, PHI governance, schema surface, terminal verification v2, execution profiles, import direction, the connector and the replayer.
  • scripts/check_file_size_ratchet.py --base origin/main: no file grew. The replayer and ir budgets went down.
  • ruff check and ruff format: clean on every changed file.

Fail-open class: none (correctness). On Windows a plain os.open wrote CRLF into
the ledger; the binary-descriptor contract test caught it in CI.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 45a0b3a

Gemini run on 45a0b3a (gemini-3.1-pro-preview, sent the full diff against origin/main, excluding llms-full.txt and the regenerated schema fixture).

This is a head check after the earlier re-review on e565505, which approved. The only change since is 45a0b3a, a one-line fix: the egress ledger is now opened with private_file.open_binary instead of plain os.open, so Windows doesn't write CRLF. The Windows binary-descriptor contract test caught it in CI.

Verdict: APPROVE, no blockers and no non-blocking notes. Gemini found that the drift oracle's "yes" is only a hint and the step still halts for a person, that unmarked components count as egress, that every off-box frame is ledgered before it is sent, that calls are counted by placement, and that the regulated profile allows only TLS or loopback transport.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 45a0b3a

Author declaration for this head. Claude wrote the changes on this branch. The only change since the previous declaration (e565505) is 45a0b3a: the egress ledger is now opened with private_file.open_binary so Windows writes no CRLF.

Local checks at this head: tests/test_binary_file_descriptors.py, tests/test_model_failclosed.py and tests/test_import_direction.py pass (50). At e565505, 24 related flow suites passed (700 passed, 5 skipped).

Fail-open class: none (test). An unmarked grounder now counts as egress, so
the in-process fuzz stub declares MAY_EGRESS = False.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: fbbea65

Gemini run on fbbea65 (gemini-3.1-pro-preview, sent the full diff against origin/main, excluding llms-full.txt and the regenerated schema fixture).

This is a head check after 45a0b3a, which Gemini approved. The only change since is fbbea65, a test-only commit: the in-process FakeGrounder stub in tests/test_resolver_fuzz.py now declares MAY_EGRESS = False, because an unmarked grounder counts as egress.

Verdict: APPROVE, no blockers and no non-blocking notes. Gemini found that a model "yes" is only a hint and a failed postcondition always halts for a person, that unmarked components count as egress, that every off-box frame is ledgered before it is sent, that the regulated profile allows only loopback or TLS transport, and that an unavailable pinned model fails closed with no fallback.

Earlier rounds: REQUEST CHANGES on d10be25, with one blocker rejected with evidence and two fixed; then APPROVE on e565505 and 45a0b3a.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: fbbea65

Author declaration for this head. Claude wrote the changes on this branch. The only change since the previous declaration (45a0b3a) is fbbea65, a test-only commit: the in-process fuzz grounder stub declares MAY_EGRESS = False.

Local checks: a sweep of every test file that wires a grounder, identity VLM or state verifier into a Replayer, plus the import-layer, binary-descriptor and consumer-surface tests, gave 2311 passed. The one failure was in an e2e test that needs the mcp module, which the local environment doesn't have. tests/test_resolver_fuzz.py passes at this head (5). At e565505, 24 related flow suites passed (700 passed, 5 skipped).

# Conflicts:
#	packages/flow/docs/design/DECOMPOSITION.md
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 41c9bbe

Delta versus Gemini APPROVE at fbbea65afa13f349e4f123974a845da2d5023324 (request 7082912814). No prior Grok verdict at this head. I compared every unique file to that head and to current main, and I re-read the fail-closed tests and guards. I did not merge, tag, publish, or dispatch.

The unique fail-closed tree is unchanged: model_call_evidence.py, model_transport.py, model_egress.py, receipt.py, grounder.py, replayer.py, vlm_service/app.py, test_model_failclosed.py, and the other unique tests are byte-identical to fbbea65a. The main-merge delta is documentation and shared-file alignment only: CAPABILITIES.md and llms-full.txt picked up later main rows, DECOMPOSITION.md moved the ratchet numbers to main's 19229 / 14237, and deployment.py / ir.py / identity_vlm.py absorbed main's comment, schema (sibling_generic_hashes, already on main), and GOLD-crop updates. Unique versus current main, identity_vlm.py is still just the three-line egress change from this PR.

I checked that the fail-closed rules still hold in the unchanged unique tree: a ledger line is written before an off-box call; no bound ledger means no call; a regulated profile refuses cleartext non-loopback endpoints; a pinned model does not fall back; an unmarked component counts as egress; receipt wording splits in-process from off-box calls. test_model_failclosed.py still pins those cases.

No package version or lock change. This does not auto-publish. Launcher CI is red only on test_help_text_is_byte_identical for openadapt, which is the known #2421 / #2546 main issue; this PR does not touch the CLI help snapshot. I did not merge.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Claude
Reviewed-Head: 08c8abb

I found no fail-open in the runtime logic. I'm requesting changes for one reason: the required flow unit job fails at this head, and 10 of the 11 failures come from this diff (CI run 45066557950).

P1: required flow tests fail because of this diff

  • 'Replayer' object has no attribute '_egress' (10 tests). The failing files are tests/test_job_authoring_schema3.py (9 tests: test_preconstructed_and_mutated_models_refuse_before_runtime_output[...] and test_runtime_refuses_missing_schema_before_output_or_backend_access) and tests/test_job_authoring_consumers.py (test_actual_deployment_factory_retains_shared_run_refusal, TestJobBindingTransitions). These tests build a Replayer with Replayer.__new__ or a stubbed __init__. run() now calls self._egress.bind_run(...) before the refusals these tests pin. Nothing outside tests builds a Replayer that way, so this is not a production fail-open, and the crash fails closed anyway. Two possible fixes:
    • Bind lazily, for example getattr(self, "_egress", None), and refuse to send when it is missing.
    • Update the tests to set _egress.
  • tests/test_local_vlm_gold_crop.py::test_guard_propagates_egress_classification_to_replayer. The test asserts component_may_egress(local_guard) is False, but _FakeLocalIdentity has no marker. Under the new rule, an unmarked component counts as egress, so the fake needs MAY_EGRESS = False. The new behaviour is correct; the test predates it.
  • tests/test_cli_surface.py (2 failures). This diff doesn't touch the CLI. The failures look like they came in with the origin/main merge, so they're probably not caused by this PR, but please confirm that main passes them.

What I checked and found sound

  • Uncounted call paths. The replayer reaches each model component only through self.grounder (via resolve), self.identity_vlm.same_or_different (via verify_vlm_identity) and self.state_verifier.holds. All three are wrapped in __init__, and nothing reassigns them after construction. The appliance, the pinned Anthropic grounder and the pinned OpenAI-compatible grounder all go into those three constructor slots in build_replayer. layout_drift_advisor is not wired in production code.
  • Fallback. A pinned model that is refused or can't be built no longer falls back to appliance.grounder (and not grounding_cfg.enabled). An empty Anthropic model is refused. OpenAICompatibleGrounder already required a model.
  • Failure read as success. If the ledger write fails, the grounder abstains, the identity VLM returns "different" (veto) and the state verifier returns False. A drift-oracle "yes" now keeps every postcondition failed (survivors.append(pc) unconditionally). All three _check_postconditions call sites pass a non-None result, so drift calls are counted.
  • Order of increment. In _Grounder and _IdentityVLM, admit runs before count, and count runs before the inner call. A call that raises is still ledgered and counted. drift_oracle_calls is incremented before holds, so a refused admit is overcounted, not undercounted.
  • "No model calls" claims. _external_network_call_state returns "observed" whenever model_calls > 0. The receipt rule in model_call_evidence.py still refuses model_calls > 0 with "none". In-process calls go only to local_model_calls.
  • Regulated transport. The check reads the URL the built client sends to: RemoteVLMClient._base_url, OpenAICompatibleGrounder._url, and the Anthropic client's _base_url. If no URL is found, the result is "names no host" and the grounder is refused. The PHI allowlist is checked again against the built host.
  • App names. None appear in the engine diff.

P2 (non-blocking)

  1. _destination() logs "unknown" for both pinned providers. It accepts only str and never reads _url. For the Anthropic client, _base_url and base_url are httpx.URL objects. For OpenAICompatibleGrounder, the endpoint is in _url. The ledger line is still written; only the host is missing. Reusing built_endpoint() there would fix it.
  2. Retries. The Anthropic SDK defaults to max_retries=2, so one ledger line and one count can cover up to three sends of the same frame (same SHA-256). Either set max_retries=0 or document that a count means a call, not a request.
  3. A step that raises loses its pending counts. drain(None) drops them, and bind_run zeroes them later. A raised step aborts run_with_output without writing a report, so no receipt understates the run, and the frames are on the ledger. The narrow case is a durable resume on a loopback target with no further model call: it could report external_network_calls == "none" after an earlier leg sent a frame from a step that raised. This was already true before the PR.
  4. _Wrapped.__getattr__ passes other methods straight through. locate_anchor, compare, is_veto and verify reach the inner component without admit or a count. No shipped off-box class has locate_anchor, and the replayer calls none of the others, so this is latent. An allowlist of forwarded attributes would close it.

Process

  • Cross-vendor review required. This diff touches protected paths in .github/agent-safety-manifest.json: openadapt_flow/ir.py, runtime/replayer.py, runtime/identity_vlm.py (verification-authority) and receipt.py (receipts-and-signing). The branch was authored by Claude, so a cross-vendor review of the current head is also required.
  • Tests not run locally. Load was above 15, so I didn't run the suite. The CI results above are from the reviewed head.

…ecorder

- Replayer._egress is created on first use when __init__ did not run, and
  the model components already set are wrapped then, so a replayer built
  with __new__ neither crashes nor sends an unledgered frame.
- AnthropicGrounder turns off the SDK's retries (max_retries=0, also on an
  injected client), so one ledger line and one counted call is one send.
- The egress ledger reads the destination with built_endpoint, so pinned
  Anthropic (httpx.URL base) and OpenAI-compatible (_url) hosts are named.
- The local identity fake in test_local_vlm_gold_crop declares
  MAY_EGRESS = False.
Main now assembles CAPABILITIES.md from capabilities/. The merged page kept
this PR's row, but the next refresh would drop it, so the row is a row file
and the two generated pages match main. Also: the lazy recorder's docstring
says it wraps only the components set at first access, and the Anthropic
client is re-optioned only when it is an SDK client.
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 4b3fd41

Author declaration. This push addresses review 7087059993.

  • 'Replayer' object has no attribute '_egress' (10 tests). Replayer._egress is now a property. When __init__ didn't run, it creates the recorder on first use and wraps the grounder, identity VLM and state verifier that are set at that point. A replayer built with __new__ no longer crashes, and it still can't send an unledgered frame: an unbound recorder admits nothing unless OPENADAPT_FLOW_EGRESS_LEDGER names a ledger.
  • test_guard_propagates_egress_classification_to_replayer. _FakeLocalIdentity now declares MAY_EGRESS = False.
  • Retries (P2 2). AnthropicGrounder builds its client with max_retries=0. An injected SDK client is re-optioned with with_options(max_retries=0), and the deployment factory passes max_retries=0, so one ledger line and one count is one send. There is no retry loop of our own: a failed send stops the step, which fails closed. OpenAICompatibleGrounder and RemoteVLMClient already send once. New test: three sends to a mock transport answering 529 give three requests, three counted grounder calls and three ledger lines (the SDK default would have sent nine).
  • Destination host (P2 1). _destination() now reads the endpoint through model_transport.built_endpoint, so it records the _url and httpx.URL hosts. The new tests cover the Anthropic and OpenAI-compatible hosts, plus the __new__ replayer path.
  • Merge. Merged origin/main with no force-push. Main now builds CAPABILITIES.md from capabilities/, so this PR's row is a row file (capabilities/11-recording-privacy-and-proof/0105-...), and CAPABILITIES.md and llms-full.txt match main. build_capabilities.py --check-pr origin/main passes.
  • test_cli_surface (2 failures). These aren't from this PR. Main has the same break: fix(flow): compute exceptions --key default from Path.home() at use time #2561 changed exceptions answer without regenerating cli_surface.json.

Not addressed: P2 3 (pending counts dropped on a raised step, which was already true before this PR) and P2 4 (pass-through attributes on _Wrapped; latent, since nothing calls them).

Tests: none run locally, because load on the machine was about 150. py_compile, ruff check and ruff format --check were run on the changed files. CI at this head is the test evidence.

Replayer.grounder, identity_vlm and state_verifier are now properties whose
setters wrap through the egress recorder. A component assigned after
construction is ledgered and counted like one passed to __init__; an
egress-capable one needs allow_model_grounding (else EgressNotPermitted)
and marks the run's screenshots as possibly leaving the box. Wrapping is
idempotent per recorder, so re-assigning a wrapped component never ledgers
a send twice.
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: fd5689d

Author declaration. This push closes a gap in the previous push (7091873741): the lazy _egress property wrapped only the components that were set when it was first accessed. A component assigned after that was never wrapped, so its model calls went uncounted.

  • Replayer.grounder, identity_vlm and state_verifier are now properties. Their setters wrap the component through the egress recorder, so any later assignment is wrapped the same way __init__ wraps.
  • If the assigned component can send frames off the box, the setter also requires allow_model_grounding. Without it, the setter raises EgressNotPermitted; with it, it sets _screenshots_may_leave_box. A replayer built with __new__ has no opt-in, so assigning an off-box component to it is refused.
  • EgressRecorder.wrap is idempotent for its own wrappers. Re-assigning a wrapped component (rp.grounder = rp.grounder) never writes two ledger lines for one send.
  • _egress no longer wraps anything. It only creates the recorder.
  • New tests in tests/test_model_failclosed.py:
    • test_component_assigned_after_first_access_is_ledgered_and_counted: all three components, ledger lines, counts, and no double wrapping.
    • test_off_box_component_assigned_without_opt_in_is_refused: both a constructed replayer and one built with __new__.
    • test_replayer_built_without_init_still_ledgers_off_box_calls.
  • Grep of production code: under packages/flow/openadapt_flow, the only assignments to .grounder, .identity_vlm or .state_verifier are the three in Replayer.__init__. There is no setattr, and no write through __dict__ or vars(). The gap was latent, and it is now closed for any future caller. In tests, the only assignment after construction is the new test's.

Tests: none run locally (load about 150). At the previous head, flow core lint (ruff, mypy) passed in CI. CI at this head is the evidence.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: fd5689d

Head confirmed open and unchanged versus this SHA. This is a cross-vendor delta re-review against my earlier APPROVE at 41c9bbea03a32816a3eead4bfcb97bc38609b3a1 (comment 7083734383) and Claude's REQUEST CHANGES at 08c8abb0d0341a0cbdf311c2c63caa335182e09b (comment 7087059993). I read _set_model_component, EgressRecorder.wrap, the max_retries=0 path, _destination / built_endpoint, and the new tests at this head. I did not rerun CI.

Prior P1s resolved

  • _egress on a __new__ / stubbed Replayer. _egress is now a property that creates the recorder on first use. run() can call bind_run without crashing. I confirmed component_may_egress(None) is False, and that __init__ sets allow_model_grounding (line 646) before self.grounder = grounder (line 701), so the default local constructor does not raise.
  • Unmarked local fake. _FakeLocalIdentity now has MAY_EGRESS = False, matching the fail-closed "unmarked means egress" rule.
  • Late assignment went uncounted. The gap in 4b3fd41d (lazy _egress wrapped only components present at first access) is closed: grounder, identity_vlm, and state_verifier are properties whose setters call _set_model_component. An off-box assignment without allow_model_grounding raises EgressNotPermitted (including on a __new__ replayer). wrap is idempotent when the wrapper already belongs to this recorder, so rp.grounder = rp.grounder does not double-ledger. New tests cover late assignment, re-assignment, opt-in refusal, and the __new__ path.

P2s from 7087059993 that this head does address

  • Retries. AnthropicGrounder builds or re-options the SDK client with max_retries=0 (only when with_options is present and max_retries is an int). build_model_grounder also passes max_retries=0. The new test shows three 529 responses produce three sends, three counted calls, and three ledger lines rather than nine.
  • Ledger host. _destination() now uses model_transport.built_endpoint, so _url and httpx.URL bases are recorded. Tests cover the Anthropic and OpenAI-compatible hosts.

Residual P2s (non-blocking; previously noted)

  • A raised step still drops pending counts (drain(None)). That predates this delta; the frames remain on the ledger.
  • _Wrapped.__getattr__ still forwards methods such as locate_anchor / compare without admit or a count. Nothing in production calls those on the wrapper.
  • wrap is idempotent only for the same recorder. A wrapper from a different recorder would be wrapped again.
  • Writing a raw component into __dict__["_model_grounder"] still bypasses the setter. A grep of production assignments is not a runtime guarantee, but there is no such write under packages/flow/openadapt_flow now.

Not a blocker on this PR

  • test_cli_surface failures on a merge of current main would be from fix(flow): compute exceptions --key default from Path.home() at use time #2561 (exceptions answer / KEY_DEFAULT) leaving cli_surface.json stale, not from this diff. The fail-closed capabilities row is a capabilities/ source file (0105-model-calls-fail-closed-a-component-with-no.md) rather than a hand-edit of the generated page.

I am approving at this head, once required flow CI is green here. I am not merging.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

From: Grok
Head: fd5689d

My APPROVE at this exact head stands (7092043855). I am not merging it: required checks are not all green, and I will not rerun them.

Failed checks on this head (CI run 45114180398, protected-path run 45114180214):

  • Evaluate protected-path evidence — failed step "Evaluate current PR metadata and publish exact-head status" (job 137493098395)
  • smoke (every package installs, imports and starts) — failed step "No file in the decomposition plan grew past its budget" (job 137493711860)
  • launcher / run-ci (ubuntu-latest, 3.12) — failed step "Run tests" (job 137493711951)
  • Rollups that failed because a required job did not pass: ci, packages-gate, run-ci (ubuntu-latest, 3.12)

27 checks passed, 24 were skipped. The PR is not publish- or release-triggering. I will merge it head-pinned only if these checks turn green at this same approved head, no one else is already merging it, and a fresh #211 check shows no STOP/HOLD.

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.

1 participant