fix: align split targeting with configured pane width

Use the configured agent pane width consistently in split target selection and avoid close+spawn churn by replacing the oldest pane when eviction is required.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-02-17 03:40:37 +09:00
parent b02721463e
commit da3f24b8b1
4 changed files with 55 additions and 23 deletions
@@ -62,7 +62,7 @@ export function decideSpawnActions(
}
if (isSplittableAtCount(agentAreaWidth, currentCount, minPaneWidth)) {
const spawnTarget = findSpawnTarget(state)
const spawnTarget = findSpawnTarget(state, minPaneWidth)
if (spawnTarget) {
return {
canSpawn: true,
@@ -85,19 +85,14 @@ export function decideSpawnActions(
canSpawn: true,
actions: [
{
type: "close",
type: "replace",
paneId: oldestPane.paneId,
sessionId: oldestMapping?.sessionId || "",
},
{
type: "spawn",
sessionId,
oldSessionId: oldestMapping?.sessionId || "",
newSessionId: sessionId,
description,
targetPaneId: state.mainPane.paneId,
splitDirection: "-h",
},
],
reason: "closed 1 pane to make room for split",
reason: "replaced oldest pane to avoid split churn",
}
}