Answer stability round 1: 0 🔴, 8 🟡 (0 misread); keep Ask.asked in seconds and stamp it only in its file, keep the dated-heading rule in one function and the preflight's wording in chunk_preflight, match the heading line itself, and test a device path, a tagged repo with a dated heading, an untagged one without, and the wording where nothing is cut

This commit is contained in:
2026-11-04 21:25:16 +01:00
parent 0a47507756
commit 8a35412a0a
13 changed files with 98 additions and 54 deletions
+4 -11
View File
@@ -12,7 +12,6 @@ import typing
from loop_claude.waiting.ask import Ask, Asking, OpenInInbox, OpenOnTerminal
from loop_claude.running_loops import RunningLoop, Taken
from utc_stamp import seconds
from loop_claude.waiting.talk import TALK
ENTER = "enter"
@@ -109,7 +108,7 @@ def listing_lines(screen: Listing, now: float, local_time: typing.Callable[[floa
lines = [*wrapped(head, width), ""]
for number, ask in enumerate(screen.shown, 1):
state = "" if isinstance(ask.state, Asking) else f"; claude is open {where_open(ask.state)}"
lines += wrapped(f"[{number}] {ask.root}, {waiting_since(ask, now, local_time)}{state}", width)
lines += wrapped(f"[{number}] {ask.root}, waiting since {local_time(ask.asked)} ({waited(now - ask.asked)}){state}", width)
lines += cut(wrapped(ask.question, width - len(INDENT) - len(ELLIPSIS)), SHOWN_LINES)
lines.append("")
lines += running_lines(screen.running, screen.shown, width)
@@ -140,7 +139,7 @@ def item_line(item: Taken | None) -> str:
def answering_lines(screen: Answering, now: float, local_time: typing.Callable[[float], str], width: int) -> tuple[list[str], list[str]]:
"""The question, in lines of at most width characters, and its foot, the prompt for the answer."""
ask = screen.ask
head = f"{ask.root}, {waiting_since(ask, now, local_time)}:"
head = f"{ask.root}, waiting since {local_time(ask.asked)} ({waited(now - ask.asked)}):"
return [*wrapped(head, width), "", *wrapped(ask.question, width), ""], typed_after(ANSWER_PROMPT, screen.typed, width)
@@ -169,14 +168,8 @@ def cut(lines: list[str], count: int) -> list[str]:
return [*shown[:-1], f"{shown[-1]}{ELLIPSIS}"] if len(lines) > count else shown
def waiting_since(ask: Ask, now: float, local_time: typing.Callable[[float], str]) -> str:
"""When ask's loop asked, in local time, and how long it has waited."""
asked = seconds(ask.asked)
return f"waiting since {local_time(asked)} ({waited(now - asked)})"
def waited(span: float) -> str:
minutes = int(span // 60)
def waited(seconds: float) -> str:
minutes = int(seconds // 60)
if minutes < 60:
return f"{minutes} min"
hours, minutes = divmod(minutes, 60)