Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { afterEach, describe, expect, it, vi } from 'vitest'
import { SharedControlReconnectScheduler } from './remote-runtime-shared-control-reconnect'
afterEach(() => {
vi.useRealTimers()
})
describe('SharedControlReconnectScheduler', () => {
it('advances one pending backoff without leaving its timer armed', async () => {
vi.useFakeTimers()
const scheduler = new SharedControlReconnectScheduler()
const open = vi.fn()
scheduler.schedule({ intentionallyClosed: false, delaysMs: [30_000], open })
expect(scheduler.retryNow()).toBe(true)
expect(scheduler.retryNow()).toBe(false)
expect(open).toHaveBeenCalledTimes(1)
expect(vi.getTimerCount()).toBe(0)
await vi.advanceTimersByTimeAsync(36_000)
expect(open).toHaveBeenCalledTimes(1)
})
it('does not advance cleared or intentionally closed work', () => {
vi.useFakeTimers()
const scheduler = new SharedControlReconnectScheduler()
const open = vi.fn()
scheduler.schedule({ intentionallyClosed: false, delaysMs: [30_000], open })
scheduler.clear()
expect(scheduler.retryNow()).toBe(false)
scheduler.schedule({ intentionallyClosed: true, delaysMs: [30_000], open })
expect(scheduler.retryNow()).toBe(false)
expect(open).not.toHaveBeenCalled()
})
})