fix(tmux): track placeholder panes before attach readiness

This commit is contained in:
Disaster-Terminator
2026-04-18 16:39:43 +08:00
committed by YeonGyu-Kim
parent 688bb551b2
commit c63108d55b
6 changed files with 153 additions and 16 deletions
+5 -6
View File
@@ -4,7 +4,7 @@ import type { SpawnPaneResult } from "../types"
import type { runTmuxCommand as RunTmuxCommand } from "../runner"
import { isInsideTmux } from "./environment"
import { isServerRunning } from "./server-health"
import { shellSingleQuote } from "../../shell-env"
import { buildTmuxPlaceholderCommand } from "./pane-command"
const ISOLATED_SESSION_NAME_PREFIX = "omo-agents"
@@ -61,7 +61,7 @@ export async function spawnTmuxSession(
description: string,
config: TmuxConfig,
serverUrl: string,
directory: string,
_directory: string,
sourcePaneId?: string,
depsInput?: Partial<SpawnTmuxSessionDeps>,
): Promise<SpawnPaneResult> {
@@ -98,8 +98,7 @@ export async function spawnTmuxSession(
log("[spawnTmuxSession] all checks passed, creating isolated session...")
const effectiveDirectory = directory || process.cwd()
const opencodeCmd = `opencode attach ${shellSingleQuote(serverUrl)} --session ${shellSingleQuote(sessionId)} --dir ${shellSingleQuote(effectiveDirectory)}`
const placeholderCmd = buildTmuxPlaceholderCommand(description)
const sizeArgs: string[] = []
if (sourcePaneId) {
@@ -118,7 +117,7 @@ export async function spawnTmuxSession(
"-t", isolatedSessionName,
"-P",
"-F", "#{pane_id}",
opencodeCmd,
placeholderCmd,
]
: [
"new-session",
@@ -127,7 +126,7 @@ export async function spawnTmuxSession(
...sizeArgs,
"-P",
"-F", "#{pane_id}",
opencodeCmd,
placeholderCmd,
]
log("[spawnTmuxSession] spawning", {
+4 -5
View File
@@ -3,8 +3,8 @@ import { getTmuxPath } from "../../../tools/interactive-bash/tmux-path-resolver"
import type { SpawnPaneResult } from "../types"
import { isInsideTmux } from "./environment"
import { isServerRunning } from "./server-health"
import { shellSingleQuote } from "../../shell-env"
import type { runTmuxCommand as RunTmuxCommand } from "../runner"
import { buildTmuxPlaceholderCommand } from "./pane-command"
const ISOLATED_WINDOW_NAME = "omo-agents"
@@ -37,7 +37,7 @@ export async function spawnTmuxWindow(
description: string,
config: TmuxConfig,
serverUrl: string,
directory: string,
_directory: string,
depsInput?: Partial<SpawnTmuxWindowDeps>,
): Promise<SpawnPaneResult> {
const deps = await resolveSpawnTmuxWindowDeps(depsInput)
@@ -73,8 +73,7 @@ export async function spawnTmuxWindow(
log("[spawnTmuxWindow] all checks passed, creating isolated window...")
const effectiveDirectory = directory || process.cwd()
const opencodeCmd = `opencode attach ${shellSingleQuote(serverUrl)} --session ${shellSingleQuote(sessionId)} --dir ${shellSingleQuote(effectiveDirectory)}`
const placeholderCmd = buildTmuxPlaceholderCommand(description)
const args = [
"new-window",
@@ -82,7 +81,7 @@ export async function spawnTmuxWindow(
"-n", ISOLATED_WINDOW_NAME,
"-P",
"-F", "#{pane_id}",
opencodeCmd,
placeholderCmd,
]
const result = await runTmuxCommand(tmux, args)