Deliberationv4.6.1

Gemini timeout recovery

Gemini timeout recovery

The recovery below applies to standalone bridge calls with a soft timeout. Unified MCP calls use an absolute deadline (retries share it), abort the process group at that deadline, and grant no additional drain period. Host caps also disable drain.

timeout is a soft deadline (default 300000ms; Gemini 3 deep prompts run 200-260s). agy -p streams its answer to stdout incrementally, so the bridge recovers by draining that stream rather than scraping disk. When the soft timeout fires, the bridge does not fail immediately: it keeps agy alive and keeps buffering its streamed stdout for up to recovery-grace ms (default 120000, range 0..600000). If agy completes cleanly within the grace budget (exit 0, no Error: sentinel on stdout), the buffered output is returned as a normal success with a top-level "recovered": true flag and a stderr log line; content is the full answer so response parsers keep working. If agy is still running when the grace budget is exhausted, the call fails with errorKind: "timeout" (still retryable).

  • "recovery-grace": 0 disables the drain (immediate legacy timeout).
  • GEMINI_DISABLE_TIMEOUT_RECOVERY=1 (env) forces full legacy behavior.
  • The call resolves within timeout + recovery-grace. The agy child process is then killed SIGTERM, with a SIGKILL about 1s later; that kill is async cleanup and does not delay the response.

Rendered from TECHNICAL.md in the repository.

Type to search the site.