The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(connectors): repairs by id never land on another account
Siddharth Balyan21a4ab05ec9f
diff --git a/tests/tools/test_connector_accounts.py b/tests/tools/test_connector_accounts.pyindex d26e2d3f344..c9225c6827b 100644--- a/tests/tools/test_connector_accounts.py+++ b/tests/tools/test_connector_accounts.py@@ -129,6 +129,24 @@ def test_reconnect_of_an_unnamed_account_by_its_label_repairs_that_account_by_id"connection_id": "ca_gmail_old-label"}]+def test_reconnect_of_a_healthy_unnamed_account_by_label_mints_nothing_unless_forced():+ accounts = [_account("home", "[email protected]"), _account(None, "gmail_old-label")]+ gateway = _Gateway()+ _run({"action": "reconnect", "connectors": [{"name": "gmail", "alias": "gmail_old-label"}]}, gateway, accounts)+ assert gateway.mints == []+ _run({"action": "reconnect", "connectors": [{"name": "gmail", "alias": "gmail_old-label"}], "force": True},+ gateway, accounts)+ assert gateway.mints == [{"connectors": ("gmail",), "reinitiate": True, "alias": None,+ "connection_id": "ca_gmail_old-label"}]+++def test_an_open_repair_of_one_account_is_not_reused_for_another():+ repair = op.ConnectionOperation([op.Target("gmail", "connector", "reconnect", repair_id="ca_a")], session_key="s1")+ live.open(repair)+ assert live.find_target("gmail", repair_id="ca_a") is repair+ assert live.find_target("gmail", repair_id="ca_b") is None++def test_a_pending_link_reaches_the_model_with_its_account_id_and_no_link():from tools.connectors.gateway.merge import PlannedCall, render_remote_entrydiff --git a/tests/tui_gateway/test_connector_accounts_rpc.py b/tests/tui_gateway/test_connector_accounts_rpc.pyindex 2ab87497ac5..8e96d7209fc 100644--- a/tests/tui_gateway/test_connector_accounts_rpc.py+++ b/tests/tui_gateway/test_connector_accounts_rpc.py@@ -40,6 +40,9 @@ class _Transport:def _rpc(method, transport=None, **params):transport = transport or _Transport()+ # A shared transport still holds the previous call's reply; read only this call's frames.+ transport.frames.clear()+ transport.arrived.clear()reply = server.dispatch({"jsonrpc": "2.0", "id": 1, "method": method, "params": params}, transport)if reply is not None:return reply@@ -94,6 +97,14 @@ def test_a_session_retry_for_another_account_does_not_re_mint_the_open_one(monkereply = _rpc("connectors.connect", transport, owner={"type": "session", "session_id": "alias-sid"},connectors=["gmail"], alias="work")assert reply["error"]["code"] == 4004+ live.close(operation)+ unnamed = ConnectionOperation([Target("gmail", "connector", "reconnect", repair_id="ca_home")], session_key="alias-sid")+ live.open(unnamed)+ unnamed.transition("gmail", TargetState.initiated, Actor.backend_watcher, connect_url="https://l/2")+ unnamed.transition("gmail", TargetState.failed, Actor.backend_watcher, detail="expired")+ reply = _rpc("connectors.connect", transport, owner={"type": "session", "session_id": "alias-sid"},+ connectors=["gmail"], reconnect=True, connection_id="ca_work")+ assert reply["error"]["code"] == 4004assert mints == []