feat(issue-24): startup dialogs come from the agent adapter and are handled while waiting for the TUI

handle_startup_dialogs was a claude-only string ladder called only when
AGENT=claude, and wait_for_tui_ready does not treat a dialog screen as ready.
So agy, grok and codex sat on their directory-trust prompt for the full
readiness timeout, the session was recorded as tui-ready-timeout, and
onboarding injection was disabled (create_session.sh:313-314) - a human had to
accept each dialog by hand.

The signatures and accept keys move to the adapters as `startup_dialogs`
(pattern, keys, kind), published through the existing `facts` eval contract as
MAM_STARTUP_DIALOGS. claude's ladder moves over verbatim; agy takes Enter, grok
y, codex Enter, and codex's update notice takes 2 (Skip), which blocks a start
just as hard while changing nothing. kind is `trust` or `notice`:
--no-auto-trust leaves trust dialogs to a human and still answers notices,
since trusting a directory makes codex load its project-local config, hooks and
exec policy.

Re-sending is gated by time (MAM_DIALOG_RESEND_S, default 5s), not by frames.
#24's comment reports that `--source visible` keeps showing an accepted dialog
for a while, and _pane_capture hardcodes that source, so "still on screen" is
not evidence the keys were missed; acceptance is judged by the ready tokens
alone.

Two existing tests asserted the old shape and are updated, not weakened:
b19's "Escape branch stays" now looks for it in claude's adapter, and c1b's
"Enter once per iteration" becomes "never twice for one frame", which the
cooldown satisfies strictly more tightly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
GodopuandClaude Opus 5 committed 2026-09-22 04:22:09 +00:00
1 parent 3bcaa39ab0
commit 5ba04a27ca
11 files changed
+344 -29

No files matched your search

+8 -2
View File
@@ -282,13 +282,19 @@ if _pane_dialog_open dummy; then echo "DIALOG_OPEN"; else echo "DIALOG_CLOSED";
def test_mam_dialog_tokens_exclude_yes_try_it():
"""N-1 / F-1: token list must not contain Yes, try it; Escape branch stays."""
"""N-1 / F-1: token list must not contain Yes, try it; Escape branch stays.
Issue #24 moved the per-agent ladder out of lib.sh into the agent adapter,
so the Escape branch is now claude's own `startup_dialogs` entry. The two
token-list assertions are unchanged; only where the branch lives moved.
"""
content = open(_LIB_SH, encoding="utf-8").read()
modal_line = next(l for l in content.splitlines() if l.startswith("_MAM_MODAL_TOKENS="))
hint_line = next(l for l in content.splitlines() if l.startswith("_MAM_HINT_TOKENS="))
assert "Yes, try it" not in modal_line
assert "Yes, try it" not in hint_line
assert "grep -q 'Yes, try it'" in content
adapter = os.path.join(os.path.dirname(_LIB_SH), "lib_py", "agents", "adapters", "claude.py")
assert "('Yes, try it', ['Escape'], 'notice')" in open(adapter, encoding="utf-8").read()
def test_wait_for_tui_ready_succeeds_on_fullscreen_tip():