Answer stability round 1: 1 🔴, 4 🟡 (0 misread); check a new chunk's Touches against every held item, keep a stopped chunk's items, test the fetch and fold the slot loop back

This commit is contained in:
2026-11-16 12:46:07 +01:00
parent fbd1b5e99d
commit fa9d487afd
8 changed files with 148 additions and 58 deletions
+10 -1
View File
@@ -14,6 +14,8 @@ NEEDED = (3, 2)
# What a window's name ends in while its chunk waits for the human. tmux's status bar shows the name, and `!` after it once the bell rang.
WAITS = " ?"
BELL = "\a"
# The session option that names the checkout whose chunks the session runs, since two checkouts' keys may map to one session name.
OWNER = "@loop-root"
@dataclasses.dataclass(frozen=True)
@@ -72,11 +74,18 @@ def start_window(window: Window, cwd: str, env: typing.Mapping[str, str], comman
done = run([*make, "-n", window.name, "-c", cwd, *variables, "-P", "-F", "#{window_id}", "--", *words])
if done.returncode:
return Failure(f"tmux could not start the window {window.target}: {done.stderr.strip() or f'it exited {done.returncode}'}")
# By the ID, since a window of the same name may still be closing. A loop that fails before this lands closes its window, and its stop is still sent as a DM.
if first:
run(["set-option", "-t", f"={window.session}", OWNER, cwd])
# By the ID, since a window of the same name may still be closing. A loop that fails before the option is set closes its window, and its stop is still sent as a DM.
run(["set-option", "-w", "-t", done.stdout.strip(), "remain-on-exit", "failed"])
return None
def owner(session: str, run: Tmux) -> str:
"""The checkout whose chunks session runs, as OWNER names it; empty where it names none."""
return run(["show-options", "-qv", "-t", f"={session}", OWNER]).stdout.strip()
def close(window: Listed, run: Tmux) -> None:
run(["kill-window", "-t", window.id])