mirror of
https://github.com/stablyai/orca.git
synced 2026-10-06 16:02:25 +00:00
* fix(vault): read OpenCode SQLite on WSL and SSH execution hosts * fix(vault): bound host setup and preserve cancellation across readers * fix(vault): keep WSL discovery visible and isolate probe tests * fix: retry local Vault runtime downloads without reserving remote stages Preserve verified remote cache reuse and latch only unresolved host work. Update WSL source-guard and remote dedup test integration. * fix(queue): discard aborted requests before respawn * fix(vault): preserve host paths and recover setup after reconnect * fix(ssh): fence every runtime platform probe across reconnects * fix(vault): reject setup results from superseded SSH connections --------- Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { waitForPromiseWithSignal } from '../../shared/abort-signal-reason'
|
|
import type { RemoteOpenCodeRuntimeOutcome } from './ssh-relay-opencode-runtime'
|
|
|
|
export type RemoteOpenCodeRuntimePreparation = (signal: AbortSignal) => Promise<void>
|
|
|
|
export function createRemoteOpenCodeRuntimeRetry(
|
|
initialSetup: Promise<RemoteOpenCodeRuntimeOutcome>,
|
|
backgroundCleanup: Promise<boolean>,
|
|
retry: (signal: AbortSignal) => Promise<RemoteOpenCodeRuntimeOutcome>
|
|
): RemoteOpenCodeRuntimePreparation {
|
|
let nextAttempt = Infinity
|
|
let pending: Promise<void> | undefined
|
|
const remember = (outcome: RemoteOpenCodeRuntimeOutcome): void => {
|
|
nextAttempt =
|
|
outcome === 'ready' || outcome === 'teardown-unconfirmed'
|
|
? Infinity
|
|
: Date.now() + (outcome === 'not-needed' ? 60_000 : 30_000)
|
|
}
|
|
const initialized = initialSetup.then(remember).catch(() => {})
|
|
return (signal) => {
|
|
if (signal.aborted) {
|
|
return Promise.resolve()
|
|
}
|
|
pending ??= (async () => {
|
|
await waitForPromiseWithSignal(initialized, signal)
|
|
if (Date.now() < nextAttempt) {
|
|
return
|
|
}
|
|
if (!(await waitForPromiseWithSignal(backgroundCleanup, signal))) {
|
|
nextAttempt = Infinity
|
|
return
|
|
}
|
|
signal.throwIfAborted()
|
|
remember(await retry(signal))
|
|
})()
|
|
.catch(() => {})
|
|
.finally(() => {
|
|
pending = undefined
|
|
})
|
|
return pending
|
|
}
|
|
}
|