Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(agent-core): allow a provider 600s of silence, not 300s (#2433)

Call White475ff5e161db
diff --git a/core/agent_core/ai/_common.py b/core/agent_core/ai/_common.py
index fb6a4a1b1..e33c13853 100644
--- a/core/agent_core/ai/_common.py
+++ b/core/agent_core/ai/_common.py
@@ -69,15 +69,17 @@ class WireField:
# A provider that never answers or stops sending mid-stream must not hold an
# agent turn forever, but a healthy one can stay silent for minutes: a
# reasoning model before its first token, or a relay that buffers a long tool
-# call's arguments. Through Model Hub even the response headers wait for the
-# first model output. Codex, Claude Code, Pi, and OpenCode all allow 300s of
-# silence, so the same bound covers every wait on the provider: response
-# headers, the first chunk, and each next chunk. Connecting stays separately
-# short, so an unreachable provider still fails fast. Both bounds are shared
-# by every native adapter; the loop may retry the resulting error only when no
-# model output has been emitted.
+# call's arguments. One bound covers every wait on the provider: response
+# headers, the first chunk, and each next chunk. Codex, Claude Code, Pi, and
+# OpenCode allow 300s of silence; Avibe allows 600s (owner decision,
+# 2026-10-10), because Model Hub withholds even the response headers until the
+# first model output, so a high-effort reasoning model's thinking time is all
+# silence and can exceed five minutes. Connecting stays separately short, so an
+# unreachable provider still fails fast. Both bounds are shared by every native
+# adapter; the loop may retry the resulting error only when no model output has
+# been emitted.
CONNECT_TIMEOUT_S = 10.0
-PROVIDER_SILENCE_TIMEOUT_S = 300.0
+PROVIDER_SILENCE_TIMEOUT_S = 600.0
CLEANUP_TIMEOUT_S = 10.0
MAX_CUMULATIVE_OUTPUT_CHARS = 32 * 1024 * 1024
# Conservative structural allowances, not a one-byte item counter. These cover
diff --git a/docs/plans/agent-core-contracts/conversion-tables.md b/docs/plans/agent-core-contracts/conversion-tables.md
index 7dfcbbb6d..b0e56530c 100644
--- a/docs/plans/agent-core-contracts/conversion-tables.md
+++ b/docs/plans/agent-core-contracts/conversion-tables.md
@@ -19,7 +19,7 @@ rules on top of those mappings.
| Missing tool results | The transform inserts `[tool call interrupted; no result recorded]` with `is_error=true`. |
| Origin | Direct requests use the endpoint origin. Gateway requests parse only `x-avibe-served-hop`, whose JSON object must contain exactly `provider`, `api`, and `model`. A missing or invalid report makes the response unverified: thinking and tool-call signatures are nulled, and redacted thinking is dropped before allocating a canonical slot, so later event indexes still identify their final message blocks. |
| Cancellation | `CancelToken` ends the HTTP stream and yields one non-retryable `ProviderError(kind="aborted")`. Opening, stream reads, error-body reads, media loads, and served-hop resolution all use the shared cancellation-aware await owner. |
-| Network timeouts | The shared lifecycle driver bounds connecting at 10 seconds; a connect failure or timeout is `ProviderError(kind="network")`. Every wait on a connected provider (response headers, the first chunk, and each next chunk) is bounded by the same 300-second silence bound, the stream idle bound of Codex (`stream_idle_timeout_ms`), Claude Code, Pi, and OpenCode: reasoning models and relays that buffer tool-call arguments stay silent far longer than a connect window, and through Model Hub the response headers wait for the first model output. Running out of the silence bound is `ProviderError(kind="stalled")`, never a connection failure. Both kinds are retryable only when no model output was emitted; a provider that never sends response headers cannot hang a turn. A bounded 10-second cancellation join detaches a non-cooperative transport task instead of extending the timeout indefinitely. |
+| Network timeouts | The shared lifecycle driver bounds connecting at 10 seconds; a connect failure or timeout is `ProviderError(kind="network")`. Every wait on a connected provider (response headers, the first chunk, and each next chunk) is bounded by the same 600-second silence bound: reasoning models and relays that buffer tool-call arguments stay silent far longer than a connect window. Codex (`stream_idle_timeout_ms`), Claude Code, Pi, and OpenCode use 300 seconds; Avibe doubles it (owner decision, 2026-10-10) because through Model Hub the response headers wait for the first model output, so a high-effort reasoning model's thinking time is all silence and can exceed five minutes. Running out of the silence bound is `ProviderError(kind="stalled")`, never a connection failure. Both kinds are retryable only when no model output was emitted; a provider that never sends response headers cannot hang a turn. A bounded 10-second cancellation join detaches a non-cooperative transport task instead of extending the timeout indefinitely. |
| HTTP response status | Only 2xx responses enter an SSE translator. Redirects (3xx) are terminal `invalid_request` errors and are never followed implicitly; 4xx/5xx bodies use the shared status-aware classifier. |
| SSE memory and scan bounds | `SSEParser` caps an unfinished line at 8 MiB of decoded characters and an unfinished event's combined `data:` fields at 32 MiB of decoded characters. It scans each buffer with a cursor and compacts once per feed, so many short fields remain linear rather than repeatedly copying the suffix. Exceeding either bound is one terminal `invalid_request` provider error, with any assembled partial preserved. |
| Cumulative assembled-output bound | `StreamAssembler._account_output` is the only byte-accounting function. It covers text, thinking, signatures, opaque/reasoning details, tool arguments, serialized initial tool inputs, tool-call identities and aliases. Each content slot, tool state, or Anthropic block-kind entry adds a conservative 2048-byte structure allowance; each alias adds 512 bytes, plus its string payload. The cumulative accounting budget is 32 MiB across the stream, not an exact process-RSS promise (transport/parser buffers and transient materialization have separate costs). An over-budget mutation raises one terminal `invalid_request` error, preserving the assembled partial. |
diff --git a/tests/test_vibey_agent.py b/tests/test_vibey_agent.py
index 0f670d231..07ac36f90 100644
--- a/tests/test_vibey_agent.py
+++ b/tests/test_vibey_agent.py
@@ -1170,15 +1170,18 @@ async def test_a_failed_run_shows_localized_copy_and_a_refusal_shows_its_explana
async def test_a_provider_stall_is_not_shown_as_a_connection_failure(
engine, session, tmp_path, published, language
) -> None:
+ from core.agent_core.ai._common import PROVIDER_SILENCE_TIMEOUT_S
from core.agent_core.ai.provider import ProviderError
- stall = ProviderError("stalled", "provider sent no data for 300s", False)
+ stall = ProviderError("stalled", "provider sent no data for 600s", False)
harness = _Harness(engine, tmp_path, "telegram", [[stall]], language=language)
await harness.agent.handle_message(harness.request("write the page"))
- # The copy names the 300-second silence bound in minutes.
- stalled_copy = i18n_t("vibeyAgent.error.stalled", language, minutes="5")
+ # The shipped silence bound (owner decision, 2026-10-10), which the copy names in minutes.
+ assert PROVIDER_SILENCE_TIMEOUT_S == 600.0
+ stalled_copy = i18n_t("vibeyAgent.error.stalled", language, minutes="10")
+ assert "10" in stalled_copy and "{minutes}" not in stalled_copy
assert harness.controller.im_client.sent == [f"❌ {stalled_copy}"]
assert stalled_copy != i18n_t("vibeyAgent.error.network", language)