Skip to content

feat(flow): send the stored report's SHA-256 from the connector - #2386

Merged
abrichr merged 2 commits into
feat/byoc-runner-pilotfrom
fix/byoc-report-digest
Nov 21, 2026
Merged

abrichr merged 2 commits into
feat/byoc-runner-pilotfrom
fix/byoc-report-digest

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member

Stacked on #2300 (feat/byoc-runner-pilot at f4e979e34). Retarget to main after #2300 merges.

Why

On staging, run f36410cb was VERIFIED on the runner. Cloud stored its outcome and the runner's independent read-back (CONFIRMED), but issued no receipt (409 trusted_evidence_pending). Cloud's run-callback seals a callback's evidence with Cloud's own secret only when the callback carries metrics.report_sha256, the digest of the run's report. The connector did not send it. Its allow-list had no such field.

Change

  • connector/storage.py: report_bytes(report) is the exact serialization stored. LocalCustomerStorage.write_report writes those bytes, which are byte-identical to before.
  • connector/executor.py: once the report is written, metrics.report_sha256 is the SHA-256 of those bytes. It is omitted when the write failed.
  • connector/egress.py: metrics.report_sha256 must be 64 lowercase hex characters. Anything else is refused.
  • tests/test_connector_pilot.py:
    • the end-to-end canary test checks that the callback's digest matches the stored report, while no canary leaves;
    • the guard refuses free text and uppercase hex in that field;
    • a local-storage test checks that the digest matches the file bytes.
  • ruff format also formats the fix(flow): let digest-named keys of the closed outcome envelope leave the connector #2380 test that was merged into the base unformatted.

The Cloud half, which labels customer-run callbacks customer_controlled / self_reported, is a separate openadapt-cloud PR.

Evidence

  • Connector suites: 167 passed.
  • ruff check and ruff format: clean.
  • mypy on egress.py, executor.py and storage.py: clean.

Synthetic data only.

Cloud seals a run's outcome with the report digest it receives, which is
what makes a receipt possible. The connector now sends metrics.report_sha256,
the SHA-256 of the exact bytes it wrote to customer storage, and the egress
guard accepts only a 64-hex digest there. The report itself never leaves.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 97eda5a

Reviewed the unique commit on this stacked branch (on #2300 / #2380), not the rest of the connector stack. The connector now puts metrics.report_sha256 on the run callback: hashlib.sha256(report_bytes(report)).hexdigest(), where report_bytes is the same json.dumps(..., indent=2) serializer LocalCustomerStorage.write_report uses, so the digest is of the stored bytes. The report itself is not in the callback.

The egress guard handles report_sha256 before the numeric metric allow-list and accepts only _HEX64 (^[a-f0-9]{64}$). Tests refuse a canary-bearing string and uppercase A * 64, and the canary e2e path checks the callback digest equals sha256(report_bytes(stored)).

Do not merge this head: it conflicts with current main in .gitleaksignore, CAPABILITIES.md, llms-full.txt, and packages/flow/openadapt_flow/__main__.py. As noted in #211, #2384 also appends tests at the end of test_connector_pilot.py, so whichever lands second will need a one-hunk reconcile.

Pointer: openadapt-internal#211

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: ab1f04b

Delta check versus my APPROVE at 97eda5aa. The only new commit is a merge of current feat/byoc-runner-pilot (01fee9b8). Unique work still sends the stored report's SHA-256. Both tests are present: test_local_report_digest_matches_the_stored_bytes and the base's test_wrap_readback_evidence_reads_the_v1_effect_receipt. The merge did not touch the base's dated ## v3.4.0 (2026-11-20) heading; that remains a base-branch issue to reconcile when #2300 merges main. Merge-tree versus the current base is clean. Not merged: still stacked on #2300.

Pointer: openadapt-internal#211

@abrichr
abrichr merged commit 6b959cb into feat/byoc-runner-pilot Nov 21, 2026
16 of 18 checks passed
@abrichr
abrichr deleted the fix/byoc-report-digest branch November 21, 2026 04:28
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