fix(team-mode): gate tmux layout cleanup by config

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-06 17:18:36 +09:00
parent b4791c85ca
commit 89c959955a
2 changed files with 25 additions and 2 deletions
@@ -86,7 +86,7 @@ export async function deleteTeam(
}
}
const removedLayout = tmuxMgr !== undefined && canVisualize()
const removedLayout = config.tmux_visualization && tmuxMgr !== undefined && canVisualize()
if (removedLayout) {
const memberPaneIds = runtimeState.members
.filter((member) => member.agentType !== "leader" && member.tmuxPaneId)
@@ -305,7 +305,7 @@ describe("team-runtime shutdown", () => {
// when
const result = await deleteTeam(
fixture.teamRunId,
fixture.config,
{ ...fixture.config, tmux_visualization: true },
{ getServerUrl: () => "http://localhost" } as never,
undefined,
{ force: true },
@@ -325,6 +325,29 @@ describe("team-runtime shutdown", () => {
)
})
test("#given tmux manager but visualization disabled #when deleteTeam runs #then layout cleanup is skipped", async () => {
// given
const fixture = await createFixture()
temporaryDirectories.push(fixture.baseDir)
spyOn(layoutModule, "canVisualize").mockReturnValue(true)
const removeLayoutSpy = spyOn(layoutModule, "removeTeamLayout").mockResolvedValue(undefined)
await updateMemberStatuses(fixture.teamRunId, fixture.config, {
"member-a": "shutdown_approved",
"member-b": "completed",
})
// when
const result = await deleteTeam(
fixture.teamRunId,
{ ...fixture.config, tmux_visualization: false },
{ getServerUrl: () => "http://localhost" } as never,
)
// then
expect(result.removedLayout).toBe(false)
expect(removeLayoutSpy).not.toHaveBeenCalled()
})
test("cancels team background tasks before deleting when force=true", async () => {
// given
const fixture = await createFixture()