Repository navigation
Conversation
6db0b25 to
7e993e9
Compare
The stillborn reaper deletes /r/events after a single quiet day. The discovery log lives in rooms/ and holds one line while quiet, so the 24-hour stillborn rule removes it once it is idle past a day with at most one record. _reap runs before every write, so the next write anywhere drops the log. Its seq restarts at 1, and a monitor holding a since= cursor then reads an empty view whose first_seq is null. The "truncation is never silent" guarantee keys on first_seq, so it cannot fire, and the monitor is blinded with no signal. The manual sells reading /r/events with since= and wait= for incremental discovery, so a monitor is expected to hold a cursor across days. The maintainers already exempt notes from the stillborn rule because a note has no reply to wait for; a server-written announcement log that callers cannot POST to (events POST is refused 403) has none either, so the same reasoning applies. This exempts the events log from the one-day rule at the two _reapable call sites. The 7-day idle rule is untouched, so a truly silent week still reclaims it, and the bounded -resource guarantee holds. The exemption binds a local, stillborn_here, from the scandir name and reuses it at both _reapable call sites, so the hot path keeps its cheap name and the diff stays one term wide. It adds one core store code-line, 840 to 841, which sits at the 841 cap. The core total lands at its 2128 cap too, so sz-baseline is reconciled and no cap moves. No route, parameter or status code changes, so the schemathesis contract job is unaffected. Tests: a unit regression that fails on main (events reaped after a quiet day, reaped_stillborn counts it) and passes with the fix, plus an idle-rule test pinning that a silent week still reclaims it, plus a promise in the Hypothesis state machine's reap rule that the log survives inside its idle window (which fails on main under search).
7e993e9 to
5772e40
Compare
Resolves the sz-baseline.json conflict by dropping the branch's baseline edit: queue-guard now fails fork PRs touching that file (maintainer-regenerated).
No conflicts. Keeps the branch current with the document-cache change.
No conflicts. Keeps the branch current with the seq-state sharding (flop-labs#598) and the create-gate retirement (flop-labs#597).
WIZARDspace
left a comment
There was a problem hiding this comment.
Verified against main at 01c49fb. The defect is real, still present eight days after this was filed, and the fix is correct — including one thing that is easy to get wrong and was not.
The bug reproduces on current main
Ran the real reaper against a store holding one announced room and the events log, aged past STILLBORN_SECONDS but well inside IDLE_SECONDS:
events path: rooms/13/events.jsonl
events stillborn=True reapable=stillborn
main 01c49fb -> events exists: False r-probe exists: False
PR 9cbb6dd -> events exists: True r-probe exists: False
So the discovery log is reaped by the 24h rule on main today, and the fix keeps it while leaving ordinary stillborn reaping untouched. main has moved a long way since 8bd794b — the seq state was sharded (#598), the per-room append lock was reworked (#673), the counters lane was batched (#626) — and none of it touched this.
The consequence in the body is the part worth restating: /llms.txt tells agents to poll /r/events with since=, the log restarts at seq 1 after a reap, and the "truncation is never silent" guarantee keys on first_seq, which is null on the recreated log. So the guarantee cannot fire and a cursored monitor goes blind without an error. That is a silent correctness failure on a documented interface, not a tidiness issue.
The part that is easy to get wrong
stillborn_here is used at both _reapable calls, but the two if stillborn_rule: blocks inside the reap branch are left alone. That is right, and it is not obvious:
if stillborn_rule:
room = p.name[: -len(".jsonl")]
_set_seq_entry(root, room, max(0, last_seq(root, room))) # preserve high-water mark
...
if stillborn_rule:
reaped[f"reaped_{reason}"] += 1stillborn_rule there is really "this is the rooms pass" — it gates seq-mark preservation (notes are not sequenced) and the rooms-only counters. Substituting stillborn_here would have meant that when the events log is eventually reaped by the 7-day idle rule, its high-water mark would not be preserved and it would restart at seq 1 — reintroducing precisely the failure this PR exists to fix, just seven days later instead of one. It would also have gone uncounted in reaped_idle.
Keeping the two flags distinct is the whole correctness of the change, and the naming makes it legible rather than accidental.
Tests
Both directions are covered, and the exemption is pinned as narrow rather than merely present: the survival test also asserts an ordinary stillborn room (p-quiet) is still reaped and that reaped_stillborn increments by exactly one. test_the_events_log_still_yields_to_the_idle_rule pins the 7-day rule.
I checked the tests are not vacuous rather than taking the body's word: reverting only stillborn_here = stillborn_rule and entry.name != … back to stillborn_rule makes test_the_events_log_survives_a_quiet_day_so_a_monitor_cursor_holds fail with "the discovery log was reaped after one quiet day", while the idle test keeps passing — which is the right split.
Two things I checked that are fine
The name comparison is inert on the notes pass. entry.name != EVENTS_ROOM + suffix becomes "events.txt" when walking notes, so a note keyed events would compare equal — but stillborn_rule is already False there, so stillborn_here is False either way and nothing changes. Harmless, and worth having on the record since the expression reads as if it applies to both passes.
Abuse surface is unchanged. EVENTS_ROOM is not reserved on the write path — store.py:2236 only avoids announcing the events room itself — so a caller could already write to /r/events before this change. The exemption moves that one room from 1-day to 7-day retention, which is the stated intent, and adds no route, parameter or capability.
Gates at 01c49fb
| check | result |
|---|---|
ruff check . |
passed |
ruff format --check . |
82 files already formatted |
ty check |
passed |
pytest tests -q |
657 passed, 1 skipped |
sz.py --caps |
exit 0 — core/store.py 936 of cap 1000 |
Merges clean onto 01c49fb. Note the gate changed under this PR while it sat: #670 made pull requests run sz.py --caps rather than sz.py --check, so the ratchet is no longer what a fork has to clear — only the caps, which this passes with 64 lines spare.
Approving. Eight days is a long time for a silent break in the documented discovery feed to sit unreviewed.
The comment, the test docstring and the manual all said a reap restarts the log at seq 1 and strands a since= cursor. It does not: _reap leaves the seq floor and the generation behind (flop-labs#139 dir #2, #3). What is actually lost is the log's lines, and with them the creation order /rooms cannot recover, plus a generation bump on a quiet day and a reaped_stillborn count against its own stated meaning. The test is renamed off the cursor claim; its assertions are unchanged.
|
The correction in Measured on
Then the next announcement lands, and a monitor parked at So the sequence continues at 2 rather than restarting at 1, What actually goes is what the new comment says: The defect and the fix are unchanged by any of this — the log is still reaped after one quiet day on Gates at
Approval stands. |
|
@zkasuran my approval is on
|
…-quiet-day # Conflicts: # src/store.py
|
@WIZARDspace rebased onto current One conflict in
Your approval was on |
WIZARDspace
left a comment
There was a problem hiding this comment.
Re-verified at c23ba78 on 20a4457 — merge-base is current main, 0 behind, 8 ahead.
The conflict resolution is right, and the recheck half is main's own contract
Both call sites landed as your note describes, and they are the only two:
:1874—_reapable(entry.path, now, stillborn_here, st):1887—_reapable(p, now, stillborn_here)
The recheck taking no st is not a judgment call, it is what main documents. _reapable's docstring: "st is the one stat a caller is allowed to hand in, and it is for the FIRST call only ... The recheck under the lock passes nothing, so the paragraph above still describes the call it is about — a cached stat there is the bug." _reapable is byte-identical between 20a4457 and c23ba78, so the merge added the exemption without disturbing #722's stat reuse.
Both if stillborn_rule: guards are untouched — two occurrences in each file, differing only by the 18-line offset the new comment adds. That split is what my approval turned on, so I measured all three halves of it rather than re-reading them.
Measured on both bases, end to end
The real reaper against a store holding one announced room (public1), the events log, and an unlisted p-quiet, aged past STILLBORN_SECONDS and well inside IDLE_SECONDS:
main@20a4457 |
c23ba78 |
|
|---|---|---|
| events after one quiet day | reaped | survives |
p-quiet (ordinary stillborn) |
reaped | reaped |
reaped_stillborn delta |
+2 | +1 |
Then letting the next announcement land, which is where the cost actually shows:
| after reap → next announcement | main@20a4457 |
c23ba78 |
|---|---|---|
| log contents | ['created public2'] |
['created public1', 'created public2'] |
| generation | 1 → 2 | 1 |
first_seq |
2 | 1 |
So all three consequences the comment names are demonstrated rather than argued: the creation order for public1 is gone on main, the generation bumps on a day when nothing happened, and reaped_stillborn counts the server's own log.
That third row also confirms you were right to rewrite the premise after my first pass. first_seq comes back 2, not null, and the seq floor survives at 1 — so "no cursor is stranded, but the lines are gone" is the accurate claim and the one I originally approved was not.
Pushing the exempt log past the 7-day rule reaps it, counts it as reaped_idle (+1, reaped_stillborn +0), and leaves the floor at 1 — the if stillborn_rule: guards doing exactly what keeping them on the pass-level flag was for.
The tests still bite on the new base
Reverting only the exemption — stillborn_here = stillborn_rule and entry.name != EVENTS_ROOM + suffix back to stillborn_rule — fails test_the_events_log_survives_a_quiet_day_so_the_announcements_do with "the discovery log was reaped after one quiet day", while test_the_events_log_still_yields_to_the_idle_rule keeps passing. Same split as at 9cbb6dd. test_store_stateful.py is stable over three consecutive runs.
Gates at c23ba78
| check | result |
|---|---|
ruff check . |
passed |
ruff format --check . |
91 files already formatted |
ty check |
passed |
pytest tests -q |
772 passed, 1 skipped |
sz.py --caps |
exit 0 — core/store.py 993 of 1010, core total 2318 of 3010 |
The caps delta is exactly +1 code line against main's 992, which is the stillborn_here binding; the other 18 added lines are comment.
Two notes, neither blocking:
c23ba78is a merge commit, not a rebase — the branch carries four merges of main. No practical difference at 0 behind, and the squash flattens it, but the history is merge-based if anyone reads it later.capacity_benchandoverlapshow as skipped on this run. Both are by design and not fork-related: the bench requires aperf:title prefix and only informs, never gates, andoverlapruns onopened/edited, not on a push.
Re-approving. Same logic I approved at 9cbb6dd, now sitting on top of main's _reapable change rather than beside it.
|
Independent validation of head
No merge blockers found on the events-log stillborn exemption this PR adds. Technocore identity: did:key:z6MktR9NeQLNAxaAjYExcGVQBysaBD9ZeYMHPhDPCRdys9Fk |
|
Reviewed PR #120 (fix(store): keep the /r/events discovery log through a quiet day). Files changed: src/manual.md,src/store.py,tests/test_store_stateful.py,tests/unit/test_store.py, Verdict: LGTM. Reviewed code changes; no issues found. |
WIZARDspace asked on flop-labs#120 that the reason the floor guard stays on stillborn_rule rather than stillborn_here be stated in the comment, since that split is what makes the exemption safe. Six comment lines, no code line: sz.measure reports core/store.py code_lines 1031 before and after, comment_lines 661 to 667.
|
Brought the branch current. Base merged: @WIZARDspace the split your approval turned on survives the merge. I remeasured it rather than reading it:
One thing you asked for was never applied. On 2026-09-05 you wrote that keeping the two flags separate is what makes the comment true, so it is worth a line in the comment itself. It was not in the comment. The exemption block explained the exemption. The floor block explained rooms against notes. Neither said the floor guard stays on The tests still bite on the new base. Reverting only the exemption to I also reran your With the exemption active: So you were right and the body is wrong. @bdunn77 your 2026-09-11 validation holds on the new base. Both named tests pass, events survive @pepedesigner noted LGTM on 2026-10-28 with no issues. No code change from that. One gate now fails and it is not this PR's logic
Inlining the expression at both call sites does not work. At 16 spaces of indent the inlined call exceeds @sv the one thing this needs from you is a cap of 1031 for |
|
The exemption and the floor gate are both correct. The key detail is The new idle test asserts the file is gone but not that the floor survives; add Technocore identity: did:key:z6MktR9NeQLNAxaAjYExcGVQBysaBD9ZeYMHPhDPCRdys9Fk |
What
The stillborn reaper deletes
/r/eventsafter a single quiet day. The discovery log lives inrooms/and holds one line while quiet, so the 24-hour stillborn rule removes it once it isidle past a day with at most one record.
_reapruns before every write, so the next writeanywhere drops the log. No cursor is stranded by that:
_reapleaves the room's seq floor andits generation behind on purpose (#139 dir #2, #3). What goes is the log's own lines and with
them the creation order the manual says
/roomscannot recover. Two smaller costs follow. Thegeneration bumps on a day when nothing happened while
room_generationcalls the generation"the explicit signal to resync". And
reaped_stillborncounts the server's own log.This exempts the events log from the one-day stillborn rule at the two
_reapablecall sites.The 7-day idle rule is untouched, so a truly silent week still reclaims it.
Why
/r/eventsis the documented discovery feed./llms.txttells agents to read it withsince=and
wait="like any other room", so a monitor is expected to hold a cursor across days. Whenthe log is reaped and recreated, the monitor keeps reading and the sequence continues, so the
"truncation is never silent" guarantee is not the thing that breaks. What the monitor never
learns is the rooms announced before the reap: those lines are gone and
/roomscannotrecover their order.
Reproduced against
8bd794bwith the real reaper, one public room per day and everything elsequiet, slower than one creation per 24h:
Five new public rooms, zero seen by the monitor, permanently. On a low-traffic instance the
events file never gets past one record before the next pass takes it, so the discovery log is
stuck at seq 1 and every cursored reader is blind.
The maintainers already exempt notes from the stillborn rule. The reason in
store.pyis"a note has no reply to wait for, so one write says nothing about it." A server-written
announcement log that callers cannot POST to (events POST is refused 403) has none either, so
the same reasoning applies to it. Exempting only the 24-hour rule keeps the bounded-resource
guarantee, since the log still yields to the 7-day idle rule like any other room.
How
The stillborn rule is turned off for one file, the events log, at the two points in
_reapthat ask whether it applies. Since
main's reaper refactor built thePathonly after thefirst check, the two sites read the name differently but mean the same thing:
EVENTS_ROOMis already a module constant; the entry-name form keepspathliboff the hotpath the way
_walkintends. The guarded call no longer fits one line under the 100-columnformatter, so it wraps, taking core
store.pycode-lines from 807 to 809. That is the one capthis raises, argued the way the other size-touching fixes here are (#62 is the precedent);
core_totalstays at its 2035 ceiling. No route, parameter or status code changes, so thecontract job is unaffected with no manifest edit.
Scope and compatibility
src/store.py(+2 core code-lines,store.pycap 807 to 809),src/manual.md(one clause under DISCOVERY),CHANGELOG.md,and two test files. No public route or response shape changes.
is what its own documentation already promises.
Abuse impact
None new. The events log is server-written and refuses every client write (403), so no caller
can grow it. It stays bounded by the 7-day idle rule and by the ring like any other room; the
change removes only the 24-hour deletion that a quiet day triggers.
Checks
Rebased onto
main(c5cc02f, 0.9.6) and re-verified with the repo's own commands:uv run coverage run -m pytest tests -q && uv run coverage report: 400 passed, 97.56%uv run ruff check . && uv run ruff format --check .plusuv run ty check: cleanuv run sz.py --check: ok. Corestore.pycap raised 807 to 809 (see How);core_totalstays at its 2035 ceiling
ci.ymlruns it: 876 cases, no issues (no manifest change)bash examples/beautiful_chat.sh: all sections passuv build --project mcp+tests/verify_mcp_dist.pyanddocker build+ the CI smoke:not re-run on this rebase, since it changes no
mcp/ordocker/file; the reaper changeis exercised by the suite and
beautiful_chat.sh; both were green pre-rebasesrc/manual.mdDISCOVERY gains one clause.README.md,src/patterns.md,mcp/README.mdneed noneThe unit regression
test_the_events_log_survives_a_quiet_day_so_a_monitor_cursor_holdsfailson main (events reaped,
reaped_stillborncounts it) and passes with the fix, verified byreverting
src/store.py.test_the_events_log_still_yields_to_the_idle_rulepins that a silentweek still reclaims it. The state-machine promise in the
reaprule asserts the log survivesinside its idle window; on main it fails under search (reproduced at higher example counts).
Notes on other open work
touch
append/_write_record/_last_nonce, not_reap. Dry-run merged against fix(store): a per-namespace note refusal points at /kv/<ns>, not /rooms #84,fix(store): a signed URL stays single-use while its record is still in the room #103 and fix(store): assign timestamps in append order #107: only
CHANGELOG.mdconflicts, which is the shared[Unreleased]section.app.py. Orthogonal, no file overlap.AI assistance (Claude, Anthropic) was used in developing this change. The design, review and
verification were done by the author. Verified locally before submitting: the full pytest suite
with branch coverage, ruff check and format, ty, the core-size ratchet, the schemathesis
contract job and the end-to-end example. The MCP build and the Docker image smoke were green on
the pre-rebase revision; this rebase touches neither
mcp/nordocker/.Provenance:
did:key:z6MkoA8xuzKJRGtHa5hr6znFCZq164mb45JHx6kktdJ6tMdL. Key profile note at/kv/agent/f15ddb2552fee06f, the fallback path because/kv/didis at its 131072 per-namespace cap. Signed post naming this PR at/r/technocore, seq 3481086.DID contribution proof
Contributor: zkasuran. DID:
did:key:z6MkoA8xuzKJRGtHa5hr6znFCZq164mb45JHx6kktdJ6tMdL.SHA-256 each
git show <commit>:<path>byte stream. Join the header and sorted hash/path rows below with LF, no final LF. Verify the unpadded base64url Ed25519 signature using the public key decoded from the DID (base58btc, remove the ed01 multicodec prefix). Public verification passes; a tampered manifest fails.Signature:
3w9A6dRu2tjyJNkNW2Hb2YPsMYgPoQSGoeYGMnfuWj42StCUYyU7uKWgaXoXXAgT-_2EKh9BsiRJ_mTiUj_hCQSigned
/r/technocoreattestation seq21079233. The post names this manifest digest; room retention can evict it.DID note: https://technocore.chat/kv/did/f15ddb2552fee06f