feat: consume TEPP terminal result contract - #656
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5c662a3
into
feat/tepp-accepted-receipt-v21211
| except TeppInvalidResponse: | ||
| return TeppSubmissionOutcome(_FAILED, "tepp_result_not_persisted", None, "") |
There was a problem hiding this comment.
🔍 Invalid status payload permanently fails a receipt-bearing run
A TeppInvalidResponse from a status read maps to _FAILED (analysis_run_start.py:295-296); _deliver_tepp_measurement then appends a terminal Failed and marks the outbox delivered, unlike TeppNotAvailable which stays Running. One malformed status payload permanently fails a run that holds a durable accepted receipt, with no later retry. ADR 0178 documents fail-closed on invalid/mismatched, and no production status transport is wired yet, so impact today is nil.
Was this helpful? React with 👍 or 👎 to provide feedback.
| existing = await conn.fetchrow( | ||
| """ | ||
| select remote_run_id, result_sha256 | ||
| from analysis_run_tepp_result | ||
| where analysis_run_id = $1 | ||
| """, | ||
| analysis_run_id, | ||
| ) | ||
| if existing is not None: | ||
| return ( | ||
| str(existing["remote_run_id"]) == remote_run_id | ||
| and str(existing["result_sha256"]) == result_sha256 |
There was a problem hiding this comment.
📝 Info: Stored result digest recomputes the DTO, not TEPP's artifact digest
_persist_tepp_result stores result_sha256 as a hash of the full canonical terminal DTO, not TEPP's terminal['result_sha256']. The replay-rejection check (analysis_run_start.py:343-354) compares against this recomputed value. Since the DTO embeds TEPP's digest, a changed provider digest still changes the stored hash and is rejected, so the reject-changed-digest contract holds. Noted only so the column is not mistaken for TEPP's artifact digest.
Was this helpful? React with 👍 or 👎 to provide feedback.
| state = response["run_state"] | ||
| terminal = response["terminal_result"] | ||
| if state in {"accepted", "running"}: | ||
| return terminal is None | ||
| if state not in {"succeeded", "failed"} or not isinstance(terminal, dict): | ||
| return False |
There was a problem hiding this comment.
📝 Info: Status validator rejects 'queued' that the submit path accepts
_valid_analysis_run_status accepts run_state only in {accepted, running, succeeded, failed}, so a queued status response is rejected and mapped to _FAILED, whereas the submit path treats queued as a valid transport state. This matches the documented v1 status contract, which omits queued; confirm TEPP's status endpoint never emits it.
Was this helpful? React with 👍 or 👎 to provide feedback.
Product gap
TEPP accepted receipts are transport evidence, not measurements. TEPP PR #157
now publishes strict status and terminal-result v1 DTOs, so a Running
LineageWeave run can consume provider-authoritative completion without
resubmitting work or inventing a theta.
Change
time, every request/receipt binding, lowercase SHA-256 digest, bounded
identity-free summary, and terminal failure code;
terminal failure without a measurement;
TEPP issue #249 owns the executable provider HTTP status route and retry-policy
evidence. This PR does not implement statistical arithmetic, a provider URL,
poll cadence, backoff coefficient, score, or theta.
Evidence
uv run --extra dev --extra backend pytest -q tests/test_tepp_client.py tests/test_tepp_accepted_receipt.py tests/test_analysis_run_start.py— 64 passeduv run --extra dev --extra backend pytest -q— 1087 passed, 16 skippeduv run --extra dev --extra backend python -m compileall -q lineageweave backend testsgit diff --checkCloses #277 only after the provider HTTP status service is available; this
stacked consumer slice intentionally leaves the issue open.