fix(tmux-subagent): track pane without blocking on session readiness
waitForSessionReady polled session.status for up to 10s before the pane was registered, but session.status only becomes visible after promptAsync starts. Blocking pane tracking on that signal caused the attach client to see an empty session and render a blank TUI. Track the pane immediately after spawn, and run the readiness probe in the background purely for observability. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1056,6 +1056,27 @@ describe('TmuxSessionManager', () => {
|
||||
logSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
|
||||
test('#given session.status never reports session ready #when onSessionCreated runs #then pane is tracked immediately without blocking', async () => {
|
||||
// given
|
||||
mockIsInsideTmux.mockReturnValue(true)
|
||||
mockQueryWindowState.mockImplementation(async () => createWindowState())
|
||||
|
||||
const { TmuxSessionManager } = await import('./manager')
|
||||
const ctx = createMockContext({ sessionStatusResult: { data: {} } })
|
||||
const config = createTmuxConfig({ enabled: true })
|
||||
const manager = new TmuxSessionManager(ctx, config, mockTmuxDeps)
|
||||
const event = createSessionCreatedEvent('ses_fast_track', 'ses_parent', 'Fast Track')
|
||||
|
||||
// when
|
||||
const start = Date.now()
|
||||
await manager.onSessionCreated(event)
|
||||
const elapsed = Date.now() - start
|
||||
|
||||
// then
|
||||
expect(elapsed < 500).toBe(true)
|
||||
expect(getTrackedSessions(manager).has('ses_fast_track')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('onSessionDeleted', () => {
|
||||
|
||||
Reference in New Issue
Block a user