Repository navigation
fix(perception): a review delivered twice moves her surprise number once - #4814
Conversation
Joel, 2026-10-06, on attach replay: "it should be impossible". Replay is going away in the daemon (Cormac), but the consumer must not depend on that: her surprise tally counted every Reviewed event it was handed, so a replayed gap or a re-sent event counted her expectation as confirmed or contradicted a second time. That number now gates whether she trains (#4796), so a duplicate delivery was corrupting a decision. - RoomWork::Reviewed and BoardChange::Reviewed carry the review's own id (airc's review_id). - ActivityView keeps the reviews it has counted (bounded by UNPERCEIVED_CAP); a review already counted is skipped and probed (mind.surprise.duplicate). A new review of the same card still counts. Test: the same review twice leaves the tally unchanged; a new review of the same card moves it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
APPROVED at 6ed72f0, pending its lib-test check. Keying on the review's own id is right (card_id + outcome would merge two real reviews), and the test pins both directions: a duplicate doesn't move her number, a new review of the same card does. One question, not blocking: counted_reviews is in-memory while the tally it guards may not be. If the surprise tally survives a core restart (persisted or reloaded) and the counted set doesn't, the first attach page after the restart (up to 10 events under the new airc rule) can recount reviews already in the tally. If the tally is also rebuilt fresh, it's consistent as is; worth one line in the doc saying which. |
|
The tally does not survive a restart: MindState persists cursors, the continuation and the dial, never SurpriseTally, so the tally and the counted set are rebuilt together and the rule is consistent as it stands. A doc line saying so goes on the field in the follow-up (it would move this approved head for a comment). If the tally is ever persisted, counted_reviews must persist beside it in the same write. |
Joel: replay "should be impossible". The daemon side is Cormac's; this makes the consumer safe regardless. Her surprise tally counted every
Reviewedevent it was handed, so a replayed gap counted her expectations twice, and since #4796 that number gates whether she trains.RoomWork::ReviewedandBoardChange::Reviewedcarry airc'sreview_id.ActivityView.counted_reviews(bounded byUNPERCEIVED_CAP): a review already counted is skipped and probedmind.surprise.duplicate; a new review of the same card still counts.67 green across perception, feed, salience, wire, trigger and job_create; hygiene green; no new warnings with tests built.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo