Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(hibernate): enable hibernation for opencode via /exit

Alexff365255844a
diff --git a/src/renderer/terminal/agent-restart.test.ts b/src/renderer/terminal/agent-restart.test.ts
index 95261d74f..422798cb8 100644
--- a/src/renderer/terminal/agent-restart.test.ts
+++ b/src/renderer/terminal/agent-restart.test.ts
@@ -37,8 +37,7 @@ describe('exitSequence', () => {
expect(exitSequence('gemini')).toBe('/quit')
expect(exitSequence('gemini')).not.toContain('--delete')
expect(exitSequence('copilot')).toBe('/exit')
- // opencode is resumable but we know no way to ask it to quit, so it is still not a target.
- expect(exitSequence('opencode')).toBeNull()
+ expect(exitSequence('opencode')).toBe('/exit')
expect(exitSequence('my-custom')).toBeNull()
})
})
@@ -77,11 +76,7 @@ describe('restartEligibility', () => {
ok: false,
reason: 'no-session'
})
- // opencode: resumable, but no exit sequence — so still never a target.
- expect(restartEligibility('opencode', 'waiting', 'abc')).toEqual({
- ok: false,
- reason: 'not-resumable'
- })
+ expect(restartEligibility('opencode', 'waiting', 'abc')).toEqual({ ok: true })
expect(restartEligibility('my-custom', 'waiting', 'abc')).toEqual({
ok: false,
reason: 'not-resumable'
@@ -314,11 +309,11 @@ describe('performRestartResume', () => {
it('refuses an agent without an exit sequence', async () => {
const { io } = fakeIo()
- // opencode is in RESUMABLE_AGENTS but not in EXIT_SEQUENCES: the exit-line table is its own,
+ // A custom agent with no exit sequence: the exit-line table is its own
// independent half of the gate.
expect(
await performRestartResume({
- agentId: 'opencode',
+ agentId: 'custom:unknown',
sessionId: 's',
io,
paneCommand: async () => 'zsh'
@@ -532,7 +527,7 @@ describe('performExitPhase', () => {
).toBe('not-eligible')
expect(
await performExitPhase({
- agentId: 'opencode', // resumable, but no exit sequence
+ agentId: 'custom:unknown', // no exit sequence
sessionId: 's',
io,
paneCommand: async () => 'zsh'
@@ -1095,8 +1090,8 @@ describe('planBulkRestart', () => {
it('ignores nodes that were never restart targets, instead of counting them as skips', () => {
const plan = planBulkRestart([
cand({ id: 'shell', agentId: undefined }), // plain terminal
- cand({ id: 'oc', agentId: 'opencode' }), // resumable, but no exit sequence
- cand({ id: 'custom', agentId: 'my-custom' }), // neither
+ cand({ id: 'custom1', agentId: 'my-custom' }), // neither
+ cand({ id: 'custom2', agentId: 'custom:other' }), // neither
cand({ id: 'a' })
])
expect(plan.runnable).toEqual(['a'])
@@ -1131,7 +1126,7 @@ describe('planBulkRestart', () => {
// whatever else is true of it — the background check may not turn a non-target into a skip.
const plan = planBulkRestart([
cand({ id: 'shell', agentId: undefined, backgroundTask: true }),
- cand({ id: 'oc', agentId: 'opencode', backgroundTask: true })
+ cand({ id: 'oc', agentId: 'my-custom', backgroundTask: true })
])
expect(plan.runnable).toEqual([])
expect(plan.skipped).toEqual({ working: 0, noSession: 0 })
diff --git a/src/renderer/terminal/agent-restart.ts b/src/renderer/terminal/agent-restart.ts
index 1970d4fa5..597c4a471 100644
--- a/src/renderer/terminal/agent-restart.ts
+++ b/src/renderer/terminal/agent-restart.ts
@@ -39,7 +39,8 @@ const EXIT_SEQUENCES: Record<string, string> = {
codex: '/quit',
grok: '/quit',
gemini: '/quit',
- copilot: '/exit'
+ copilot: '/exit',
+ opencode: '/exit'
}
export function exitSequence(agentId: string): string | null {
diff --git a/src/renderer/terminal/hibernation-policy.test.ts b/src/renderer/terminal/hibernation-policy.test.ts
index fc7efba9c..03eab7317 100644
--- a/src/renderer/terminal/hibernation-policy.test.ts
+++ b/src/renderer/terminal/hibernation-policy.test.ts
@@ -95,7 +95,7 @@ describe('planHibernation', () => {
it('refuses a node the restart gate itself refuses (no session id / not resumable)', () => {
expect(planHibernation([base('a', { sessionId: undefined })], NOW, cfg)).toEqual([])
- expect(planHibernation([base('a', { agentId: 'opencode' })], NOW, cfg)).toEqual([])
+ expect(planHibernation([base('a', { agentId: 'custom:unknown' })], NOW, cfg)).toEqual([])
expect(planHibernation([base('a', { agentId: undefined })], NOW, cfg)).toEqual([])
})