Repository navigation
Conversation
Placeholder commit so the draft PR can exist with no code yet: the write-up of the issue is in the PR body.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Empty draft: no code yet. The single commit is
--allow-emptyon purpose — this PR exists to hold the write-up below.Problem
Llama Chat asks the server what it can do once, at page load, and never asks again. Everything the UI builds from that first answer — agent mode, the tools menu, the working folder, MCP, the model list — is then frozen for the life of the tab.
The flags
llama-serverwas started with therefore only apply to tabs opened after the restart:--agentor--tools--ui-mcp-proxyagenticMode.enabledstays false,cors_proxy_enabledis stale--ui-agentn_ctx, modalities, build info, settings defaultsThe only way to see the new state is a manual refresh.
How the UI learns this today
serverStore(ui/apps/chat/src/lib/stores/llama-server.svelte.ts) ownspropsfromGET /props. It refetches only on503— the "model still loading" case, viascheduleRetry()— or when the user hits retry on the error splash / banner.+layout.svelte:239-247runs that fetch once, guarded byif (!serverStore.props).toolsStore.fetchServerTools()(lib/stores/tools.svelte.ts:240) fillsagenticMode.serverHasTools/serverToolsKnown. It is called lazily (use-tools-panel.svelte.ts:135,stores/agentic/index.svelte.ts:945) and never re-validated.agenticMode(lib/stores/agentic-mode.svelte.ts:27) combines the two sources:serverHasTools || props.cors_proxy_enabled || props.ui_agent. Itssettledgetter tells a page the answer is final — and nothing ever invalidates it.cors_proxy_enabledandui_agentin/props(tools/server/server-context.cpp:5683,tools/server/server-models.cpp:2121), built-in tools in/tools.Worth noting the asymmetry: per-model props do get re-validated —
ModelPropsManagersits a TTL cache in front of/props?model=<id>(lib/stores/models/props.svelte.ts:48) — while the global/propsand/toolshave no TTL and no invalidation path at all. So model modalities go stale slowly, agent mode goes stale immediately.Expected behavior
Restart
llama-serverwith--agentwith the tab already open: within a moment the tab shows the agent UI, no refresh. Same in reverse when the flags are dropped, and the same for the model list and the/propsvalues settings sync reads.Proposed direction
serverStore.revalidate()that refetches/propsand/toolstogether, and resetsagenticMode(serverHasTools,serverToolsKnown) first so no page can act on a mix of the old server and the new one. Reuse the existingbackground: truepath so nothing flashes the loading splash./propsalready returnsbuild_info, and a restart changes it. Compare against the last seen value and revalidate on change — that is what makes "someone restarted with--agent" detectable without being told.visibilitychange → visible(there is precedent:+layout.svelte:227re-syncs running streams exactly there), onwindowonline / focus, after a failing request starts succeeding again, plus a low-frequency poll as a fallback. Nothing while the tab is hidden.agenticModeshould re-render. A hardlocation.reload()would drop in-flight streams and unsent input — the 401 reload at+layout.svelte:204is the pattern to avoid here.ETagon/propsand/toolswould beat thebuild_infoheuristic, and exposing the process start time would make a restart unambiguous.Open questions
/healtha cheaper heartbeat than/props?/propsis in the precache list (lib/constants/pwa.constants.ts:133) — confirm revalidation never gets served from the service worker cache.Plan
serverStore.revalidate()+agenticMode.reset(),/propsand/toolsin one passbuild_info, wired to visibility / focus / online / error-recovery--agentappearing and disappearing across a revalidation;settledsemantics after reset--agent, assert the tools menu appears without a refresh