Skip to content

Check stamp inputs after taking their history fingerprint - #4376

Merged
leaf-agent merged 1 commit into
mainfrom
fix/nightly-stamp-reading
Oct 27, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/nightly-stamp-reading

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

A leaf page stamp could validate an outdated log while treating its fingerprint as current. If an agent message landed after the log read but before the fingerprint, the stamp could publish authored markup using an ID that the message had just claimed. This fixes the read order so the existing transaction check detects that append and validates again before publishing.

The unlocked check now takes its source/history fingerprint before reading events. Checks already holding the transaction continue using its event list. This preserves #3878’s behavior: a tab can activate a save while the stamp checks it, and publication alone holds the transaction.

Validation: the new regression deterministically admits a message in the read/fingerprint gap; it fails before the fix because stamping succeeds, and passes afterward because the ID collision is refused without a second version note. All 10 tests selected by tests/model/test_interact_document.py -k "stamp or publish" pass. No browser behavior changes.

An event could land after the unlocked stamp read its log but before _checked
captured the source/history fingerprints. The final comparison then accepted a
check against the older log. An agent message claiming an authored ID in that
gap let the stamp publish duplicate identities.

Take the fingerprint before reading the log on the unlocked path; transaction
callers retain their held events. The existing fingerprint comparison now
rechecks that append without extending the lock or adding retries.

The regression admits a real agent message at the read boundary. It failed
before the fix because the stamp succeeded, and passes after because the ID
collision is refused before publishing a second note. All 10 stamp/publication
checks in test_interact_document pass.
@leaf-agent
leaf-agent merged commit 29f8361 into main Oct 27, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/nightly-stamp-reading branch October 27, 2026 07:09
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