Repository navigation
docs(events): document durable thread seq watermark - #6532
Conversation
RUN_EVENT_STREAM.md described seq as monotonic but did not cover the durable per-thread high-water mark that keeps allocations monotonic after a run is deleted. Record that behavior in the Record Envelope section, including that thread deletion drops the mark only when no events remain.
willem-bd
left a comment
There was a problem hiding this comment.
Docs review at 3aa27b9: the new paragraph is accurate against the head implementation. run_event_thread_seq is a per-thread table independent of run_events (backend/packages/harness/deerflow/persistence/models/run_event.py); _max_seq_for_thread allocates from max(row max, watermark); delete_by_run raises the watermark to the thread-wide max inside the mutation fence; delete_by_thread drops it only when an unfiltered (all-owner, all-category) EXISTS finds no surviving rows — so "deleting a run never lowers the next allocated seq" and the owner/category wording both hold. I also checked the bundled frontend test change against formatWithViewerTime and the three test.each expectations are correct for the pinned clock. One process finding inline: that test change is not described in the PR body.
| }); | ||
|
|
||
| describe("run time zone follows the tasks page", () => { | ||
| beforeEach(() => { |
There was a problem hiding this comment.
The PR body's "What changed" covers only the RUN_EVENT_STREAM.md paragraph, but this also rewrites the test's clock handling — worth a sentence in the description (or a separate test-only PR) so the docs-only framing matches the diff.
The change itself looks correct and worth keeping: the fixture is pinned to 2026-10-07 and the old regex /01:00 \u00b7 (?:\S+ )?09:00 your time/ stops matching once the real clock moves more than a day past that date, because the viewer part then renders as the two-word absolute form Oct 7 09:00, which the single optional \S+ cannot cover (the old comment only considered the \u00b11-day cases). Faking Date in beforeEach and pinning each case's now makes all three relative-day paths deterministic instead of rotting with the wall clock.
Why
backend/docs/RUN_EVENT_STREAM.mdis the public contract forseq, but itstopped at "monotonic within a thread" and never described the durable
watermark added in #6477 (fixing #6471). External consumers reading only this
doc cannot learn that the guarantee now survives run deletion, which is exactly
the case that used to break
after_seqpagination.What changed
The Record Envelope section now documents that the database store keeps a
per-thread high-water mark (
run_event_thread_seq) independent of the eventrows: deleting a run never lowers the next allocated
seq, values are notreused within a thread, and an already-advanced
after_seqcursor does notmiss later events. It also notes that thread deletion drops the mark only when
no events remain for the thread across every owner and category.
Surface area
Validation
Docs-only. Verified the wording against
backend/packages/harness/deerflow/runtime/events/store/db.py(
_max_seq_for_thread,_raise_seq_watermark,delete_by_thread) and theinternal
runtime/AGENTS.mdwatermark note. No code or test behavior changed.AI assistance
Tool(s) used: Codex
How you used it: Drafted the paragraph from the merged #6477 behavior and
the store code; I reviewed the result against
db.py.