fix(tmux): align deferred attach behavior after rebase
This commit is contained in:
parent
d2dc25e567
commit
5f78c07189
@ -335,7 +335,7 @@ describe("decideSpawnActions", () => {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
expect(result.canSpawn).toBe(false)
|
expect(result.canSpawn).toBe(false)
|
||||||
expect(result.reason).toContain("too small")
|
expect(result.reason).toContain("defer attach")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("spawns at exact minimum splittable width with 0 agent panes", () => {
|
it("spawns at exact minimum splittable width with 0 agent panes", () => {
|
||||||
@ -634,7 +634,7 @@ describe("decideSpawnActions with custom agentPaneWidth", () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it("#given wider main pane #when capacity needs two evictions #then replace is chosen", () => {
|
it("#given wider main pane #when capacity needs two evictions #then defer is chosen", () => {
|
||||||
//#given
|
//#given
|
||||||
const config: CapacityConfig = { mainPaneMinWidth: 120, agentPaneWidth: 40 }
|
const config: CapacityConfig = { mainPaneMinWidth: 120, agentPaneWidth: 40 }
|
||||||
const state = createWindowState(220, 44, [
|
const state = createWindowState(220, 44, [
|
||||||
@ -665,8 +665,8 @@ describe("decideSpawnActions with custom agentPaneWidth", () => {
|
|||||||
const result = decideSpawnActions(state, "ses-new", "new task", config, mappings)
|
const result = decideSpawnActions(state, "ses-new", "new task", config, mappings)
|
||||||
|
|
||||||
//#then
|
//#then
|
||||||
expect(result.canSpawn).toBe(true)
|
expect(result.canSpawn).toBe(false)
|
||||||
expect(result.actions).toHaveLength(1)
|
expect(result.actions).toHaveLength(0)
|
||||||
expect(result.actions[0].type).toBe("replace")
|
expect(result.reason).toContain("defer attach")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -703,7 +703,7 @@ describe('TmuxSessionManager', () => {
|
|||||||
await manager.onSessionDeleted({ sessionID: 'ses_timeout' })
|
await manager.onSessionDeleted({ sessionID: 'ses_timeout' })
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(mockExecuteAction).toHaveBeenCalledTimes(0)
|
expect(mockExecuteAction).toHaveBeenCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('closes pane when tracked session is deleted', async () => {
|
test('closes pane when tracked session is deleted', async () => {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { log, normalizeSDKResponse } from "../../shared"
|
|||||||
import {
|
import {
|
||||||
isInsideTmux as defaultIsInsideTmux,
|
isInsideTmux as defaultIsInsideTmux,
|
||||||
getCurrentPaneId as defaultGetCurrentPaneId,
|
getCurrentPaneId as defaultGetCurrentPaneId,
|
||||||
|
POLL_INTERVAL_BACKGROUND_MS,
|
||||||
SESSION_READY_POLL_INTERVAL_MS,
|
SESSION_READY_POLL_INTERVAL_MS,
|
||||||
SESSION_READY_TIMEOUT_MS,
|
SESSION_READY_TIMEOUT_MS,
|
||||||
} from "../../shared/tmux"
|
} from "../../shared/tmux"
|
||||||
@ -398,10 +399,12 @@ export class TmuxSessionManager {
|
|||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
|
|
||||||
await executeAction(
|
if (result.spawnedPaneId) {
|
||||||
{ type: "close", paneId: result.spawnedPaneId, sessionId },
|
await executeAction(
|
||||||
{ config: this.tmuxConfig, serverUrl: this.serverUrl, windowState: state }
|
{ type: "close", paneId: result.spawnedPaneId, sessionId },
|
||||||
)
|
{ config: this.tmuxConfig, serverUrl: this.serverUrl, windowState: state }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user