Stop paying twice for a block a retry can still throw away
A memory whose block ends on the newest action is the one memory a player can reach: retry and take-switching both refuse anything else. Each retry of that turn withdrew the memory and wrote it again, and a block closes every six actions while a normal turn writes two, so that was one turn in three. SETTLE_SLACK asks for one action past a block before the block is summarized. The block is still MEMORY_INTERVAL actions; only the moment moves. This is not the pre-SP4 holdback returning: that one was about a retry rewriting text in place, which sibling attempts and forget_node settled, and correctness still rests on the withdrawal rather than on the slack. Undo and delete can carry a summarized node back to the tip, so the withdrawal path stays reachable, just rarely. The slack buys nothing back. The block that just closed is still in the history window in full, so a memory of it says what the model can already read. Tests: the settling suite asserts the new rule and that a retry at the tip finds nothing to withdraw; the rewrite suite builds thirteen actions so both of its blocks settle; the one path test that ended on a block boundary sets the slack to zero, because it is about which actions a block is read from rather than about when a block forms. 632 green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NcrxCJjqgDvAkamKeLWdn
This commit is contained in:
@@ -290,7 +290,10 @@ async def _generate_turn(
|
||||
# longer describes the story. Withdraw the memory attached to the node
|
||||
# and return that stretch to both passes. Before SP4 this code was
|
||||
# unreachable, because the summarizer held the newest action back until
|
||||
# a turn landed on top of it. See `memorybank`.
|
||||
# a turn landed on top of it. `memorybank.SETTLE_SLACK` keeps a memory
|
||||
# off the tip again, for cost rather than for correctness, so this is
|
||||
# now the rare case: undo or delete can carry a summarized node back to
|
||||
# the tip, and then a retry of it lands here. See `memorybank`.
|
||||
memorybank.forget_node(db, adventure, retry_of)
|
||||
cursors.rewind_all(adventure, retry_of.branch_id, ai_depth - 1)
|
||||
# Flush so the new attempt has an id. The session does not autoflush,
|
||||
|
||||
Reference in New Issue
Block a user