Skip to content

feat(ui): make the streaming-turn timeout configurable via GAIA_STREAM_TIMEOUT - #4916

Merged
kovtcharov-amd merged 3 commits into
amd:mainfrom
madcow4242:fix/configurable-stream-timeout
Oct 12, 2026
Merged

kovtcharov-amd merged 3 commits into
amd:mainfrom
madcow4242:fix/configurable-stream-timeout

Conversation

@madcow4242

@madcow4242 madcow4242 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

…y env var in _chat_helpers.py

Summary

This makes the currently hard-coded _STREAM_TIMEOUT in _chat_helpers.py configurable by an environment variable (GAIA_STREAM_TIMEOUT), or defaults to the current 600 seconds.

Why

Long streams can time out currently when pushed hard.

Linked issue

Closes #4915 (feature request)

Changes

reads _STREAM_TIMEOUT from env var GAIA_STREAM_TIMEOUT or defaults to current value of 600

Test plan

Set GAIA_STREAM_TIMEOUT=1800 before launching GAIA, then try a long streaming query.

  • [ ]

Evidence

Not sure what you actually need here... I can create some logs before/after the change if needed.

  • Agent exposed in the Agent UI (Chat, Email, …) — live browser (Playwright) screenshot(s), before→after (required; text evidence does not substitute)
  • MCP tools / servers — a live MCP client call + response (Agent UI MCP: gaia mcp serve)
  • CLI — the gaia <subcommand> you ran and its actual output
  • HTTP API / REST — the real request and the response (status + body)

Checklist

  • [ x] I have linked a GitHub issue above (Closes #N / Fixes #N / Refs #N).
  • [ x] I have described why this change is being made, not just what changed.
  • [ x] I have run linting and tests locally (python util/lint.py --all, pytest tests/unit/).
  • I have attached real-world evidence matched to the surface I changed (see Evidence above), or marked each surface N/A.
  • I have updated documentation if user-visible behavior changed (see CONTRIBUTING.md).

A typo in GAIA_STREAM_TIMEOUT now stops the Agent UI server at startup
with an error naming the variable, instead of silently using 600s.

- Whole seconds, 1 to 86400; unset or empty keeps the 600s default
- Drop the undocumented STREAM_TIMEOUT alias and restore the file mode
- Timeout message names the variable as a remedy
- Document it in the Agent UI guide; add unit tests
@kovtcharov-amd kovtcharov-amd changed the title fix: fixes feature request #4195: make _STREAM_TIMEOUT configurable b… feat(ui): make the streaming-turn timeout configurable via GAIA_STREAM_TIMEOUT Oct 12, 2026
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Thanks for this, Kevin. It's a real pain point and your fix was in the right place. I pushed a follow-up commit to your branch so it can merge now; nothing more is needed from you.

What changed on top of yours:

  • A bad value (GAIA_STREAM_TIMEOUT=30m, 0, -5) now stops the Agent UI server at startup with an error that names the variable. Before, it quietly fell back to 600s, which looks like the setting is being ignored. Valid values are whole seconds from 1 to 86400. Unset still means 600.
  • Documented it in the Agent UI guide under "Long Responses", and the timeout message now tells users they can raise it.
  • Added unit tests, merged main, and pointed the PR at feat: configurable _STREAM_TIMEOUT via environment variable #4915 (it said fix(rag): LLM-based chunking never terminates #4195, which is an unrelated RAG issue).
🔍 Technical details
  • _stream_timeout_from_env() in src/gaia/ui/_chat_helpers.py is read once at import into _STREAM_TIMEOUT_SECONDS. server.py imports the module eagerly, so a bad value fails at server start, not partway through a turn.
  • Removed the STREAM_TIMEOUT fallback alias. It was undocumented and generic enough to collide with other tools' env.
  • Changed the file mode back to 100644 (the PR had changed it to 100755) and fixed the comment that said the default was 1200.
  • Tests: tests/unit/test_stream_timeout_env.py covers the default, valid values, non-integer and out-of-range errors, and an import-time failure in a subprocess. tests/unit/chat/ui/ passes (1430).
  • The default is unchanged, so no agent eval is needed.

@github-actions github-actions Bot added documentation Documentation changes tests Test changes labels Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

Users can now raise the Agent UI's 10-minute limit on streamed replies with GAIA_STREAM_TIMEOUT, and the behaviour is unchanged when it isn't set. A bad value stops the server at startup with an error that names the variable, so the setting can't be silently ignored. The docs and the timeout message both tell users the setting exists. Nothing blocks merge.

  • 🟡 No real-world evidence on the PR. The tests cover parsing and the startup failure. Nothing shows a long turn running past 600s with the variable set, or the new timeout message in the UI. One run that sets a small value (e.g. GAIA_STREAM_TIMEOUT=30) against a slow query, with a screenshot of the "raise GAIA_STREAM_TIMEOUT" message, would do. Alternatively, mark the Evidence section N/A with a reason.
  • 🟢 With a bad value, gaia chat --ui prints a raw Python traceback. The message is clear but sits at the bottom of the traceback. The launcher already prints a clean Error: line for a bad GAIA_HOME, and this could get the same treatment.
🔍 Technical details
  • The ValueError from _stream_timeout_from_env() is raised while gaia.ui.server is being imported inside the try in src/gaia/cli.py (around line 870). That block catches only UnsafeGaiaHomeError, ImportError and OSError, so the error escapes uncaught. Catching ValueError around the import and printing Error: {e} before sys.exit(64) would match the UnsafeGaiaHomeError handling. This is optional, because the failure is already loud and actionable.
  • I checked for a client-side cap that would make the setting pointless. The webui and TUI have no matching SSE timeout. agent_ui_mcp.py uses timeout=180 on its streaming requests.post, but that is a per-read timeout, not a total deadline, so it doesn't conflict.
  • The default stays at 600, so no agent eval is needed.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 12, 2026
Merged via the queue into amd:main with commit 5928f18 Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: configurable _STREAM_TIMEOUT via environment variable

2 participants