Plugin pages reappear in the sidebar after every update although Settings › General › Sidebar pages still lists them as hidden
Summary
Pages hidden in Settings › General › Sidebar pages come back in the sidebar after every magpie update for third-party (plugin) pages only — while the setting keeps showing them as hidden. Built-in pages (Agents, Routing, …) survive the update correctly; only plugin tabs reappear.
Root cause
internal/gui/assets/app.js filters the sidebar (navHides(), around line 23483):
function navHides() {
if (mode !== "window") return;
window.navArrange ? navArrange() : navList("Order").length && import("./navorder.js").then(navHides, () => {});
for (const b of $("#nav").querySelectorAll("button[data-view]")) b.hidden = ... || navMine().includes(b.dataset.view);
}
Its only callers are start.js (once, at boot, before plugin tabs exist), navpages.js after a save, setGatewayMode() and applyFeatures() (app.js). The plugin tabs, however, are built asynchronously in pluginpages.js load() (245-318): it await api("plugin-pages") (248), creates and appends every tab (306), and then only calls navSubs() (309) — never navHides() / navArrange(). So after a restart/update the new tabs are created with hidden === false and nothing re-applies the stored magpie.navHidden list. The setting itself is drawn from the same stored list (navpages.js:120 const mine = navMine()), so it still says "hidden" — exactly the reported contradiction.
A secondary factor: plugin page keys are not stable. internal/gui/pluginpage.go:133-155 (windowParts) derives the key from plugin.ShortName(PackageName(spec)) and de-duplicates repeats by appending -2, -3, … in plugins.json order (pluginpage.go:152). A reinstall/update that changes that order (or adds/removes a duplicate package) renames the key, so the stored entry no longer matches and the tab shows even if the filter did run.
Repro
- Hide one or more plugin pages in Settings › General › Sidebar pages.
- Update magpie (or restart into a build whose
plugins.jsonorder changed). - The plugin tabs are back in the sidebar; the menu still lists them as hidden.
- Uncheck and re-check any of them — they disappear again (a write is what applies the filter).
Suggested fix
- In
pluginpages.jsload(), after thenavSubs()call, also callnavHides()(it already runsnavArrange()), and refresh the row withwindow.renderNavPages?.(). That puts freshly created plugin tabs through the same filter as built-in pages. - Optionally, derive the plugin page key from something stable instead of
plugins.jsonorder (package name alone with a deterministic suffix), or re-map orphanedmagpie.navHiddenentries when a key disappears, so an update can never leave dead entries behind.
Environment
- magpie 0.1.4594 (Windows 11 x64);
%USERPROFILE%\.config\magpie\plugins.jsonhas 38 entries; two packages (opencode-catpaw-auth,opencode-orcaterm-auth) appear twice each, once as an installed node_modules path and once as…@latest, so their generated keys collide today and whichever row comes second gets the…-2suffix. Any reinstall or update that re-orders those rows renames the page. - Code read on
main@ b9dc1d0b (v0.1.4595). - Introduced by
22f2759d7(closing #5685); ordering byb010fba05.
Investigation only — no local fix applied, and no duplicate of #5685: that one added the setting, this is the filter not being re-run for tabs created later.
I have a fix ready on a fork branch (9997313c, based on main at 5f952c8): https://github.com/yetone/magpie/compare/main...eisen0419:magpie:fix/7335-plugin-pages-nav-hides
Cause:
- Plugin sidebar tabs are created asynchronously in
pluginpages.jsload()afterstart.jshas already runnavHides(), so tabs hidden inmagpie.navHiddenreappeared on every restart/update (and custom sidebar order was not re-applied once they appeared). - In
internal/gui/pluginpage.go, duplicate copies of the same package received-2/-3suffixes inplugins.jsoniteration order, so reorderingplugins.jsonrenamed their page keys.
Fix:
- Added
afterPagesinpluginnav.js(keepingindex.htmlcore script budget down by 98 bytes:1,275,224 -> 1,275,126) to runnavHides,navSubs, andrenderNavPagesonce plugin tabs load, avoid restoring a hidden plugin page frommagpie.lastViewwhile still allowing explicit?view=, and preservereplacespositioning innavArrange. - Assigned duplicate plugin page keys (
-2,-3, ...) deterministically in spec order rather thanplugins.jsonorder (single-install plugins keep their exact existingplugin-<shortname>key; first-enabled built-inreplacesprecedence stays unchanged).
Verification (temp HOME, go1.27.1):
gofmt -lclean;go vet -tags nogui ./...clean.go test -count=1 -tags nogui -run 'TestPluginPageKeysStayPut|TestPluginPageReplacesFirstWins|TestPluginPanelsServedShutIn|TestPluginPageServedShutIn|TestCoreScriptBudget' ./internal/gui: ok.- Playwright GUI tests (
plugin-page-nav-hidden.test.cjs4/4,nav-pages-hidden.test.cjs+nav-pages-order.test.cjs12/12): all green on both Chromium and WebKit.
Thank you for preparing the fix and the focused tests. I checked the comparison: applying hidden/subscription state after async page loading addresses the timing described in my report. I could not find an upstream PR linked to #7335 yet; could you open one from this branch so the maintainer can review and release it?
One compatibility case is worth covering in that PR: the first upgrade from the old ordinal duplicate keys. With two identical base keys and old spec order [z, a], the old algorithm assigns the base key to z and -2 to a; sorting specs assigns the base to a instead. An existing navHidden choice may therefore hide the other duplicate on the first upgrade. Please document/handle that transition or include a regression starting from the old key assignment, rather than only checking reorder stability under the new algorithm.
I have not installed this fork or treated the reported Chromium/WebKit results as a Windows WebView2 runtime pass. After an official build is available, the relevant Windows check is: hidden plugin tabs stay hidden across upgrade/restart, an implicitly restored hidden lastView falls back safely, an explicit ?view= link remains usable, and custom order/replacement placement does not drift.
@Beyfish Thanks for reviewing the compare diff.
- Why there is no PR:
yetone/magpierestricts PR creation to collaborators (seedocs/contributors.md), so external fixes are shared via fork branches on the issue for maintainers to review and pull. - First-upgrade transition for duplicate colliding short-names: Good catch — single-install plugins keep their exact
plugin-<shortname>key unchanged, and the one-time key swap only applies if two enabled plugins collide on the same base key and happened to be ordered[z, a]inplugins.jsonbefore upgrade. Because any order-independent deterministic key assignment cannot simultaneously preserve arbitrary priorplugins.jsonorder without storing a separate persisted key map, sorting colliding specs does a one-time canonicalization on that first upgrade and prevents further drift on reorders afterward. Happy to drop the duplicate-key sorting if maintainers prefer keeping the minimal async-afterPagesfix only, or to add a persisted map if they'd rather migrate[z, a]duplicates seamlessly.
Thanks for clarifying — I missed docs/contributors.md when asking for a PR. I have checked it now: this repository accepts external fixes via issue-linked fork branches for maintainers to review/pull. I will not ask you to bypass the collaborator restriction.
For my original sidebar report, I would prefer the minimal async afterPages fix that preserves existing page keys, with duplicate-key identity/canonicalization handled as a separate change. Your explanation of the one-time [z, a] transition is clear; it should not be described as preserving every existing hide choice. This is a reporter preference, not a maintainer decision or permission to add a new persisted-key scheme.
@yetone / maintainers: could you review and pull the contributed fix branch through the documented workflow, and choose whether to take the minimal timing fix first or include the duplicate-key behavior with an explicit migration decision? Please retain the contributor's authorship/credit as the policy specifies.
I have not installed the fork or claimed Windows WebView2 verification. After an official build is available, I can check the original persisted-hidden-state behavior and the stated navigation compatibility cases. No additional private session or account material is needed for that.
Fixed in d0d8e02c2 (v0.1.5015): pluginpages.js's load now runs navHides, navSubs and Settings' count each time it draws the plugin tabs, and a kept lastView that is a hidden plugin page is not reopened (?view= still opens it). Also taken from eisen0419's 9997313c, with credit: navArrange keeps a plugin page in a built-in's place beside it when the order is applied later. The duplicate-key change in pluginpage.go is not in this commit, as you asked. I'm leaving this open until you confirm it holds after an update.
Confirmed on my end — verified on v0.1.5276: I disabled a plugin page in Settings › General › Sidebar pages, restarted, and it stayed hidden instead of reappearing in the sidebar. The duplicate-key change in pluginpage.go is not needed on my side, exactly as requested.
Thanks, and credit given for 9997313c. I'm closing this as fixed.