feat: add credential-free OpenRouter response finalizer - #34
Merged
Conversation
ohdearquant
marked this pull request as ready for review
August 17, 2026 16:38
…fix/finalizer-fail-closed
…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>
…fix/finalizer-fail-closed
…fix/finalizer-fail-closed
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Acceptance evidence
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.