Skip to content

Tell the Orchestrator at once when a lane stops at its agent's dialog - #168

Merged
shanebarakat merged 25 commits into
wandercom:mainfrom
CamTosh:fix/lane-dialogs-reach-orchestrator
Dec 4, 2026
Merged

shanebarakat merged 25 commits into
wandercom:mainfrom
CamTosh:fix/lane-dialogs-reach-orchestrator

Conversation

@CamTosh

@CamTosh CamTosh commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Includes #167 (merged in); review that first.

In prop-788 a sandboxed Codex Coder sat at "Hooks need review – 3 hooks are new or changed", and the Validator asked the human to run factory attach and answer it in tmux. The watchdog read the pane on every check, but it reported a dialog only after the 20-minute stall window, and only to the Validator.

Changes:

  • A lane stopped at its agent's own dialog is told to the Orchestrator and the Validator once the same dialog shows on two consecutive checks, instead of after the stall window. Nothing in the harness answers it: the notice says a person at the run must answer it, and which launcher setting keeps the next round from showing it (per dialog kind). The human is never sent to tmux.
  • New hook_trust pattern in seat_attention for Codex's hook-review screen. It needs the dialog's shape (a "Hooks need review" heading and a "Trust all and continue" option row in the pane's last rows), so ordinary agent output that mentions hooks does not match.
  • Wrapped dialog rows are joined only where the agent's text wrapped.

Tests in test_lane_dialog_hold.py drive the real LaneWatch poll: both seats told once after two sightings, told again when a cleared dialog returns, usage_limit not told, and negative controls for agent text that mentions hooks.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

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>

@adaptcom adaptcom Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confidence Score: 3/5

Summary

Tells both seats at once, once per dialog digest, when an interactive lane sits at a held dialog, and recognises Codex's hook-review screen. Additive and green, but the new notice path skips the watchdog's own lock-wait, retry and ledger rules, and the main behaviour is untested.

Important Files Changed

File Overview
harness/lane_watchdog.py At-once dialog notice to both seats via new _tell_seats; hook_trust added to HELD_DIALOGS
harness/seat_attention.py New hook_trust pattern; matches Codex startup_hooks_review strings
tests/test_lane_question_forwarding.py Pattern test only; no test of the at-once notice

Findings

  • Stacked on open PR #167 (d0e86c1); merging this lands both, so rebase if #167 changes under review.

Reviewed 2488390...5ef34a8 · ↻ Re-run review · View in Adapt

Comment thread harness/lane_watchdog.py Outdated

for recipient in ("orchestrator", "validator"):
try:
run_record.message(self.root, recipient, "host", text)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_record.message with no wait_s blocks the watchdog indefinitely on a held inbox lock; pass wait_s=run_record.SUPERVISOR_WAIT_S like the hold notices do.

Comment thread harness/lane_watchdog.py Outdated
if (isinstance(dialog, dict) and dialog.get("kinds") != ["usage_limit"]
and state.get("dialog_told") != dialog.get("digest")):
# At once, not after the stall window: a lane at its agent's own dialog does nothing.
state["dialog_told"] = dialog.get("digest")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dialog_told is set before the write and _tell_seats swallows failures with no record, so a failed write loses the notice until the stall window; mark told after success or post through validator_input.

Comment thread harness/lane_watchdog.py Outdated
state["evidence_at"] = current
dialog = state.get("dialog")
if (isinstance(dialog, dict) and dialog.get("kinds") != ["usage_limit"]
and state.get("dialog_told") != dialog.get("digest")):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dialog_told never resets when a live read shows no dialog, so the same dialog reappearing later (same digest) is not told at once (verified); clear it when state['dialog'] is None after a live read.

Comment thread harness/lane_watchdog.py Outdated
f"The {lane} lane is stopped at its agent's own dialog "
f"({', '.join(dialog.get('kinds') or [])}) and does nothing until it is answered. "
"Decide from the run: answer it through the lane, or relaunch the lane with "
"FACTORY_LANE_SANDBOX=off. Do not ask the human to attach or run tmux commands.")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same advice for every kind: for bypass_permissions (Claude Code's confirmation under --dangerously-skip-permissions, i.e. FACTORY_LANE_SANDBOX=off) the relaunch advice reproduces the dialog; tailor the text by kind.

Comment thread harness/lane_watchdog.py Outdated
self._tell_seats(
f"The {lane} lane is stopped at its agent's own dialog "
f"({', '.join(dialog.get('kinds') or [])}) and does nothing until it is answered. "
"Decide from the run: answer it through the lane, or relaunch the lane with "

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"answer it through the lane" names no instrument: tmux_lane_message.sh types messages and nothing in the harness answers a dialog (docs/HARNESS.md:444 says a person presses a/d); name the real step or drop it.

Comment thread tests/test_lane_question_forwarding.py Outdated
assert lane_watchdog._screen_questions(screen) == ["Merge dev first?\nok"]


def test_codex_hook_review_is_a_held_dialog() -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the pattern is tested; add a LaneWatch test (tests/test_lane_dialog_hold.py's Lane/Tmux fixture works) that both seats are told once per digest and usage_limit is not, ideally in that file rather than the question-forwarding one.

Comment thread harness/lane_watchdog.py
SESSION_WAITS = (*TURN_END_PHASES, "asking-operator")
#: Host dialogs a lane waits at: a person at the run can answer them (seat_attention).
HELD_DIALOGS = ("permission_prompt", "folder_trust", "bypass_permissions", "host_panel")
HELD_DIALOGS = ("permission_prompt", "folder_trust", "hook_trust", "bypass_permissions",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module docstring (lines 41-46) still says holds are told only to the Validator through validator_input; document the immediate host message to both seats and its idempotency key.

…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>
@CamTosh
CamTosh force-pushed the fix/lane-dialogs-reach-orchestrator branch from 5ef34a8 to 8e0f24d Compare December 4, 2026 15:30
@CamTosh

CamTosh commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Rebuilt on the updated #167 (8e0f24d):

  • Telling goes through Forward lane FACTORY_QUESTIONs to the Orchestrator and the Validator #167's _tell_seats, which has bounded waits. dialog_told is set only after both seats are told.
  • A live read showing no dialog clears dialog_told, so the same dialog returning later is told again.
  • The advice depends on the kind. For bypass_permissions, relaunching with FACTORY_LANE_SANDBOX=off would reproduce the dialog, so that advice isn't given. The message says nothing in the harness answers a dialog, and to tell the human in their conversation rather than send them to tmux.
  • The module docstring documents the immediate notice and its once-per-digest key.
  • Tests in test_lane_dialog_hold.py use its Lane/Tmux fixture: both seats told once and again when the dialog returns, usage_limit not told.

@adaptcom review

@adaptcom

adaptcom Bot commented Dec 4, 2026

Copy link
Copy Markdown

Everything from my last review is fixed at 8e0f24d. Ruff, mypy and the dialog-hold, question-forwarding and watchdog test files all pass; the new tests in test_lane_dialog_hold.py cover telling both seats, telling again when the dialog returns, and not telling for usage_limit. Score 4/5, nothing blocking.

  • Non-blocking, _tell_seats partial failure: if the Orchestrator's inbox write succeeds and the Validator's times out, dialog_told stays unset. The next check (every 30s by default) sends to both seats again, so the Orchestrator gets a duplicate each check until the Validator's lock frees. Fix: track which seats were told, or use run_record.message(once_since=...). The same pattern sits in Forward lane FACTORY_QUESTIONs to the Orchestrator and the Validator #167's question forwarding.
  • Nit: test_codex_hook_review_is_a_held_dialog would fit better in test_lane_dialog_hold.py than in the question-forwarding tests.

↻ Re-run review · View in Adapt

CamTosh and others added 2 commits December 4, 2026 16:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sandboxed Codex lane sat at "Hooks need review" and the Validator asked
the human to attach with tmux (prop-788). The watchdog read the pane each
check but reported a dialog only after the stall window, to the Validator.

It now messages the Orchestrator and the Validator as soon as a held dialog
appears: once per dialog digest, marked only after both are told, and told
again if the dialog goes and returns. The advice fits the kind (relaunching
with FACTORY_LANE_SANDBOX=off reproduces a bypass confirmation), says
nothing in the harness answers it, and tells the seats not to send the
human to tmux. Codex's hook-review screen is a held dialog (hook_trust).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CamTosh
CamTosh force-pushed the fix/lane-dialogs-reach-orchestrator branch from 8e0f24d to a01dcad Compare December 4, 2026 15:57
CamTosh and others added 11 commits December 4, 2026 17:12
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
… 80-col panes

1. Bypass Permissions confirmation: the notice now names a real step. tmux_lane.sh
   passes --dangerously-skip-permissions to Claude Code only for
   FACTORY_LANE_SANDBOX=off, so relaunching with the sandbox on omits the flag and
   the confirmation; a launcher that is the operator's own shell function chooses
   its own flags, and then a person at the run must answer it in the lane's window.
   (Accepting the dialog writes skipDangerousModePermissionPrompt to the operator's
   user settings, which the launcher does not control, so it is not named.)
2. Advice is per kind (DIALOG_STEPS) and names only what the launcher controls:
   host_panel is not a trust or permission prompt, so it gets no sandbox advice,
   only that a person must close it; folder_trust and hook_trust name
   FACTORY_SEAT_TRUST=1 (seat_trust.py, applied by lane_agent.py to Claude Code and
   Codex lanes, carried to launches by run_context.sh), not the sandbox, and make
   no claim that Codex's bypass flag skips the folder question; permission_prompt
   keeps FACTORY_LANE_SANDBOX=off, stated as the flag the launcher passes, only if
   the human agrees. The notice names the lane and its slot.
3. _dialog matched each pattern within a single bottom row; on tmux's default 80
   columns the bypass text wraps and was never detected. _wrapped_match joins runs
   of screen-adjacent non-blank rows (past borders/bullets) and treats the joined
   line as current exactly as a single row is: its last row must be among the
   DIALOG_BOTTOM_ROWS bottom rows, and it joins upward only within the TAIL_LINES
   rows dialog_rows already reads. Bounding the whole span to the bottom 5 rows
   was rejected: with the options and a footer below it, the wrapped line's first
   row is the 6th, and it would still be missed. No pattern is widened.

CHANGELOG ### Fixed line added.

Checks: ruff and mypy clean on harness/lane_watchdog.py; smoke run of _dialog on
80-column renderings of Claude Code 2.1.336's bypass dialog text (plain, with a
footer, boxed): detected, and wrapped vs unwrapped give the same outcome in every
layout; stale text scrolled above the bottom rows and halves split by a blank row
are not detected; per-kind notices tell both seats once with the advice above.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
… advice

All through the real LaneWatch poll with the Lane/Tmux fixture of
tests/test_lane_dialog_hold.py, checks inside the stall window (60 s).

1. Codex hook trust ("Hooks need review") through the real fixture: held
   past the stall window, told once, never answered. Removed the
   private-method classification test from test_lane_question_forwarding.py.
   + every blocking kind (Codex folder trust, Codex hook trust, Claude
   bypass confirmation, Claude host panel) is told to both seats at once.
2. a seat whose inbox.jsonl is a directory at the first check (a real write
   failure), then recovers: each seat ends with exactly one notice
   (parametrized per seat).
3/5. advice per kind, asserted on remedy names, not prose:
   - no notice for any kind contains a tmux command line (tmux followed by
     a subcommand or server flag; the bare word is allowed);
   - Codex folder/hook trust notices name FACTORY_SEAT_TRUST=1 (the remedy
     docs/HARNESS.md "Two trusts" gives);
   - the host-panel notice names neither FACTORY_LANE_SANDBOX=off nor
     FACTORY_SEAT_TRUST: no Factory remedy exists for it.
4. the Claude bypass dialog on an 80-column pane: the Wrapping double
   splits long lines into 80-column rows unless capture-pane asks -J to
   join them, as tmux does; it is told to both seats. Negative control:
   agent prose using the dialog's words on separate lines is not told.

Corrected the existing seat-notice helper and test: _seat_messages
filtered on a sentence of the notice prose and the test asserted the word
"tmux" was present (T4 phrase pins; the second contradicts the no-tmux
intent). The helper now returns every inbox row and is used only inside
the stall window, where a lane without a session record has nothing else
to tell.

Not yet asserted: the brief says the bypass notice names a concrete next
step, but states no remedy name; asked the Validator.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
41bf0c9 joined any adjacent non-blank rows upward from a bottom row, which in
effect widened the detection window: a "Do you want to proceed with the
migration?" line above five short "applied step" rows became a permission_prompt,
and ordinary prose on short rows that mentioned "running in Bypass" / "Yes, I
accept" became the bypass dialog and was told to both seats.

A row now continues into the next only when the agent wrapped it there: the next
row's first word would not have fitted after the row's text within the pane's
width (less WRAP_SLACK=2 columns for a box's padding and border). Text that ends
short of the width ended there. The joined line still counts only when its last
row is among the bottom rows, and reaches up no further than the rows dialog_rows
reads; a single matching row behaves as before; no pattern is widened.

Width: the pane's own, from tmux (#{pane_width}, read at the same live check as
the capture); when tmux gives no plausible value, tmux's default for a pane
created without one (80) or the capture's longest row if wider. The docstring
states the assumption that a row's characters are its columns (a wide character
makes a row look shorter, so it is not joined).

Checks: ruff and mypy clean on harness/lane_watchdog.py. Smoke run: Claude Code
2.1.336's bypass dialog text word-wrapped at 80 columns (indent 1, 2+1, 3, with a
footer) and at 100 columns is detected with the pane width and with the fallback;
at 120 columns it is one row and detected as before; both reviewer examples are
not dialogs; single-row host_panel and permission_prompt detection is unchanged;
halves split by a blank row are not joined. A boxed rendering is not detected,
wrapped or not: its border rows count as text, so the line is above the bottom
rows either way (the existing DIALOG_BOTTOM_ROWS bound; 41bf0c9 detected it only
by joining through those border rows). _pane_width rejects a missing or
implausible reply. Earlier pr167/pr168 smoke runs still pass.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
…x hard wrap

Validator finding: test_the_bypass_dialog_wrapped_on_an_80_column_pane_is_told
stayed green with the wrapped-row detection removed. Its Wrapping double
modelled tmux's own hard wrap, which capture-pane -J already undoes; the
real defect is Claude Code breaking its own text at word boundaries into
separate screen lines that tmux cannot rejoin.

Replaced Wrapping with:
- drawn(width, *lines): the agent's layout, each logical line word-wrapped
  into real lines of at most 80 columns, keeping its indent. The bypass
  sentence lands as "...while running in" / " Bypass Permissions mode.",
  and the test asserts that split so the fixture keeps exercising it.
- AgentPane: the Tmux double reporting #{pane_width} as 80 when asked.
The assertion is unchanged: each seat told once. The prose negative control
is unchanged apart from running on AgentPane; its rows were already short
lines the agent drew, never a hard wrap.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
@shanebarakat

Copy link
Copy Markdown
Collaborator

This contains #167, so the three blocking items there apply here too. The extra commit needs one change before it lands.

Blocking: hook_trust matches ordinary agent output. I ran LaneWatch._dialog on realistic panes:

Screen bottom Result
Real Codex dialog (Hooks need review – 3 hooks are new or changed + Trust all and continue) hook_trust ✅
• I'll warn when hooks are new or changed in the config. then the › prompt hook_trust ❌
- Show 'Hooks need review' when hooks change then the › prompt hook_trust ❌

Any lane working on hook-related code then gets announced to both seats as "stopped at its agent's own dialog", and the stall and wrap-up logic treats it as held. That covers Factory working on chiron itself, Signet and agent config. Please require the dialog's shape rather than any one phrase, e.g. Hooks need review and an option row like Trust all and continue, as folder_trust already does with its full option text.

Also: before, a held dialog was only reported after the stall window, which filtered out false matches. Now one poll is enough. Please require the same dialog digest on two consecutive checks before telling the seats. It's cheap, and it removes most of the risk above.

Non-blocking:

  • The usage_limit skip only matches when it's the only kind (kinds == ["usage_limit"]). Filtering to HELD_DIALOGS would be more robust.
  • The notice suggests relaunching with FACTORY_LANE_SANDBOX=off, but tmux_lane.sh refuses to replace a live pane. Either tell the seat to stop the lane first, or drop that advice.
  • The PR description promises "answering through the lane", but the notice never says how. Please align the two.

The immediate alert itself is a good change: telling both seats at once instead of after 20 minutes is what Camille needed.

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
Screen questions only for Cursor/agy, read whole; answer command alone in backticks;
Tester fixtures for wrapped and split screen questions. CHANGELOG: both lines kept.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
1. hook_trust matched ordinary output ("I'll warn when hooks are new or changed in
   the config.", "- Show 'Hooks need review' when hooks change"). seat_attention
   now has SHAPES/shaped(): a kind listed there is reported only when every part
   of its dialog's shape is on a row of the pane's last rows. hook_trust needs the
   "Hooks need review" heading at a row's start and its option row ("Trust all
   and continue", after an optional selector and number), as folder_trust is told
   by its option row. dialog_rows applies it, and _dialog applies it on the
   wrapped-row path too. The per-row pattern itself is unchanged; the dispatcher
   keeps its own patterns and is untouched.
2. A single poll told both seats; the stall window used to filter one-off
   matches. _tell_dialog now tells only once the same digest is seen on two
   consecutive live checks (dialog_seen). Kept: once per digest (dialog_told, set
   only when both seats are told, so a failed write retries at the next check);
   a live read with no held dialog clears both, so a dialog that returns is told
   again after two sightings; an unreadable read decides nothing.
3. "Not a held dialog" is decided by filtering kinds to HELD_DIALOGS, not by
   comparing with ["usage_limit"].
4. Relaunch advice is now what a coordinator can do: tmux_lane.sh refuses to
   launch over a live lane, nothing in the harness ends a lane at a dialog for a
   coordinator, and a new round over a lane with a session needs --round and
   --replace-session '<why>'. So each notice says a person at the run must answer
   the dialog (for the bypass confirmation: accept, or "No, exit", which ends
   Claude Code: its BypassPermissionsModeDialog, 2.1.336), and for the kinds with
   a launcher setting, that the next round, once this one has ended, is launched
   with --round <tag> and --replace-session '<why>' (if it had a session) and
   FACTORY_LANE_SANDBOX on (bypass) / FACTORY_SEAT_TRUST=1 (folder, hook trust) /
   FACTORY_LANE_SANDBOX=off if the human agrees (permission prompt). host_panel
   names neither --replace-session nor a setting.

CHANGELOG line rewritten to match.

Checks: ruff and mypy clean on harness/lane_watchdog.py and seat_attention.py.
Smoke runs: both reviewer prose lines (and prose naming both phrases) are not
hook_trust; a Codex-style hook review with heading and option rows is; one
sighting tells nothing, the second consecutive tells both seats once, a cleared
dialog that returns is told again after two sightings, a changed digest restarts
the count, an unreadable read in between keeps it, a validator write failure
retries only the validator, usage_limit is never told; every relaunch kind's
advice names --replace-session and host_panel's names neither it nor a setting.
Earlier pr167/pr168 smoke runs pass (the old dialog smoke now looks twice).

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
… negative controls

Human reviewer's requirements (via the Validator):
- Two-check rule. New: a dialog seen on one check and gone at the next is
  told to no seat. Adjusted my tests to see each dialog on two consecutive
  checks (60 s and 90 s, still well before the stall window) via
  _seen_twice: per-kind "told at once", seat-write retry (the inbox now fails
  at the telling check, the second sighting), the no-tmux and remedy-name
  advice tests, the host panel, the 80-column bypass, the usage-limit
  control, and the "again if it returns" step (the dialog returns and stays
  for two checks). Assertions are unchanged.
- Negative controls: a Codex lane whose bottom rows say "I'll warn when
  hooks are new or changed in the config." or "- Show 'Hooks need review'
  when hooks change" is told to no seat. The real dialog (heading plus its
  option rows) is still held and told
  (test_codex_hook_trust_is_held_told_once_and_never_answered,
  per-kind test).

Item 3 (relaunch remedies say to stop the lane first) is not yet covered:
asked the Validator what observable marks that step.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
… none

Validator answer to pr168 item 3: folder_trust, hook_trust,
bypass_permissions and permission_prompt are relaunch kinds (relaunch with
FACTORY_SEAT_TRUST=1 or a FACTORY_LANE_SANDBOX setting), and a relaunch over
a lane with a session needs the launcher's --replace-session. host_panel has
no relaunch remedy; usage_limit is not told.

- New, parametrized per relaunch kind (Codex folder and hook trust, Claude
  bypass, Cursor command approval): after two consecutive sightings every
  notice in each seat names --replace-session. No order or other wording is
  asserted.
- The host-panel test now also asserts that no notice names
  --replace-session, any FACTORY_LANE_SANDBOX setting or FACTORY_SEAT_TRUST
  (it previously checked only FACTORY_LANE_SANDBOX=off and
  FACTORY_SEAT_TRUST).
This also settles the earlier open point: the bypass notice's concrete next
step is the relaunch with --replace-session.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CamTosh

CamTosh commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for testing this live, Shane. Replies to your review, checked at 3cf2385:

  1. hook_trust matches ordinary output. Fixed in a703399. hook_trust now needs the dialog's
    shape: a "Hooks need review" heading at the start of a row and a "Trust all and continue"
    option row, both in the pane's last rows. Both of your example lines are now negative-control
    tests (2d3d740), and they are red without a703399.
  2. One poll is enough to tell. Fixed in a703399. The seats are told only when the same
    digest shows on two consecutive live checks. An unreadable read in between decides nothing,
    and a cleared dialog that returns is told again after two sightings. Test: 2d3d740.
  • Filter to HELD_DIALOGS. Fixed in a703399.
  • Relaunch advice over a live pane. Fixed in a703399. Each notice now says a person at the
    run must answer the dialog in the lane's window. Where a launcher setting exists, it adds
    that once this round has ended, the next round is launched with --round <tag> and
    --replace-session '<why>', plus FACTORY_LANE_SANDBOX on (bypass), FACTORY_SEAT_TRUST=1
    (folder/hook trust) or FACTORY_LANE_SANDBOX=off if the human agrees (permission prompt).
    host_panel names no setting. Test: 3cf2385.
  • Description promises "answering through the lane". Description updated: "A lane
    stopped at its agent's own dialog is told to the Orchestrator and the Validator once it shows
    on two consecutive checks. Nothing in the harness answers it: the notice says a person at the
    run must answer it, and which launcher setting keeps the next round from showing it."

@shanebarakat
shanebarakat merged commit 9d1c933 into wandercom:main Dec 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants