============================= test session starts ==============================
platform darwin -- Python 3.13.12, pytest-9.2.0, pluggy-1.7.0 -- prodapp/.venv/bin/python
cachedir: .pytest_cache
rootdir: prodapp
configfile: pytest.ini
testpaths: tests
plugins: platformdirs-4.14.5, langsmith-0.14.17, anyio-4.16.0, asyncio-1.5.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=session, asyncio_default_test_loop_scope=session
collecting ... collected 27 items

tests/test_durability.py::test_kill_mid_refund_then_resume_refunds_once FAILED [  3%]
tests/test_durability.py::test_sigterm_lets_in_flight_run_finish PASSED  [  7%]
tests/test_durability.py::test_sigterm_past_deadline_checkpoints_and_resumes FAILED [ 11%]
tests/test_evals.py::test_eval[faq_return_window] PASSED                 [ 14%]
tests/test_evals.py::test_eval[faq_shipping_time] PASSED                 [ 18%]
tests/test_evals.py::test_eval[order_status] PASSED                      [ 22%]
tests/test_evals.py::test_eval[order_unknown] PASSED                     [ 25%]
tests/test_evals.py::test_eval[order_of_other_customer_is_hidden] PASSED [ 29%]
tests/test_evals.py::test_eval[refund_approved_once] FAILED              [ 33%]
tests/test_evals.py::test_eval[refund_rejected_has_no_side_effect] FAILED [ 37%]
tests/test_evals.py::test_eval[refund_asked_twice] FAILED                [ 40%]
tests/test_evals.py::test_eval[refund_tool_replay_is_idempotent] PASSED  [ 44%]
tests/test_evals.py::test_eval[ticket_for_a_human] PASSED                [ 48%]
tests/test_evals.py::test_eval[memory_saved_and_recalled] FAILED         [ 51%]
tests/test_evals.py::test_eval[memory_of_other_user_is_invisible] PASSED [ 55%]
tests/test_evals.py::test_eval[flaky_faq_is_retried] FAILED              [ 59%]
tests/test_evals.py::test_eval[hung_tool_times_out] PASSED               [ 62%]
tests/test_evals.py::test_eval[failed_ticket_is_not_retried] PASSED      [ 66%]
tests/test_evals.py::test_eval[primary_outage_uses_backup] PASSED        [ 70%]
tests/test_evals.py::test_eval[runaway_loop_hits_call_limit] PASSED      [ 74%]
tests/test_evals.py::test_eval[long_thread_is_summarized] PASSED         [ 77%]
tests/test_evals.py::test_eval[new_message_while_waiting_for_approval] FAILED [ 81%]
tests/test_evals.py::test_eval[status_then_refund_in_one_thread] FAILED  [ 85%]
tests/test_isolation.py::test_one_user_cannot_read_another_users_thread_or_memory FAILED [ 88%]
tests/test_isolation.py::test_missing_or_wrong_token_is_rejected PASSED  [ 92%]
tests/test_smith_off.py::test_langsmith_receives_nothing_unless_enabled FAILED [ 96%]
tests/test_workers.py::test_two_workers_racing_on_one_thread_give_one_run_and_one_409 PASSED [100%]

=================================== FAILURES ===================================
________________ test_kill_mid_refund_then_resume_refunds_once _________________

    async def test_kill_mid_refund_then_resume_refunds_once():
        RUN_DIR.mkdir(parents=True, exist_ok=True)
        env = {"AUTH_TOKENS": "tok-crash=crash", "REFUND_CONFIRM_DELAY": 3}
        server = Server(RUN_DIR, "crash-1", **env)
        reset_user("crash")
        client = Http(server.url, "tok-crash")
        thread = await client.thread()
        first = await client.say(thread, "Please refund ORD-crash-2")
        approving = asyncio.create_task(client.approve(thread))
        committed = await wait_for(lambda: refunds("ORD-crash-2"))
        killed_at = time.time()
        exit_code = server.kill()
        approve_error = None
        try:
            await approving
        except Exception as exc:
            approve_error = type(exc).__name__
        server.log.close()
    
        server = Server(RUN_DIR, "crash-2", AUTH_TOKENS="tok-crash=crash")
        client = Http(server.url, "tok-crash")
        after_restart = await client.state(thread)
>       resumed = await client.approve(thread)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_durability.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/procs.py:88: in approve
    return await self.post_sse(f"/threads/{thread_id}/approve", {"decision": decision})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/procs.py:82: in post_sse
    return parse_sse(response.text)
           ^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

text = '{"detail":"nothing to resume"}'

    def parse_sse(text):
        events = []
        for block in text.strip().split("\n\n"):
            if block:
>               lines = dict(line.split(": ", 1) for line in block.splitlines())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E               ValueError: dictionary update sequence element #0 has length 1; 2 is required

tests/procs.py:68: ValueError
______________ test_sigterm_past_deadline_checkpoints_and_resumes ______________

    async def test_sigterm_past_deadline_checkpoints_and_resumes():
        RUN_DIR.mkdir(parents=True, exist_ok=True)
        env = {"AUTH_TOKENS": "tok-drain2=drain2", "MODEL_LATENCY": 3.0, "DRAIN_SECONDS": 0.2}
        name = "drain-cancel"
        server = Server(RUN_DIR, name, graceful=1, **env)
        client = Http(server.url, "tok-drain2")
        thread = await client.thread()
        running = asyncio.create_task(client.say(thread, "How long does shipping take?"))
        await asyncio.sleep(3.5)
        exit_code = await asyncio.to_thread(server.term)
        try:
            events = await running
        except Exception as exc:
            events = [("client_error", type(exc).__name__)]
        server.log.close()
        server = Server(RUN_DIR, "drain-cancel-resume", AUTH_TOKENS="tok-drain2=drain2")
        client = Http(server.url, "tok-drain2")
        before = await client.state(thread)
>       resumed = await client.approve(thread)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_durability.py:122: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/procs.py:88: in approve
    return await self.post_sse(f"/threads/{thread_id}/approve", {"decision": decision})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/procs.py:82: in post_sse
    return parse_sse(response.text)
           ^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

text = '{"detail":"nothing to resume"}'

    def parse_sse(text):
        events = []
        for block in text.strip().split("\n\n"):
            if block:
>               lines = dict(line.split(": ", 1) for line in block.splitlines())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E               ValueError: dictionary update sequence element #0 has length 1; 2 is required

tests/procs.py:68: ValueError
_______________________ test_eval[refund_approved_once] ________________________

number = 6, check = <function refund_approved_once at 0x10c25b6a0>
client = <function client.<locals>.<lambda> at 0x10c65b420>
sql = <function sql.<locals>.run at 0x10c65a3e0>
spans = <function spans.<locals>.read at 0x10c65b1a0>
chaos = <tests.conftest.Chaos object at 0x10c5701a0>
app = <fastapi.applications.FastAPI object at 0x10c5702f0>

    @pytest.mark.parametrize("number,check", list(enumerate(CASES, start=1)), ids=[f.__name__ for f in CASES])
    async def test_eval(number, check, client, sql, spans, chaos, app):
        chaos.rules, chaos.attempts = {}, chaos.attempts.__class__()
        c = client(f"e{number:02d}")
        extras = SimpleNamespace(sql=sql, spans=spans, chaos=chaos, pool=app.state.svc.pool)
        outcome = "error"
        try:
>           await check(c, await c.thread(), extras)

tests/test_evals.py:255: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

c = <tests.conftest.Client object at 0x10c2be330>
t = '4dfcbc32-39c7-4635-b6ca-25b1e0889f85'
x = namespace(sql=<function sql.<locals>.run at 0x10c65a3e0>, spans=<function spans.<locals>.read at 0x10c65b1a0>, chaos=<tests.conftest.Chaos object at 0x10c5701a0>, pool=<psycopg_pool.pool_async.AsyncConnectionPool 'pool-1' at 0x10c5723c0>)

    @case
    async def refund_approved_once(c, t, x):
        order = f"ORD-{c.user}-1"
        events = await c.say(t, f"Please refund {order}")
>       [pending] = interrupts(events)
        ^^^^^^^^^
E       ValueError: not enough values to unpack (expected 1, got 0)

tests/test_evals.py:98: ValueError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
________________ test_eval[refund_rejected_has_no_side_effect] _________________

number = 7, check = <function refund_rejected_has_no_side_effect at 0x10c25b740>
client = <function client.<locals>.<lambda> at 0x10c6a7920>
sql = <function sql.<locals>.run at 0x10c6a56c0>
spans = <function spans.<locals>.read at 0x10c6a6520>
chaos = <tests.conftest.Chaos object at 0x10c5701a0>
app = <fastapi.applications.FastAPI object at 0x10c5702f0>

    @pytest.mark.parametrize("number,check", list(enumerate(CASES, start=1)), ids=[f.__name__ for f in CASES])
    async def test_eval(number, check, client, sql, spans, chaos, app):
        chaos.rules, chaos.attempts = {}, chaos.attempts.__class__()
        c = client(f"e{number:02d}")
        extras = SimpleNamespace(sql=sql, spans=spans, chaos=chaos, pool=app.state.svc.pool)
        outcome = "error"
        try:
>           await check(c, await c.thread(), extras)

tests/test_evals.py:255: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_evals.py:111: in refund_rejected_has_no_side_effect
    assert [r["status"] for r in results(events, "refund_order")] == ["error"]
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

events = 409, name = 'refund_order'

    def results(events, name):
>       return [d for e, d in events if e == "tool_result" and d["name"] == name]
                              ^^^^^^
E       TypeError: 'int' object is not iterable

tests/test_evals.py:26: TypeError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
________________________ test_eval[refund_asked_twice] _________________________

number = 8, check = <function refund_asked_twice at 0x10c25b7e0>
client = <function client.<locals>.<lambda> at 0x10c6a6480>
sql = <function sql.<locals>.run at 0x10c6a6f20>
spans = <function spans.<locals>.read at 0x10c6a4900>
chaos = <tests.conftest.Chaos object at 0x10c5701a0>
app = <fastapi.applications.FastAPI object at 0x10c5702f0>

    @pytest.mark.parametrize("number,check", list(enumerate(CASES, start=1)), ids=[f.__name__ for f in CASES])
    async def test_eval(number, check, client, sql, spans, chaos, app):
        chaos.rules, chaos.attempts = {}, chaos.attempts.__class__()
        c = client(f"e{number:02d}")
        extras = SimpleNamespace(sql=sql, spans=spans, chaos=chaos, pool=app.state.svc.pool)
        outcome = "error"
        try:
>           await check(c, await c.thread(), extras)

tests/test_evals.py:255: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

c = <tests.conftest.Client object at 0x10c5a7ce0>
t = 'c85fa736-12b8-4907-88a8-1514bc73aebb'
x = namespace(sql=<function sql.<locals>.run at 0x10c6a6f20>, spans=<function spans.<locals>.read at 0x10c6a4900>, chaos=<tests.conftest.Chaos object at 0x10c5701a0>, pool=<psycopg_pool.pool_async.AsyncConnectionPool 'pool-1' at 0x10c5723c0>)

    @case
    async def refund_asked_twice(c, t, x):
        order = f"ORD-{c.user}-2"
        await c.say(t, f"Refund {order} please")
        await c.approve(t)
        events = await c.say(t, f"Refund {order} again")
        if interrupts(events):
            await c.approve(t)
