Report the last plugin.list failure when plugins never load

This commit is contained in:
Chris Scott committed 2026-11-28 20:36:48 -05:00
1 parent 68f67327fc
commit 3e92efd22e
1 file changed
+5 -2
+5 -2
View File
@@ -51,15 +51,18 @@ export async function waitForOpenCodePluginsLoaded(
timeoutMs: number = PLUGIN_LOAD_TIMEOUT_MS,
): Promise<void> {
const deadline = Date.now() + timeoutMs
let lastFailure = 'no plugins reported'
while (Date.now() < deadline) {
try {
const { data } = await client.api.plugin.list()
if (data.length > 0) return
} catch {
lastFailure = 'no plugins reported'
} catch (error) {
lastFailure = String(error)
}
await delay(PLUGIN_POLL_INTERVAL_MS)
}
throw new Error(`OpenCode server plugins did not load within ${timeoutMs}ms`)
throw new Error(`OpenCode server plugins did not load within ${timeoutMs}ms: ${lastFailure}`)
}
export function readOpenCodeVersion(binary: string): string | null {