fix(tui): establish 2-tier readiness model, modal/hint token separation, and adapter modal contracts

- Separate TUI dialog detection into blocking gate layer (_MAM_MODAL_TOKENS) and recovery layer (_MAM_HINT_TOKENS) to eliminate idle dialog starvation
- Add modal_tokens contract across agent adapters (claude, cline) with dynamic scope facts resolution in send_keys_safe
- Implement fail-closed resolution for ambiguous same-kind panes (R-1) and enforce WORKSPACE_ROOT export (R-2)
- Preserve session on TUI readiness timeout when PID is alive for diagnostics
- Add comprehensive test suite in tests/test_c1_tui_readiness.py and adapter contract assertions in test_a4
This commit is contained in:
2026-08-28 15:21:10 +09:00
parent 4a5a093986
commit 17edf90676
9 changed files with 868 additions and 42 deletions
+16
View File
@@ -84,6 +84,22 @@ def test_adapter_required_properties():
assert adapter.delegate_agent_key == delk
assert adapter.identity_cache_fields == cache_f
def test_adapter_modal_tokens_contract():
"""F-8: Verify adapter-level modal_tokens contract (T-2d)."""
expected_modal = {
'claude': 'Try the new fullscreen renderer\\?',
'cline': 'Select API Provider|Enter API Key|Select an API provider|API Provider|Cline API key',
'agy': None,
'hermes': None,
'grok': None,
}
for agent, expected in expected_modal.items():
adapter = get_adapter(agent)
assert adapter is not None
assert adapter.modal_tokens == expected, f"modal_tokens mismatch for {agent}"
def test_facts_bridge_eval_contract():
import subprocess, sys
from pathlib import Path