Skip to content

feat: add credential-free OpenRouter response finalizer - #34

Merged
ohdearquant merged 7 commits into
mainfrom
codex/openrouter-e2e-finalizer
Aug 17, 2026
Merged

feat: add credential-free OpenRouter response finalizer#34
ohdearquant merged 7 commits into
mainfrom
codex/openrouter-e2e-finalizer

Conversation

@ohdearquant

Copy link
Copy Markdown
Owner

Outcome

Adds a credential-free, transport-free finalizer for an already durable OpenRouter response. It reconstructs the frozen challenge and plan, verifies journal authority, atomically publishes provider success when media admission passes, and materializes private output/result artifacts with staged fsync plus no-clobber links.

This PR does not perform a live provider call and does not claim live-production readiness.

Contract

  • Public finalize_openrouter_real_e2e(challenge_dir, *, _clock=...) API.
  • response_received plus valid media becomes succeeded exactly once.
  • Invalid media remains response_received with structural diagnostics and no occurrence/output.
  • succeeded is a read-only exact replay; submitted and other unsupported heads fail closed.
  • Exact replay, concurrent replay, lost SQLite acknowledgement, and crash-before-derived-link recover without credential or network access.
  • Output is published before result.json, which is the completion marker.

Acceptance evidence

  • 33 finalizer tests pass.
  • 222 focused OpenRouter, journal, evidence-store, and success-store tests pass.
  • 1,745 non-packaging repository tests pass; 5 skipped and 1 expected xfail.
  • 10 packaging tests pass in the network-enabled build-isolation gate.
  • Ruff check passes; changed files are Ruff-format clean; targeted Pyright reports 0 errors; git diff check passes.
  • Independent correctness and spec reviews report 0 remaining P0/P1 findings for this offline slice.

Explicit live HOLD

Live execution remains blocked on governed Pixel-RAG evidence republication, trusted authority-to-creative-session integration, and a durable Studio confirmation consumer. Known P2 limitations are documented: rejected-media journal/result publication is not cross-medium atomic, pathname evidence remains within the same-UID trust boundary, and repeated hard kills before the final link can accumulate owner-private staging orphans.

@ohdearquant
ohdearquant marked this pull request as ready for review August 17, 2026 16:38
khive and others added 5 commits August 17, 2026 13:39
…blishing not_run

The rejected-media branches swallowed any verification exception and
published raw_structural_result: not_run as a successful report — a
transient decoder failure produced a false document, and because derived
publication is exact no-clobber, the degraded bytes then blocked the
correct recompute behind finalization_artifact_conflict forever. The
finalizer now fails finalization_artifact_invalid like its success
sibling, the execute path propagates the failure, and tests pin the
recovery: a raise leaves no result.json and the next finalize writes the
correct document. The execute path's adoption of byte-identical
pre-existing artifacts is now stated in INTERFACES.md, divergent bytes
surface as finalization_artifact_conflict from execute as well, and the
completed invalid-media execute run is proven to replay byte-identically
through the finalizer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The crash-window reconciliation sampled the final artifact's link count and
the staging-link enumeration at different instants, so a peer publisher
unlinking its staging link between the two samples was reported as
finalization_artifact_conflict on byte-identical content. The reconciliation
now re-samples the link count a bounded number of times and only a link that
persists is a conflict; a staging link that vanishes mid-enumeration is
skipped. Staging and filesystem I/O failures report their own
finalization_artifact_io_failed code so the conflict code keeps its published
meaning (divergent bytes found and preserved). Contract text updated.
@ohdearquant
ohdearquant changed the base branch from codex/openrouter-real-e2e to main August 17, 2026 18:40
The artifact-materialization conflict code was in the handler's passthrough
set, but unlike the secret-scan verdicts it is raised before any scan runs —
so a conflict exit skipped the every-exit artifact scan and could mask a
persisted credential behind a divergence report. The handler now runs the
terminal scan first; its verdict outranks the collapse, and the conflict
diagnostic survives only a clean scan. Directory-enumeration OSErrors during
materialization report finalization_artifact_io_failed instead of claiming
divergent bytes were found.
@ohdearquant
ohdearquant merged commit 233671d into main Aug 17, 2026
3 checks passed
@ohdearquant
ohdearquant deleted the codex/openrouter-e2e-finalizer branch August 17, 2026 18:57
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