Skip to content

The agent that grows with you

test(relay): cover cwd lifecycle handoffs

Alex Fournier706f296d5abc
diff --git a/tests/agent/test_cross_process_turn_lease.py b/tests/agent/test_cross_process_turn_lease.py
index 2c306f0d34e..017c5c90250 100644
--- a/tests/agent/test_cross_process_turn_lease.py
+++ b/tests/agent/test_cross_process_turn_lease.py
@@ -82,6 +82,10 @@ def test_run_conversation_acquires_then_reloads_latest_tip(monkeypatch):
observed["session_id"] = _agent.session_id
return {"final_response": "ok", "messages": history, "failed": False}
+ def resolve_relay_cwds(_agent, _task_id, session_id, _platform):
+ observed["relay_cwd_session_id"] = session_id
+ return "", ""
+
# Simulate a contended wait so the resume status path is covered.
def acquire_with_wait(session_id, holder, **kwargs):
db.events.append(("acquire", session_id, holder))
@@ -93,6 +97,7 @@ def test_run_conversation_acquires_then_reloads_latest_tip(monkeypatch):
db.acquire_session_turn_lease = acquire_with_wait
monkeypatch.setattr("agent.conversation_loop.run_conversation", fake_run)
+ monkeypatch.setattr("agent.relay_cwd.resolve_relay_scope_cwds", resolve_relay_cwds)
result = AIAgent.run_conversation(
agent,
"new message",
@@ -103,6 +108,7 @@ def test_run_conversation_acquires_then_reloads_latest_tip(monkeypatch):
assert observed == {
"history": [{"role": "user", "content": "durable latest"}],
"session_id": "compressed-tip",
+ "relay_cwd_session_id": "compressed-tip",
}
assert [event[0] for event in db.events] == [
"acquire",
diff --git a/tests/agent/test_relay_session_segments.py b/tests/agent/test_relay_session_segments.py
index 72feeb06f2b..901e23346e6 100644
--- a/tests/agent/test_relay_session_segments.py
+++ b/tests/agent/test_relay_session_segments.py
@@ -297,21 +297,9 @@ class TestCwdProjection:
assert fake.scope.pushes[-1]["input"] == {"cwd": "/workspace/next-task"}
coordinator.end_turn(turn, outcome="success")
- def test_explicit_unknown_cwd_clears_prior_scope_input(self, coordinator):
- fake = _FakeRelay()
- runtime = _make_runtime(fake)
- lease = _acquire(
- coordinator, runtime,
- session_cwd="/workspace/session", turn_cwd="/workspace/task",
- )
- coordinator.end_turn(
- coordinator.begin_turn(lease, turn_id="t1", task_id="task1"),
- outcome="success",
- )
-
lease = _acquire(coordinator, runtime, session_cwd="", turn_cwd="")
runtime.rotate_session_scope(lease.session, reason="compaction")
- turn = coordinator.begin_turn(lease, turn_id="t2", task_id="task2")
+ turn = coordinator.begin_turn(lease, turn_id="t3", task_id="task3")
assert _session_pushes(fake)[-1]["input"] == {}
assert fake.scope.pushes[-1]["input"] == {}