Repository navigation
Conversation
Only the retired dispatcher loop recorded and routed lane questions, so on factory-harness/3 runs a question a lane asked reached no seat and the lane waited. The lane watchdog now records each question it reads, in typed responses (claude, codex) or on the pane at turn end (cursor, agy, whose stop reports carry no text), and messages both seats' inboxes, which wakes them, with the spec-answer command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Confidence Score: 2/5
Summary
Routes lane FACTORY_QUESTIONs to both seats via log and pane scraping. The per-turn pane re-scrape resurrects answered questions (verified), which re-wakes seats, blocks freeze and masks stalls; the answer instruction is also wrong.
Important Files Changed
| File | Overview |
|---|---|
| harness/lane_watchdog.py | Adds question extraction from log and pane; forwards to orchestrator and validator inboxes |
| tests/test_lane_question_forwarding.py | Covers parsers and idempotence; no turn-end, answered-question or tmux-failure coverage |
Reviewed 2488390...d0e86c1 · ↻ Re-run review · View in Adapt
| # Cursor's and agy's stop reports carry no text: a question asked there is on screen. | ||
| resolved = window_id(str(launch.get("tmux_target", "")), self.tmux) | ||
| if resolved is not None: | ||
| shown = self.tmux("capture-pane", "-p", "-J", "-t", resolved, "-S", "-120") |
There was a problem hiding this comment.
Each turn end re-scrapes 120 rows; record_question dedupes only open questions, so an answered question still on screen is re-recorded (verified Q-0001 -> Q-0004) and both seats are re-told.
| if resolved is not None: | ||
| shown = self.tmux("capture-pane", "-p", "-J", "-t", resolved, "-S", "-120") | ||
| if shown.returncode == 0: | ||
| self._forward_questions(launch, _screen_questions(shown.stdout)) |
There was a problem hiding this comment.
A resurrected phantom question resets hold_ts (masks stall stop) and fails require-clear at freeze; track told question texts per session in watch state, or scrape only rows new since the last turn end.
| continue | ||
| text = (f"FACTORY_QUESTION {row['question_id']} from the {lane} lane, which is waiting " | ||
| f"for an answer:\n{question}\nAnswer it with lane_dialogue.py plan " | ||
| f"--message-kind spec-answer --question-id {row['question_id']} --lane {lane}.") |
There was a problem hiding this comment.
Instruction is unusable: plan takes --kind not --message-kind, needs --sender/--message-file/--basis/--authority, does not deliver; point to tmux_lane_message.sh validator answer and tell the Orchestrator it cannot answer.
| f"--message-kind spec-answer --question-id {row['question_id']} --lane {lane}.") | ||
| for recipient in ("orchestrator", "validator"): | ||
| try: | ||
| run_record.message(self.root, recipient, "host", text) |
There was a problem hiding this comment.
run_record.message with no wait_s blocks the watchdog forever on a held inbox lock; pass wait_s=run_record.SUPERVISOR_WAIT_S as every other watchdog lock wait does.
| that fails is retried from the record and the turn end is never lost.""" | ||
| lane = str(launch.get("lane") or self.slot) | ||
| # Cursor's and agy's stop reports carry no text: a question asked there is on screen. | ||
| resolved = window_id(str(launch.get("tmux_target", "")), self.tmux) |
There was a problem hiding this comment.
window_id/capture-pane here are unguarded and run before the turn end is written; a TimeoutExpired/OSError escapes check() and loses the turn end. Wrap like _evidence and move after _write_state.
| row, new = lane_dialogue.record_question(self.root, lane, question) | ||
| except (OSError, ValueError, lane_dialogue.LaneDialogueError): | ||
| continue | ||
| if not new: |
There was a problem hiding this comment.
new=False skips telling: a question codex_lane_session already recorded (codex-ollama) or whose inbox write failed is never forwarded; the retired dispatcher told on created-or-not-yet-notified. Track told ids in state.
| _questions = _question_parser() | ||
|
|
||
| chrome = re.compile(r"^[\s│┃|●⏺•>*-]+|[\s│┃|]+$") | ||
| return _questions("\n".join(chrome.sub("", line) for line in screen.splitlines())) |
There was a problem hiding this comment.
Screen parser glues following non-blank UI rows (status line, box borders) into the body, so screen text differs from the typed-log text and claude/codex lanes get the same question recorded and told twice.
| harness = str(pathlib.Path(__file__).resolve().parent) | ||
| if harness not in sys.path: | ||
| sys.path.insert(0, harness) | ||
| from codex_lane_session import _questions |
There was a problem hiding this comment.
Importing private _questions from the Codex session driver pulls in trusted_start/codex_hook_admission and emits a 'truncated by codex_lane_session' marker; move the parser into lane_dialogue.
|
|
||
| def test_screen_questions_read_past_agent_ui_chrome() -> None: | ||
| screen = "│ ⏺ FACTORY_QUESTION: Merge dev first? │\n│ ok │\n\n> prompt" | ||
| assert lane_watchdog._screen_questions(screen) == ["Merge dev first?\nok"] |
There was a problem hiding this comment.
Asserting 'Merge dev first?\nok' locks in chrome absorption as intended; add tests for answered-then-rescraped, _record_turn_end tmux failure, and the inbox wait bound.
…r step - Questions told are remembered per lane life (questions_told, keyed by first line), so an answered question still on screen is neither re-recorded nor re-told, and a typed and on-screen copy are told once. A failed telling is retried. - Inbox writes wait at most SUPERVISOR_WAIT_S. - The pane is read after the turn end is on record, guarded. - The screen parser takes only the marker's own line. - The message names the Validator's real answer command and says the Orchestrator cannot answer specifications. - The FACTORY_QUESTION parser moves to lane_dialogue (questions_in); codex_lane_session imports it, so the watchdog no longer imports the Codex session driver. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed in f95e71d:
@adaptcom review |
|
Prior blockers are fixed in f95e71d, and nothing here blocks merge. Ruff and mypy are clean, and the forwarding, dialogue, turn-end and question-correction tests pass. I'd score it 4/5. Two gaps I reproduced, both non-blocking:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e the slot 1. questions_told was not carried into a new watcher life (arm(new_life=True), used by tmux_lane_message.sh when it resumes a lane), so an answered question still in the scraped rows was recorded again as a new pending question, both seats were woken again and hold_ts kept resetting. arm now carries the told set (only string keys, the last _TOLD_CAP=200) and any partial telling across lives. 2. The answer command named launch["lane"] (tester-b) where tmux_lane_message.sh needs the slot (tester-b.r3); for a lane launched with --round the command pointed at a launch journal that does not exist. It now names self.slot; the question is still recorded, and introduced, under the lane. 3. When one seat's inbox write failed the whole telling failed and the retry wrote again to the seat already told. _tell_seats(state, key, text) now keeps the seats already told in state["seats_told"][key] until both are, writing only to the seat still owed it; pr168's dialog notice inherits this through the shared helper. Chosen over once_since/inbox_end: the same guarantee without an extra locked inbox read per telling, and the record rides the state the watcher already writes after each observation. CHANGELOG ### Fixed line added (the PR had none). Checks: ruff and mypy clean on harness/lane_watchdog.py; stubbed smoke run: a validator write failure then retry gives one row per seat; the command names tester-b.r3; after arm(new_life=True) the same question is neither recorded nor told again. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
f870b50 made questions_told last the lane's whole life and applied it to every question, keyed on the first line, so a lane that asked the same question again after an answer (unsatisfying, or never delivered) was never recorded or told again and waited on a question nobody saw. The told set now gates only questions read from the screen (the turn-end capture reads scrollback, where answered questions resurface); it is still carried across watcher lives for that path. A question from the typed log is new lane output by construction (read by offset), so it is always recorded and told; only when the journal returns the same still-unanswered question already told is it not told again. Its key joins the told set, so its screen copy is not told twice. Seat tracking is now keyed by question id (record_question returns the same id for an unanswered question), so a re-ask after an answer is its own telling, each seat once. The docstring states the limit: screen-only lanes (Cursor, agy) cannot tell a genuine re-ask of the same first line from scrollback. Checks: ruff and mypy clean on harness/lane_watchdog.py; smoke run with a journal stub that dedupes unanswered questions as record_question does: partial telling retried from the screen copy reaches only the missing seat; repeated screen and log copies of an unanswered told question are not told again; after an answer and arm(new_life=True) the scrollback copy is not recorded or told; a typed-log re-ask is recorded (Q-0002) and told to each seat once, and its screen copy is not. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
A failed telling was retried only when the same question was scanned again (new typed-log output or the next turn end's capture). A lane that has just asked waits, so it produces neither: a seat whose inbox write failed was never told, and a question whose recording failed (OSError, journal lock) was dropped. _forward_questions now only owes each question (state["questions_owed"]: key, lane, question, question_id once recorded) under the same rules as before (screen copies of told keys are not owed; typed-log questions always are), then _settle_questions records and tells what is owed. It runs on every check: from _scan_output on a watching check (with or without new output), and from check() when the check did not scan (paused, wrapping, stopping, ended). An entry leaves the queue only once both seats have it, each seat told once (_tell_seats keyed by question id); nothing more is told after that. A journal answer of the same still-unanswered question already told, or already owed under that id, is not owed twice. The first journal or inbox that cannot be written ends the attempt, so one check waits on at most one recording and one telling (SUPERVISOR_WAIT_S per seat); a question that cannot be recorded as it stands (validation error) stays owed without blocking the rest. The queue is in the watch state the watcher already writes, bounded at _OWED_CAP=50 (oldest dropped), validated and carried into a new life by arm. Checks: ruff and mypy clean on harness/lane_watchdog.py; smoke run: a screen question whose validator write fails is told to the validator alone on a later check with no new output, and nothing more on three further checks; a recording that fails twice is recorded and told on a later check; an owed telling survives arm(new_life=True) and is finished by a check while paused, then nothing more. The earlier re-ask smoke run still passes. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
…atch poll Replaced tests/test_lane_question_forwarding.py. The old file called LaneWatch._forward_questions on a SimpleNamespace stand-in, patched lane_dialogue._answered_question_ids and run_record.message, and asserted watcher state (questions_told); deleting the watcher's own forwarding calls left it green. It also unit-tested the private parsers _questions_in and _screen_questions; their behaviour is now asserted through check(). Every test drives LaneWatch.check() through the Lane fixture of tests/test_lane_turn_end.py. ScreenLane adds only what its tmux double lacks: capture-pane printing a screen (or raising), and a window named for the slot (launch row tmux_target r1:<slot>). Question rows are inbox rows that carry the question text and are not the FACTORY_LANE_TURN_ENDED notice. 1. typed path (claude, codex-interactive): question only in the native stop report -> one pending question, one row per seat; a FACTORY_QUESTION line in tool output is not a question. 2. screen path (Cursor, textless stop report; question inside UI chrome) -> the same, recorded without the chrome. + a question both typed and on screen is told once. 3. a second turn end with the question still visible adds nothing. 4. answered through plan_message + record_delivery, new watcher life (arm(new_life=True)), turn end with the stale line on screen -> no pending question, no new question rows. 5. capture-pane raising TimeoutExpired / OSError at a turn end -> the turn-end notice (event + wake + Validator inbox row) is still delivered. 6. slot tester-b.r3 (lane tester-b): every tmux_lane_message.sh command in the Validator's row is `<run> validator tester-b.r3 answer`. 7. one seat's inbox.jsonl is a directory at the turn end, then removed -> each seat ends with exactly one question row (parametrized per seat). No patching; the inbox fault is a real filesystem fault. Assumption: the Codex interactive lane's record uses the stop_reports counter and stop-reported phase like Claude's (the brief groups them as the native-stop-report path). If the Codex case fails only on that, the fixture record is what to correct. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
… new Validator clarification: only stale screen text is suppressed. Added the positive pair to the stale-screen test: a Claude lane's question is answered through plan_message + record_delivery; then, in the same watcher life or after arm(new_life=True), a new native stop report bound to a new turn asks the identical question. Expected: one pending question with a new question_id and exactly one new question row per seat (two in total). Screen-only re-asks (Cursor/agy) are a documented limitation and are not tested. The answer steps now live in one helper shared with the stale-screen test; that test's assertions are unchanged. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
wandercom#168 is stacked on wandercom#167. This brings in wandercom#167's review repairs and tests (4cc5d0c). Conflicts resolved by keeping both sides: wandercom#168's _tell_dialog with wandercom#167's _settle_questions and _tell_seats(state, key, text). _tell_dialog's call now passes the dialog digest key, the same adaptation the Coder made. wandercom#168's hook-trust classification test is kept until the next test commit moves it. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
|
Tested this live: a Factory build of chiron What works: the Cursor Tester's Blocking, seen on the live run:
Non-blocking:
Tests: full suite on macOS shows no new failures against |
1. Every Codex question was recorded twice: whole from the typed log, then from the turn-end screen capture as only its first wrapped row (Codex wraps its own text at the pane width, which capture-pane -J cannot rejoin), under a different key. The screen is now read for questions only for agents whose stop reports carry no text (SCREEN_QUESTION_AGENTS: cursor-agent, agy). Claude and Codex questions arrive whole on the typed path and are never read again from the screen, which removes both the duplicate and the cut copy. For Cursor/agy the dedupe key stays the question's first line, which there comes only from the screen, so the cross-life screen suppression keeps its meaning. (The rule the Validator settled with the Orchestrator; prefix matching was not taken.) 2. A screen question was cut at the wrap. _screen_questions now reads the marker row and the rows that continue it, up to the end of its message block: a blank row (inside a box too), a prompt row (> ❯ ›), a new message bullet, a row of box drawing alone, or another marker; at most QUESTION_SCREEN_ROWS=12. UI chrome below the block is never glued in. A marker whose text starts on the next row is read from there. 3. The answer command no longer contains `human-answer|task-specification`, which a shell reads as a pipe: it says --authority AUTHORITY and names the two values in the prose after it. CHANGELOG line extended. Checks: ruff and mypy clean on harness/lane_watchdog.py. Smoke runs: a Codex- style wrapped question ending at a blank row and prompt, a Claude-style marker with text on the next row ending at a box border, a prompt row directly below, a boxed one-row question, a continuation starting with "$5", two adjacent markers, an empty marker; the turn-end path captures and reads the screen for cursor-agent and agy only, not for codex-interactive or claude. Earlier owed-question and re-ask smoke runs still pass. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
…mand Human reviewer's live findings (via the Validator), all through LaneWatch.check() with the ScreenLane fixture: 1. a Codex lane whose stop report carries a question wider than the pane, drawn by Codex across two 80-column lines (marker on the first): one pending question, one notice per seat. 2. a screen-only (Cursor) lane showing a question the agent word-wrapped across four lines, then a blank row, the prompt row and a status row: the recorded question is the whole text, without the UI rows. 3. "FACTORY_QUESTION:" alone, the question on the next line: recorded with that text. 4. the answer command in the Validator's notice (the backticked span naming tmux_lane_message.sh, else the rest of its line), shell-split, has no operator token (| ; & < > ( )) and exactly one value after --authority (no |, not empty, not a flag). Question text is compared whitespace-insensitively (runs of whitespace folded) so lines the agent drew compare equal to the one-line typed copy; _asked and _told_once use that comparison. The earlier tests keep their inputs and expectations. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
…screen fixture Validator round 3: test_a_screen_question_is_recorded_and_told_once_to_both_seats drew `│ ⏺ FACTORY_QUESTION: ... │` directly over `│ status bar │` in the same box, and the candidate recorded "... preserved? status bar". This round's rule (from the wrapped-question finding): a screen question continues over its message block's rows until a blank row, a prompt row, a new bullet, a row of box drawing only, or another marker. An unseparated row in the same box is indistinguishable from a wrapped continuation, so the fixture, not the candidate, was wrong. The pane now draws the message box with its top and bottom border rows, then the status row, a blank row and the prompt. The intent is unchanged: the chrome around the marker is stripped and the UI below the box is not taken into the question. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
The notice read "... --authority AUTHORITY (AUTHORITY is human-answer or task-specification). ..." on one line; copied from the script name to the end of the line, the parentheses are shell syntax. The command is now alone in a backticked span, `harness/tmux_lane_message.sh RUN validator SLOT answer --question-id ID --answer-file FILE --basis BASIS --authority AUTHORITY`, and the explanation of AUTHORITY follows it outside the backticks. Nothing else in the notice changes. Checks: ruff and mypy clean; the backticked span of a generated notice shlex- splits to the script, run, validator, the slot, answer ... --authority AUTHORITY and holds no ( ) | ; & < >. Earlier pr167 smoke runs pass. FactoryRun: review-chiron-prs Built-By: Factory v0.8.31
|
Thanks for testing this live, Shane. Replies to your review, checked at
|
|
Landed as part of #168, which contains this branch's tested head ( |
Lane questions never reached the Orchestrator. Only the
Dispatcherpane-scan loop recorded and routedFACTORY_QUESTION, and that loop can't run on current runs: it needs--observeand refuses anything butfactory-harness/2, while runs are nowfactory-harness/3. Everydialogue/journal.jsonlhad zero questions, although lanes asked them (booking-kafka-events tester, auth-guardrails-215 coder, plat-5197 tester). The Orchestrator only found them minutes later, by reading lane logs.The lane watchdog already reads every lane's output. It now:
FACTORY_QUESTIONfrom typed responses (claude, codex) and, at each turn end, from the pane's last rows (cursor and agy stop reports carry no text);lane_dialogue.record_question, which is idempotent per open question;spec-answercommand that answers it.Tests: new
tests/test_lane_question_forwarding.py. The turn-end, watchdog, dialogue and lane-control suites pass.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.