Skip to content

fix: fingerprint material inputs for resumable archive runs - #2

Merged
DeepMathLLM merged 1 commit into
DeepMathLLM:mainfrom
Charlie-Wang-03:fix/runner-material-fingerprint-upstream
Sep 5, 2026
Merged

fix: fingerprint material inputs for resumable archive runs#2
DeepMathLLM merged 1 commit into
DeepMathLLM:mainfrom
Charlie-Wang-03:fix/runner-material-fingerprint-upstream

Conversation

@Charlie-Wang-03

Copy link
Copy Markdown
Contributor

Problem

The archive runner treated the queue JSON as immutable after state creation, but referenced local material files were not part of the persisted run identity. A queue could therefore resume the same object/session after a material file changed on disk while input_sha256 still matched the unchanged queue JSON.

Cause

load_or_create_state() persisted and validated the queue JSON hash plus object/project/archive associations, but it did not persist content identity for ObjectJob.materials.

Contract

A resumable archive run must bind every referenced local material to its resolved path and exact SHA-256 content hash. Any mismatch must fail closed before session resume, material staging, model execution, verification, or publication.

Implementation

  • Persist ordered per-object material_fingerprints (path + sha256) when queue state is created.
  • Recompute and compare those fingerprints whenever existing state is loaded.
  • Revalidate the fingerprint contract at process_object() entry before opening/resuming Moonshine.
  • Propagate source-material fingerprints into Moonshine archive_task session metadata.
  • Preserve schema version 1: legacy states without materials remain resumable; legacy material-backed states without fingerprints fail closed.

No Moonshine change is required; this is a Creative-Intelligence workflow-state/provenance bug.

Regression evidence

TDD negative control: workflow run 33902896763 failed on both Python 3.9 and 3.11 with the new mutation regression reporting RunnerError not raised, reproducing the provenance gap.

The original implementation branch then passed workflow run 33903268250 with 17/17 tests on both Python versions.

After upstream PR #1 was merged, this branch was rebuilt directly on upstream commit bee85b1e as a single clean implementation commit. Clean-baseline workflow run 33943651282 also passed on Python 3.9 and 3.11.

Final coverage includes material path/SHA-256 persistence, unchanged-material resume acceptance, material-content mutation rejection, fail-closed handling of legacy material-backed state without fingerprints, and all 14 existing deterministic runner regressions.

Limitations

This closes persisted resume-provenance drift. It does not provide OS-level locking or an immutable snapshot against a concurrent external writer in the small interval after validation; that stronger TOCTOU/snapshot problem is outside this milestone.

@DeepMathLLM
DeepMathLLM merged commit 5f7fbb7 into DeepMathLLM:main Sep 5, 2026
2 checks passed
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.

2 participants