fix(virtual-mcp): drop pinned views for detached connections - #6674
Merged
Conversation
A pinned view whose connection is no longer aggregated on the agent rendered an unremovable tab: the settings panel only lists attached connections, so it showed no toggle for it, and its orphan reconcile only pruned pins whose connection fetched OK but lacked the tool — a detached connection is not fetched at all, so the pin survived forever. Filter pins by the agent's attached connections in both the tab bar (immediate) and the settings reconcile (persists the prune). Pins for attached-but-erroring connections are still kept.
pedrofrxncx
enabled auto-merge (squash)
August 28, 2026 12:04
decocms Bot
pushed a commit
that referenced
this pull request
Aug 28, 2026
PR: #6674 fix(virtual-mcp): drop pinned views for detached connections Bump type: patch - decocms (apps/api/package.json): 4.289.1 -> 4.289.2 - @decocms/native (apps/native/package.json): 4.289.1 -> 4.289.2 Deploy-Scope: web
pedrofrxncx
added a commit
that referenced
this pull request
Aug 28, 2026
…emoved (#6704) cleanOrphanedPinnedViews only pruned metadata.ui.pinnedViews when a connection left an agent's aggregation. homeTile/homeTiles carry the identical connectionId shape and were explicitly called out as a known gap in #6674 ('Not in scope ... left for a follow-up'): a home-board tile pointing at a removed connection is stranded the same way #6673's pinned-view tab was. Extracted the filtering into a pure pruneOrphanedUiRefs() so pinnedViews, homeTile, and homeTiles are pruned together, unit-tested without a database.
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.
Problem
A pinned view whose connection is no longer aggregated on the agent renders a tab that cannot be removed.
Reported on
farmrio/ agentvir_H62GklSGy4YowOaV06okW("Visual Merchandising"): aPLP optimizertab pointing atconn_4xFJaZfgju0VCZSH4quts, which is not inconnection_aggregationsfor that agent. The settings panel lists only attached connections, so it rendered no toggle for it — but the tab bar renders straight frommetadata.ui.pinnedViews, orphan included.The existing orphan reconcile in
layout-tab-content.tsxdidn't catch it: it only drops a pin whose connection fetched OK but no longer exposes the tool. A detached connection is never fetched, sofetchedOkIds.has(...)is false and the pin is kept — forever.Fix
keepAttachedPinnedViews()— drop pins whoseconnectionIdisn't among the agent's attached connections. Applied in two places:use-main-panel-tabs.ts— the tab disappears immediately, no visit to settings required.layout-tab-content.tsx— the reconcile now persists the prune.An empty attached-connection list means "not loaded yet" and keeps everything, so the bar never blanks mid-load. Pins for attached connections that fail to fetch are still kept, preserving the transient-error guard.
Testing
apps/web/src/layouts/main-panel-tabs/attached-pinned-views.test.ts— 3 cases: detached dropped, loading keeps all, attached-but-erroring kept.vir_H62GklSGy4YowOaV06okWwas manually corrected (orphan removed frommetadata.ui.pinnedViews, 4 → 3) so the customer is unblocked; this PR prevents recurrence and cleans up any other org's orphans on next agent load.Not in scope
metadata.ui.homeTiles/homeTilehave the same orphan class and are not pruned bycleanOrphanedPinnedViewsinapps/api/src/storage/virtual.tseither. No reported breakage, left for a follow-up.Summary by cubic
Fixes unremovable pinned tabs when a pinned view's connection is no longer attached to the agent.
Bug Fixes
Written for commit dc8b356. Summary will update on new commits.