{"record":{"id":"6a22a071071deccb","repo":"paperclipai/paperclip","slug":"opencode-local-remote-model-availability-probe-f","errorCode":null,"errorMessage":"[opencode-local] Remote model availability probe for \"${model}\" timed out after ${probeTimeoutSec}s; proceeding with the configured model.","messagePattern":"\\[opencode-local\\] Remote model availability probe for \"(.+?)\" timed out after (.+?)s; proceeding with the configured model\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/adapters/opencode-local/src/server/execute.ts","lineNumber":133,"sourceCode":"    input.executionTarget,\n    input.command,\n    [\"models\"],\n    {\n      cwd: input.cwd,\n      env: input.env,\n      timeoutSec: probeTimeoutSec,\n      graceSec: input.graceSec,\n      onLog: async () => {},\n    },\n  );\n\n  // The remote availability probe is a best-effort pre-flight guard, not a gate.\n  // If `opencode models` itself cannot run on the target — timeout, transient CLI\n  // error, provider hiccup — do NOT abort the run. The real invocation is\n  // authoritative, so a probe that can't execute must never be fatal. (Previously\n  // these threw and crashed runs mid-flight, losing the agent's work + disposition.)\n  if (probe.timedOut) {\n    console.warn(\n      `[opencode-local] Remote model availability probe for \"${model}\" timed out after ${probeTimeoutSec}s; proceeding with the configured model.`,\n    );\n    return;\n  }\n\n  if ((probe.exitCode ?? 1) !== 0) {\n    const detail = firstNonEmptyLine(probe.stderr) || firstNonEmptyLine(probe.stdout);\n    console.warn(\n      `[opencode-local] Remote \\`opencode models\\` could not run for \"${model}\"${\n        detail ? ` (${detail})` : \"\"\n      }; proceeding with the configured model.`,\n    );\n    return;\n  }\n\n  const models = parseOpenCodeModelsOutput(probe.stdout);\n  if (models.length === 0) {\n    console.warn(","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/adapters/opencode-local/src/server/execute.ts#L115-L151","documentation":"Before running opencode on a remote execution target, the adapter probes model availability by running `opencode models` there, bounded by probeTimeoutSec (20s default, 120s for sandbox transport, capped by input.timeoutSec). The probe is explicitly best-effort: on timeout it warns and proceeds with the configured model, because the real invocation is authoritative and a failed probe must never kill the run (that behavior previously lost agent work mid-flight).","triggerScenarios":"`opencode models` on the remote target exceeding the probe timeout: slow remote cold start, network latency to the target, provider auth hanging, overloaded sandbox; notably more likely at the 20s non-sandbox limit.","commonSituations":"Cold remote hosts where opencode first-run setup is slow; high-latency SSH/sandbox transports; provider outages that stall model listing; very large model catalogs.","solutions":["No action strictly required — the run proceeds with the configured model; check whether the run itself succeeds.","If runs then fail on the model, debug the remote target directly: run `opencode models` there and time it.","Raise the caller's timeoutSec (probe timeout is min(timeoutSec, preset cap)) for slow targets.","Set OPENCODE_ALLOW_ALL_MODELS=1 (run env or process env) to skip the probe entirely — intended for gateway-routed models that never appear in `opencode models` output."],"exampleFix":"# before\n[opencode-local] Remote model availability probe for \"anthropic/claude-sonnet-4-20250514\" timed out after 20s; proceeding with the configured model.\n\n# after — skip the probe for gateway-routed models\nexport OPENCODE_ALLOW_ALL_MODELS=1\n# or give slow targets more headroom in the adapter call: ensureRemoteOpenCodeModelConfiguredAndAvailable({ ..., timeoutSec: 60 })","handlingStrategy":"fallback","validationCode":"const t0 = Date.now();\nconst out = await runAdapterExecutionTargetProcess(runId, target, command, [\"models\"], { timeoutSec: 10, /* ... */ });\nconst probeHealthy = !out.timedOut && (out.exitCode ?? 1) === 0 && Date.now() - t0 < 15_000;\nif (!probeHealthy) {\n  // either skip the run gate or log-and-continue, mirroring the adapter's best-effort policy\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Warm the remote target (run `opencode models` once) before starting timed runs.","Set OPENCODE_ALLOW_ALL_MODELS=1 when using gateway-routed models that never appear in `opencode models`.","Give slow/sandbox transports a larger timeoutSec — the probe uses min(timeoutSec, 20s/120s cap).","Treat this message as informational: the real invocation is the authority on model availability."],"tags":["opencode","remote-execution","model-probe","timeout","best-effort"],"backgroundTag":"command-timeout","analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}