wake always ends with 'awake.', even when the memory fits one part

AGENTS.md tells the agent to run parts until one says 'awake.' A one-part
memory printed no terminator, so the word never arrived.
This commit is contained in:
victortaelin 2026-07-25 17:12:11 -03:00
parent 672cbbdb9c
commit fdcc92eeea
2 changed files with 9 additions and 1 deletions

4
memo
View file

@ -339,7 +339,9 @@ def cmd_wake(d, args):
print("\n".join(parts[k - 1])) print("\n".join(parts[k - 1]))
if k < len(parts): if k < len(parts):
print("next: memo wake %d %d" % (k + 1, T)) print("next: memo wake %d %d" % (k + 1, T))
elif len(parts) > 1: else:
# always, even for a one-part memory: the contract an agent is given
# is "run parts until one says awake", so it must always arrive
print("awake.") print("awake.")

View file

@ -250,6 +250,12 @@ r = subprocess.run(memo + ["recall", "right after a torn write"], env=env2,
capture_output=True, text=True) capture_output=True, text=True)
check("#%d " % P in r.stdout, "the memory after a torn write reads wrong") check("#%d " % P in r.stdout, "the memory after a torn write reads wrong")
# a memory small enough to fit one part must still end with the terminator
# the agent was told to wait for
r = subprocess.run(memo + ["wake"], env=env2, capture_output=True, text=True)
check(r.stdout.rstrip().endswith("awake."),
"a one-part wake never says `awake.`:\n" + r.stdout)
shutil.rmtree(d2) shutil.rmtree(d2)
shutil.rmtree(d) shutil.rmtree(d)
print("\n%d passed, %d failed" % (ok, fail)) print("\n%d passed, %d failed" % (ok, fail))