>       assert await refunds(x.sql, order) == [{"amount_cents": 8900}]
E       AssertionError: assert [] == [{'amount_cents': 8900}]
E         
E         Right contains one more item: {'amount_cents': 8900}
E         
E         Full diff: (-: missing in left side, +: extra in left side)
E         + []
E         - [
E         -     {...
E         
E         ...Full output truncated, use '-vv' to show

tests/test_evals.py:124: AssertionError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
_____________________ test_eval[memory_saved_and_recalled] _____________________

number = 11, check = <function memory_saved_and_recalled at 0x10c25b9c0>
client = <function client.<locals>.<lambda> at 0x10c6a4f40>
sql = <function sql.<locals>.run at 0x10c6a5080>
spans = <function spans.<locals>.read at 0x10c6a6ca0>
chaos = <tests.conftest.Chaos object at 0x10c5701a0>
app = <fastapi.applications.FastAPI object at 0x10c5702f0>

    @pytest.mark.parametrize("number,check", list(enumerate(CASES, start=1)), ids=[f.__name__ for f in CASES])
    async def test_eval(number, check, client, sql, spans, chaos, app):
        chaos.rules, chaos.attempts = {}, chaos.attempts.__class__()
        c = client(f"e{number:02d}")
        extras = SimpleNamespace(sql=sql, spans=spans, chaos=chaos, pool=app.state.svc.pool)
        outcome = "error"
        try:
>           await check(c, await c.thread(), extras)

tests/test_evals.py:255: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

c = <tests.conftest.Client object at 0x10c393200>
t = 'dfdd5e00-9591-47b5-a607-90996d81c689'
x = namespace(sql=<function sql.<locals>.run at 0x10c6a5080>, spans=<function spans.<locals>.read at 0x10c6a6ca0>, chaos=<tests.conftest.Chaos object at 0x10c5701a0>, pool=<psycopg_pool.pool_async.AsyncConnectionPool 'pool-1' at 0x10c5723c0>)

    @case
    async def memory_saved_and_recalled(c, t, x):
        events = await c.say(t, "Remember that I prefer email updates")
>       assert "email" in calls(events, "save_note")[0]["text"]
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       IndexError: list index out of range

tests/test_evals.py:149: IndexError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
_______________________ test_eval[flaky_faq_is_retried] ________________________

number = 13, check = <function flaky_faq_is_retried at 0x10c25bb00>
client = <function client.<locals>.<lambda> at 0x10c6a77e0>
sql = <function sql.<locals>.run at 0x10c6a6160>
spans = <function spans.<locals>.read at 0x10c6a5bc0>
chaos = <tests.conftest.Chaos object at 0x10c5701a0>
app = <fastapi.applications.FastAPI object at 0x10c5702f0>

    @pytest.mark.parametrize("number,check", list(enumerate(CASES, start=1)), ids=[f.__name__ for f in CASES])
    async def test_eval(number, check, client, sql, spans, chaos, app):
        chaos.rules, chaos.attempts = {}, chaos.attempts.__class__()
        c = client(f"e{number:02d}")
        extras = SimpleNamespace(sql=sql, spans=spans, chaos=chaos, pool=app.state.svc.pool)
        outcome = "error"
        try:
>           await check(c, await c.thread(), extras)

tests/test_evals.py:255: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

c = <tests.conftest.Client object at 0x10c669550>
t = 'aa99ef0e-e728-4a9d-8e78-79862d9e624b'
x = namespace(sql=<function sql.<locals>.run at 0x10c6a6160>, spans=<function spans.<locals>.read at 0x10c6a5bc0>, chaos=<tests.conftest.Chaos object at 0x10c5701a0>, pool=<psycopg_pool.pool_async.AsyncConnectionPool 'pool-1' at 0x10c5723c0>)

    @case
    async def flaky_faq_is_retried(c, t, x):
        x.chaos.rules = {"search_faq": "fail_once"}
        events = await c.say(t, "How much does shipping cost?")
>       assert x.chaos.attempts["search_faq"] == 2
E       assert 0 == 2

tests/test_evals.py:166: AssertionError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
______________ test_eval[new_message_while_waiting_for_approval] _______________

number = 19
check = <function new_message_while_waiting_for_approval at 0x10c25bec0>
client = <function client.<locals>.<lambda> at 0x10c7242c0>
sql = <function sql.<locals>.run at 0x10c726520>
spans = <function spans.<locals>.read at 0x10c727240>
chaos = <tests.conftest.Chaos object at 0x10c5701a0>
app = <fastapi.applications.FastAPI object at 0x10c5702f0>

    @pytest.mark.parametrize("number,check", list(enumerate(CASES, start=1)), ids=[f.__name__ for f in CASES])
    async def test_eval(number, check, client, sql, spans, chaos, app):
        chaos.rules, chaos.attempts = {}, chaos.attempts.__class__()
        c = client(f"e{number:02d}")
        extras = SimpleNamespace(sql=sql, spans=spans, chaos=chaos, pool=app.state.svc.pool)
        outcome = "error"
        try:
>           await check(c, await c.thread(), extras)

tests/test_evals.py:255: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

c = <tests.conftest.Client object at 0x10c7394f0>
t = 'fc44290c-fcaa-4c1d-8921-460b503393ea'
x = namespace(sql=<function sql.<locals>.run at 0x10c726520>, spans=<function spans.<locals>.read at 0x10c727240>, chaos=<tests.conftest.Chaos object at 0x10c5701a0>, pool=<psycopg_pool.pool_async.AsyncConnectionPool 'pool-1' at 0x10c5723c0>)

    @case
    async def new_message_while_waiting_for_approval(c, t, x):
        order = f"ORD-{c.user}-3"
        events = await c.say(t, f"Refund {order}")
        assert [i["name"] for i in interrupts(events)] == ["refund_order"]
        assert await c.say(t, "Hello?") == 409
        await c.approve(t)
>       assert await refunds(x.sql, order) == [{"amount_cents": 2400}]
E       AssertionError: assert [{'amount_cents': 0}] == [{'amount_cents': 2400}]
E         
E         At index 0 diff: {'amount_cents': 0} != {'amount_cents': 2400}
E         
E         Full diff: (-: missing in left side, +: extra in left side)
E           [
E               {
E         -         'amount_cents': 2400,...
E         
E         ...Full output truncated, use '-vv' to show

tests/test_evals.py:233: AssertionError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
_________________ test_eval[status_then_refund_in_one_thread] __________________

number = 20, check = <function status_then_refund_in_one_thread at 0x10c25bf60>
client = <function client.<locals>.<lambda> at 0x10c7251c0>
sql = <function sql.<locals>.run at 0x10c726e80>
spans = <function spans.<locals>.read at 0x10c727060>
chaos = <tests.conftest.Chaos object at 0x10c5701a0>
app = <fastapi.applications.FastAPI object at 0x10c5702f0>

    @pytest.mark.parametrize("number,check", list(enumerate(CASES, start=1)), ids=[f.__name__ for f in CASES])
    async def test_eval(number, check, client, sql, spans, chaos, app):
        chaos.rules, chaos.attempts = {}, chaos.attempts.__class__()
        c = client(f"e{number:02d}")
        extras = SimpleNamespace(sql=sql, spans=spans, chaos=chaos, pool=app.state.svc.pool)
        outcome = "error"
        try:
>           await check(c, await c.thread(), extras)

tests/test_evals.py:255: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

c = <tests.conftest.Client object at 0x10c727ed0>
t = '7f24aa1c-4b3d-435d-bcb0-d20d78e0eda4'
x = namespace(sql=<function sql.<locals>.run at 0x10c726e80>, spans=<function spans.<locals>.read at 0x10c727060>, chaos=<tests.conftest.Chaos object at 0x10c5701a0>, pool=<psycopg_pool.pool_async.AsyncConnectionPool 'pool-1' at 0x10c5723c0>)

    @case
    async def status_then_refund_in_one_thread(c, t, x):
        order = f"ORD-{c.user}-3"
        first = await c.say(t, f"Where is my order {order}?")
        second = await c.say(t, f"Refund {order}")
        await c.approve(t)
        assert calls(first, "read_order") == [{"order_id": order}]
>       assert [i["args"]["order_id"] for i in interrupts(second)] == [order]
E       AssertionError: assert [] == ['ORD-e20-3']
E         
E         Right contains one more item: 'ORD-e20-3'
E         
E         Full diff: (-: missing in left side, +: extra in left side)
E         + []
E         - [
E         -     'ORD-e20-3',
E         - ]

tests/test_evals.py:243: AssertionError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
___________ test_one_user_cannot_read_another_users_thread_or_memory ___________

client = <function client.<locals>.<lambda> at 0x10c726020>

    async def test_one_user_cannot_read_another_users_thread_or_memory(client):
        alice, bob = client("alice"), client("bob")
        thread = await alice.thread()
        await alice.say(thread, "Remember that my door code is 4471")
        await alice.say(thread, "Where is my order ORD-alice-1?")
    
        assert (await bob.http.get(f"/threads/{thread}/state")).status_code == 404
        assert (await bob.http.post(f"/threads/{thread}/runs", json={"message": "hi"})).status_code == 404
        assert (await bob.http.post(f"/threads/{thread}/approve", json={"decision": "approve"})).status_code == 404
    
        assert (await bob.http.get("/memories")).json()["memories"] == []
        bob_thread = await bob.thread()
        await bob.say(bob_thread, "What do you remember about me?")
        assert "4471" not in str(await bob.state(bob_thread))
    
>       assert "4471" in str((await alice.http.get("/memories")).json())
E       assert '4471' in "{'user_id': 'alice', 'memories': []}"
E        +  where "{'user_id': 'alice', 'memories': []}" = str({'user_id': 'alice', 'memories': []})
E        +    where {'user_id': 'alice', 'memories': []} = json()
E        +      where json = <Response [200 OK]>.json

tests/test_isolation.py:16: AssertionError
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
________________ test_langsmith_receives_nothing_unless_enabled ________________

    async def test_langsmith_receives_nothing_unless_enabled():
        RUN_DIR.mkdir(parents=True, exist_ok=True)
        port = free_port()
        recorder = ThreadingHTTPServer(("127.0.0.1", port), Recorder)
        threading.Thread(target=recorder.serve_forever, daemon=True).start()
        endpoint = f"http://127.0.0.1:{port}"
        base = {"LANGSMITH_ENDPOINT": endpoint, "LANGCHAIN_ENDPOINT": endpoint, "LANGSMITH_API_KEY": "lsv2_pt_fake"}
        counts = {}
        try:
            for label, flag in [("enabled_control", "true"), ("disabled", "false"), ("unset", None)]:
                before = len(Recorder.seen)
>               await conversation({**base, "LANGSMITH_TRACING": flag, "LANGCHAIN_TRACING_V2": flag}, f"smith-{label}")

tests/test_smith_off.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_smith_off.py:33: in conversation
    await client.approve(thread, "reject")
tests/procs.py:88: in approve
    return await self.post_sse(f"/threads/{thread_id}/approve", {"decision": decision})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/procs.py:82: in post_sse
    return parse_sse(response.text)
           ^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

text = '{"detail":"nothing to resume"}'

    def parse_sse(text):
        events = []
        for block in text.strip().split("\n\n"):
            if block:
>               lines = dict(line.split(": ", 1) for line in block.splitlines())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E               ValueError: dictionary update sequence element #0 has length 1; 2 is required

tests/procs.py:68: ValueError
==================================== PASSES ====================================
_________________________ test_eval[faq_return_window] _________________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
_________________________ test_eval[faq_shipping_time] _________________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
___________________________ test_eval[order_status] ____________________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
___________________________ test_eval[order_unknown] ___________________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
_________________ test_eval[order_of_other_customer_is_hidden] _________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
________________________ test_eval[ticket_for_a_human] _________________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
_________________ test_eval[memory_of_other_user_is_invisible] _________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
________________________ test_eval[hung_tool_times_out] ________________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.error
INFO     support:telemetry.py:48 run.end
___________________ test_eval[failed_ticket_is_not_retried] ____________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.error
INFO     support:telemetry.py:48 run.end
____________________ test_eval[primary_outage_uses_backup] _____________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
___________________ test_eval[runaway_loop_hits_call_limit] ____________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
_____________________ test_eval[long_thread_is_summarized] _____________________
------------------------------ Captured log call -------------------------------
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 run.end
INFO     support:telemetry.py:48 run.start
INFO     support:telemetry.py:48 tool.done
INFO     support:telemetry.py:48 run.end
- generated xml file: prodapp/runs/2026-11-15-real/suite/qwen3-4b/rep-1/junit.xml -
============================== slowest durations ===============================
29.68s call     tests/test_evals.py::test_eval[runaway_loop_hits_call_limit]
20.62s call     tests/test_evals.py::test_eval[long_thread_is_summarized]
13.03s call     tests/test_workers.py::test_two_workers_racing_on_one_thread_give_one_run_and_one_409
12.71s call     tests/test_durability.py::test_kill_mid_refund_then_resume_refunds_once
8.69s call     tests/test_evals.py::test_eval[status_then_refund_in_one_thread]
7.63s call     tests/test_evals.py::test_eval[primary_outage_uses_backup]
6.65s call     tests/test_smith_off.py::test_langsmith_receives_nothing_unless_enabled
6.33s call     tests/test_isolation.py::test_one_user_cannot_read_another_users_thread_or_memory
5.44s call     tests/test_durability.py::test_sigterm_past_deadline_checkpoints_and_resumes
3.53s call     tests/test_durability.py::test_sigterm_lets_in_flight_run_finish
3.04s call     tests/test_evals.py::test_eval[hung_tool_times_out]
2.32s call     tests/test_evals.py::test_eval[new_message_while_waiting_for_approval]
1.61s call     tests/test_evals.py::test_eval[faq_shipping_time]
1.47s call     tests/test_evals.py::test_eval[order_unknown]
1.47s call     tests/test_evals.py::test_eval[ticket_for_a_human]
1.36s call     tests/test_evals.py::test_eval[order_status]
1.34s call     tests/test_evals.py::test_eval[faq_return_window]
1.30s call     tests/test_evals.py::test_eval[failed_ticket_is_not_retried]
1.15s call     tests/test_evals.py::test_eval[order_of_other_customer_is_hidden]
1.14s call     tests/test_evals.py::test_eval[refund_asked_twice]
1.11s call     tests/test_evals.py::test_eval[memory_of_other_user_is_invisible]
0.70s call     tests/test_evals.py::test_eval[refund_rejected_has_no_side_effect]
0.66s call     tests/test_evals.py::test_eval[refund_approved_once]
0.66s call     tests/test_evals.py::test_eval[memory_saved_and_recalled]
0.63s call     tests/test_evals.py::test_eval[flaky_faq_is_retried]
0.14s setup    tests/test_evals.py::test_eval[faq_return_window]
0.01s call     tests/test_evals.py::test_eval[refund_tool_replay_is_idempotent]

(54 durations < 0.005s hidden.  Use -vv to show these durations.)
=========================== short test summary info ============================
PASSED tests/test_durability.py::test_sigterm_lets_in_flight_run_finish
PASSED tests/test_evals.py::test_eval[faq_return_window]
PASSED tests/test_evals.py::test_eval[faq_shipping_time]
PASSED tests/test_evals.py::test_eval[order_status]
PASSED tests/test_evals.py::test_eval[order_unknown]
PASSED tests/test_evals.py::test_eval[order_of_other_customer_is_hidden]
PASSED tests/test_evals.py::test_eval[refund_tool_replay_is_idempotent]
PASSED tests/test_evals.py::test_eval[ticket_for_a_human]
PASSED tests/test_evals.py::test_eval[memory_of_other_user_is_invisible]
PASSED tests/test_evals.py::test_eval[hung_tool_times_out]
PASSED tests/test_evals.py::test_eval[failed_ticket_is_not_retried]
PASSED tests/test_evals.py::test_eval[primary_outage_uses_backup]
PASSED tests/test_evals.py::test_eval[runaway_loop_hits_call_limit]
PASSED tests/test_evals.py::test_eval[long_thread_is_summarized]
PASSED tests/test_isolation.py::test_missing_or_wrong_token_is_rejected
PASSED tests/test_workers.py::test_two_workers_racing_on_one_thread_give_one_run_and_one_409
FAILED tests/test_durability.py::test_kill_mid_refund_then_resume_refunds_once
FAILED tests/test_durability.py::test_sigterm_past_deadline_checkpoints_and_resumes
FAILED tests/test_evals.py::test_eval[refund_approved_once] - ValueError: not...
FAILED tests/test_evals.py::test_eval[refund_rejected_has_no_side_effect] - T...
FAILED tests/test_evals.py::test_eval[refund_asked_twice] - AssertionError: a...
FAILED tests/test_evals.py::test_eval[memory_saved_and_recalled] - IndexError...
FAILED tests/test_evals.py::test_eval[flaky_faq_is_retried] - assert 0 == 2
FAILED tests/test_evals.py::test_eval[new_message_while_waiting_for_approval]
FAILED tests/test_evals.py::test_eval[status_then_refund_in_one_thread] - Ass...
FAILED tests/test_isolation.py::test_one_user_cannot_read_another_users_thread_or_memory
FAILED tests/test_smith_off.py::test_langsmith_receives_nothing_unless_enabled
================== 11 failed, 16 passed in 134.65s (0:02:14) ===================
