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.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152"""Cancelling input withdraws its queued runtime preparation.
The daemon actor remains live while its runtime is held at a receive barrier.A second input exercises the late cancellation reply crossing a new request."""
import jsonimport unittest
from harness import ROOT, Albedo, Provider, exclusive, operation_id, textfrom inspect_support import Inspection
@exclusiveclass KernelAdmissionTests(unittest.TestCase): def test_cancelled_preparation_does_not_cancel_the_next_input(self) -> None: provider = Provider(lambda request: text("next input completed")) self.addCleanup(provider.close)
def prepare(app: Albedo) -> None: app.daemon.env["ALBEDO_INSPECT"] = "1"
with Albedo(provider, prepare=prepare) as app: session = app.session() probe = Inspection(app, ROOT / "test/e2e/albedo_runtime_stall_probe.erl") cancelled = operation_id() probe.call_json("suspend_json") try: with app.api( f"/sessions/{session}/inputs/{cancelled}", {"kind": "message", "text": "cancel before preparation"}, method="PUT", ) as response: response.read() self.assertEqual(probe.call("wait_queued", "[prepare]"), "queued") with app.api( f"/sessions/{session}/inputs/{cancelled}/cancel", {} ) as response: self.assertEqual(json.load(response)["result"], "cancelled") self.assertEqual( probe.call("wait_queued", "[cancel_submitted]"), "queued" ) app.prompt(session, "next input").close() finally: probe.call_json("resume_json") app.idle(session) with app.api(f"/sessions/{session}/inputs/{cancelled}") as response: self.assertEqual(json.load(response)["delivery"], "cancelled") history = json.dumps(app.history(session)["items"]) self.assertIn("next input completed", history) self.assertNotIn("could not start", history)