Answer stability round 1: 0 🔴, 3 🟡 (0 misread); give an awaits-a-slot chunk no since, print the time in UTC and keep the status lines tested once

This commit is contained in:
2026-11-19 02:17:48 +01:00
parent 3e2e0ae5bf
commit ed58379da0
5 changed files with 22 additions and 36 deletions
+10 -7
View File
@@ -1,24 +1,24 @@
"""What `do-epic <EPIC-KEY> --status` prints: each open issue of the epic, with whether its chunk runs, asks the human, is parked on a gate, has stopped or has yet to start (docs/decisions.md → `do-epic: drives one Jira epic …`)."""
"""What `do-epic <EPIC-KEY> --status` prints: a line per open issue of the epic (docs/decisions.md → `do-epic: drives one Jira epic …`)."""
import datetime
import pathlib
from agent_cycle import tmux
from do_epic.backend.protocol import EpicIssue
from do_epic.parked import file_of, Parked, parked_chunks
from do_epic.parked import file_of, Parked, parked_chunks, SLOT
from do_epic.scheduler import chunks, STATE
from failure import Failure
def since(folder: pathlib.Path, chunk: Parked) -> str:
"""`, since <time>`, the time the chunk parked on what its file says it awaits, to the minute in the machine's time zone: the file is written once per gate, so its time is when the gate began. Empty where the file cannot be read."""
"""`, since <time>`: when the chunk's pull request began to await the gate its file records, to the minute in UTC, since the machine may be one the human reaches over ssh. The file is written once per gate. Empty where the file cannot be read."""
try:
return f", since {datetime.datetime.fromtimestamp(file_of(folder, chunk.issue).stat().st_mtime).strftime('%Y-%m-%d %H:%M')}"
return f", since {datetime.datetime.fromtimestamp(file_of(folder, chunk.issue).stat().st_mtime, datetime.timezone.utc).strftime('%Y-%m-%d %H:%M')} UTC"
except OSError:
return ""
def lines(key: str, home: pathlib.Path, issues: list[EpicIssue], run: tmux.Tmux) -> list[str] | Failure:
"""A line per open issue of the epic called key, in the tracker's rank order: that its chunk runs or asks the human, or why it waits. It doesn't start anything and checks no limit, so the line of a chunk that has yet to start doesn't say which limit holds it back."""
"""A line per open issue of the epic called key, in the tracker's rank order: that its chunk runs or asks the human, or why it waits. It doesn't start anything or check any limit, so the line of a chunk that has yet to start doesn't say which limit holds it back."""
found, waits = chunks(issues)
folder = home / STATE / key
parked = parked_chunks(folder)
@@ -31,8 +31,11 @@ def lines(key: str, home: pathlib.Path, issues: list[EpicIssue], run: tmux.Tmux)
reasons = {wait.issue: wait.reason for wait in waits}
for chunk in found:
if chunk.issue in parked:
when = since(folder, parked[chunk.issue])
reasons[chunk.issue] = parked[chunk.issue].waits(live[chunk.issue].awaits) + when if chunk.issue in live else f"{parked[chunk.issue].waits('')}{when}, and its window stopped; {again}"
shown = live[chunk.issue].awaits if chunk.issue in live else ""
# Past its gate, a chunk that awaits a slot has no time the file knows: the file's is when its gate began.
when = "" if shown == SLOT else since(folder, parked[chunk.issue])
stopped = "" if chunk.issue in live else f", and its window stopped; {again}"
reasons[chunk.issue] = parked[chunk.issue].waits(shown) + when + stopped
elif chunk.issue not in live:
reasons[chunk.issue] = f"its window stopped; {again}" if chunk.issue in {window.name for window in windows} else f"it has not started; `do-epic {key}` starts it once the epic and its repo have room"
return [line(issue.key, reasons, live, session) for issue in issues if issue.key in reasons or issue.key in live]