Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334"""A matching ACP notification must not hide an earlier stdout violation.
A scripted peer makes the invalid line and the valid notification availablebefore the predicate runs, independently of daemon or adapter scheduling."""
import osfrom pathlib import Pathimport sysimport tempfileimport unittest
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "e2e"))from acp_support import AcpClient
class AcpReaderTests(unittest.TestCase): def test_wait_for_rejects_malformed_stdout_before_matching_notification(self): with tempfile.TemporaryDirectory() as directory: executable = Path(directory, "peer") executable.write_text( f"#!{sys.executable}\n" "print('diagnostic on stdout')\n" """print('{"jsonrpc":"2.0","method":"session/update","params":{}}')\n""" ) executable.chmod(0o700) client = AcpClient(dict(os.environ, ALBEDO_TEST_CLI=str(executable))) self.addCleanup(client.kill) self.assertEqual(client.wait_exit(), 0) client.kill() # Drain the stdout reader before inspecting its messages. self.assertEqual(len(client.notifications("session/update")), 1) with self.assertRaisesRegex(AssertionError, "diagnostic on stdout"): client.wait_for(client.notifications)