diff --git a/docs-ai/064-agent-completion-signals/004-s2-work-note.md b/docs-ai/064-agent-completion-signals/004-s2-work-note.md index 1aefdab0..fca18e50 100644 --- a/docs-ai/064-agent-completion-signals/004-s2-work-note.md +++ b/docs-ai/064-agent-completion-signals/004-s2-work-note.md @@ -108,6 +108,9 @@ recorded in the existing 064 plan/action documents. - 2026-08-23 — Adversarial review round 1 found that generic non-exit waits ignored exact surface closure and timed out. They now return structured `AGENT_GONE` immediately with an exact surface observation and optional requested screen evidence. +- 2026-08-23 — The same review found that wait screen evidence read the scrollback-inclusive + screen while labelling it `detection`. The provider now uses the active detection buffer, + enforced by a source-contract regression test. ## Fresh Debug E2E diff --git a/scripts/test_agent_wait_screen_provider.py b/scripts/test_agent_wait_screen_provider.py new file mode 100644 index 00000000..9144e44c --- /dev/null +++ b/scripts/test_agent_wait_screen_provider.py @@ -0,0 +1,22 @@ +import pathlib +import re +import unittest + + +class AgentWaitScreenProviderTests(unittest.TestCase): + def test_wait_screen_uses_detection_buffer(self): + root = pathlib.Path(__file__).resolve().parents[1] + source = (root / "supacode" / "App" / "supacodeApp.swift").read_text() + match = re.search( + r"screenProvider:\s*\{ target in(?P.*?)\n\s*\}\n\s*\)", + source, + re.DOTALL, + ) + self.assertIsNotNone(match, "Agent wait screenProvider composition was not found") + body = match.group("body") + self.assertIn("readActiveContentsForCLI()", body) + self.assertNotIn("readScreenContentsForCLI()", body) + + +if __name__ == "__main__": + unittest.main() diff --git a/supacode/App/supacodeApp.swift b/supacode/App/supacodeApp.swift index a0bc5a21..d0c1d34d 100644 --- a/supacode/App/supacodeApp.swift +++ b/supacode/App/supacodeApp.swift @@ -938,7 +938,7 @@ struct SupacodeApp: App { else { return nil } - return surface.readScreenContentsForCLI() + return surface.readActiveContentsForCLI() } ) let createTab: TabCommandHandler.CreateTabProvider = { target, path in