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:
@@ -334,6 +334,10 @@ def test_a_block_is_summarized_from_the_path_and_hung_off_its_last_node(
|
||||
db, adventure, settings, ids = forked
|
||||
monkeypatch.setattr(memorybank, "MEMORY_START", 0)
|
||||
monkeypatch.setattr(memorybank, "MEMORY_INTERVAL", 4)
|
||||
# This test is about which actions a block is read from, not about when a
|
||||
# block forms, so switch the settling slack off and let the path end on a
|
||||
# block boundary. `test_memory_settling` owns the timing rule.
|
||||
monkeypatch.setattr(memorybank, "SETTLE_SLACK", 0)
|
||||
|
||||
class Stub:
|
||||
def __init__(self):
|
||||
@@ -347,8 +351,7 @@ def test_a_block_is_summarized_from_the_path_and_hung_off_its_last_node(
|
||||
monkeypatch.setattr(memorybank, "summary_provider", lambda s: stub)
|
||||
asyncio.run(memorybank._create_due_memories(adventure, settings, db))
|
||||
|
||||
# Two blocks of four from a path of eight, and since SP4 nothing is held
|
||||
# back, so both form in one pass.
|
||||
# Two blocks of four from a path of eight, both formed in one pass.
|
||||
first, second = stub.excerpts
|
||||
assert "A5" not in first + second, "a sibling's narration reached the summarizer"
|
||||
assert ["A0", "A1", "A2", "A3"] == [line for line in first.split() if line[0] in "ABC"]
|
||||
|
||||
Reference in New Issue
Block a user