Files
open-webui/backend/open_webui/utils
Classic298 bb928b0dfe fix: fetch the terminal system prompt per request (#27242)
* fix: fetch terminal system prompt per request with TTL cache

The system prompt was only fetched once in set_terminal_servers (startup
or connection save) with a 3s timeout, using a synthetic 'system' user.
That snapshot silently stays empty when the fetch races a cold-started
orchestrator instance, and goes stale when instances are reprovisioned
with a changed OPEN_TERMINAL_SYSTEM_PROMPT — recovering only after a
restart or a manual connection re-save.

- Fetch /system during get_terminal_tools with the user's own
  credentials via a central TTL-cached method (5 min per server+user;
  failures cached 60s so a dead instance doesn't stall every request),
  falling back to the cached snapshot.
- Raise the fetch timeout from 3s to 30s so cold-provisioned instances
  can answer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KjnQJNKozp47vTB13pRyYs

* refac: fetch the terminal system prompt per request without a cache

Drop the module-level TTL cache and fetch the system prompt directly in
get_terminal_tools, gathered with the existing uncached per-request cwd
fetch that already follows this pattern. The fetch uses the user's own
credentials and falls back to the set_terminal_servers snapshot, so a
cold or unreachable instance degrades to the previous behaviour instead
of needing an error cache. Also restore the 3s timeout: on the request
path a 30s wait would stall chat completions, and a cold instance is
covered by the snapshot fallback until it warms up.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-27 03:07:47 -04:00
..
2026-07-27 00:12:47 -04:00
2026-07-01 02:48:29 -05:00
2026-06-29 11:56:00 -05:00
2026-07-27 03:01:19 -04:00
2026-07-23 22:52:23 -04:00
2026-07-27 00:12:47 -04:00
2026-03-17 17:58:01 -05:00
2026-07-23 02:54:56 -04:00
2026-07-26 21:12:14 -04:00
2026-07-24 01:44:30 -04:00
2026-07-27 02:34:04 -04:00
2026-07-27 03:05:26 -04:00
2026-07-23 21:29:33 -04:00
2026-07-27 02:36:15 -04:00
2026-07-27 00:12:47 -04:00
2026-07-27 02:24:41 -04:00
2026-07-27 02:39:11 -04:00
2026-07-27 03:05:26 -04:00
2026-07-27 02:49:08 -04:00
2026-07-26 23:09:22 -04:00
2026-07-16 01:37:21 -04:00
2026-07-27 02:28:21 -04:00
2026-07-23 19:17:19 -04:00
2026-07-27 02:49:08 -04:00
2026-03-17 17:58:01 -05:00
2026-07-20 22:11:42 -04:00
2026-06-19 00:16:06 +02:00
2026-07-10 18:32:21 -05:00
2026-06-01 13:56:55 -07:00
2026-06-29 12:29:10 -05:00
2026-07-26 17:58:01 -04:00