Skip to content

[BUG] Stale cache issues #438

Closed

Description

@JasonLandbridge

Hi there!

I keep running into what looks like stale cache/state issues in the UI.

Example

When I approve all tools:

Image

Then navigate back to the overview page, the UI still shows that there are unapproved tools:

Image

However, if I refresh the page manually, the overview updates correctly and shows that everything is approved.

Expected behaviour

After approving all tools, the overview page should immediately reflect the updated approval state without requiring a full browser refresh.

Actual behaviour

The action appears to succeed, but other parts of the UI still show the previous state until the page is refreshed.

Why this is confusing

I have noticed similar stale-state behaviour in several areas of the UI. It makes it difficult to know whether an action actually succeeded or whether the displayed state is outdated.

This is especially confusing when navigating between pages, because the UI can show different information depending on whether the user refreshed the page or only used client-side navigation.

Possible cause / suggestion

I do not know the Golang at all, but from a frontend perspective this looks like state invalidation or cache synchronization is missing after mutations.

In my own project, Reaparr, the frontend is based on Vue, Nuxt, RxJS, and Pinia stores. The approach I use there is:

  • API data flows into Pinia stores
  • Vue components only consume reactive store state / computed values
  • Actions that mutate server-side state also update or refresh the relevant store state
  • Other components automatically update because they depend on the same reactive source of truth

That kind of pattern helps avoid stale cache issues, because the API result from an action is propagated through the shared frontend state instead of each page keeping its own outdated copy.

For this project, maybe mutations like approving tools could either:

  • update the shared frontend state directly after success, toolsStore.ts
  • return the updated server/tool state and use that to update the UI
  • have the overview page depend on computed properties from the toolsStore.ts

Impact

This would make the UI feel much more reliable, especially for setups with many MCP servers and many tools, where manually refreshing after every action becomes a hassle.

Activity

  1. Dumbris commented on Apr 30, 2026

    @Dumbris
    Member

    Hi Jason — diagnosed and split into two PRs:

    • fix(ui/store): clear missing server fields on merge (#438) #443 — root cause of what you saw. The Pinia mergeServers helper in frontend/src/stores/servers.ts updates each existing server in place via Object.assign, which adds and overwrites but never deletes. The backend's enrichServersWithQuarantineStats (internal/httpapi/server.go:1143-1148) only sets Quarantine when pending > 0 || changed > 0; once you approve everything the field disappears from the JSON entirely, and the stale quarantine: { pending_count: 5 } survives on the in-place reactive object. The author had already special-cased last_error for this exact reason — fix(ui/store): clear missing server fields on merge (#438) #443 generalises that to a key-sync that handles every conditional field, so the same staleness you noticed elsewhere should also clear up.
    • fix(runtime): emit servers.changed after tool approval (#438) #444 — companion: backend now emits servers.changed SSE on approve, so a Servers tab open in another window also reactively updates instead of waiting for the active tab to finish its fetchServers() call.

    Both have unit tests for the regression. Thanks for the precise repro and the Pinia / single-source-of-truth pointer in your write-up — your mergeServers analysis was exactly right and made the fix mechanical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions