Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/claude_teams/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ def process_shutdown_approved(team_name: str, agent_name: str, ctx: Context) ->
raise ToolError(f"Teammate {agent_name!r} not found in team {team_name!r}")
if member.backend_type == "opencode" and member.opencode_session_id:
_cleanup_opencode_session(oc_url, member.opencode_session_id)
if member.tmux_pane_id:
kill_tmux_pane(member.tmux_pane_id)
teams.remove_member(team_name, agent_name)
tasks.reset_owner_tasks(team_name, agent_name)
return {"success": True, "message": f"{agent_name} removed from team."}
Expand Down
28 changes: 28 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,34 @@ async def test_should_reject_shutdown_of_nonexistent_agent(self, client: Client)
assert result.is_error is True
assert "ghost" in result.content[0].text

async def test_should_kill_tmux_pane_on_shutdown(self, client: Client, monkeypatch):
killed = []
monkeypatch.setattr(
"claude_teams.server.kill_tmux_pane", lambda pane_id: killed.append(pane_id)
)
await client.call_tool("team_create", {"team_name": "tsg3"})
teams.add_member("tsg3", _make_teammate("worker", "tsg3", pane_id="%77"))
result = await client.call_tool(
"process_shutdown_approved",
{"team_name": "tsg3", "agent_name": "worker"},
)
assert result.is_error is False
assert killed == ["%77"]

async def test_should_kill_tmux_window_on_shutdown(self, client: Client, monkeypatch):
killed = []
monkeypatch.setattr(
"claude_teams.server.kill_tmux_pane", lambda pane_id: killed.append(pane_id)
)
await client.call_tool("team_create", {"team_name": "tsg4"})
teams.add_member("tsg4", _make_teammate("worker", "tsg4", pane_id="@12"))
result = await client.call_tool(
"process_shutdown_approved",
{"team_name": "tsg4", "agent_name": "worker"},
)
assert result.is_error is False
assert killed == ["@12"]


class TestErrorWrapping:
async def test_read_config_wraps_file_not_found(self, client: Client):
Expand Down