Skip to content

fix(agent-sidebar): stop reload from clobbering saved state (0.5.9)#311

Merged
I-am-nothing merged 2 commits into
mainfrom
fix/sidebar-save-clobber
Jun 14, 2026
Merged

fix(agent-sidebar): stop reload from clobbering saved state (0.5.9)#311
I-am-nothing merged 2 commits into
mainfrom
fix/sidebar-save-clobber

Conversation

@I-am-nothing

Copy link
Copy Markdown
Contributor

Live-reproduced root cause

Reloading the agent sidebar reverted width to default and history → new chat, and stayed reverted. Reproduced via Playwright on the deployed 0.5.8: persisted width 653 → after a few reloads the server record itself became {open:true,activeTabId:null,tabs:[],width:384}. So both symptoms are ONE bug: a save before hydration overwrites the server.

useAgentTabs.schedulePut only gated on persistence+enabled, not hydration. A mount-time mutation (host bridge setOpen, route-driven tab change) → mutate → schedulePut → PUT of the empty un-hydrated strip before the GET settles → permanent clobber. #305/#308(0.5.8)/#309 fixed restore authority but never gated the save.

Fix

schedulePut refuses to persist until hasHydratedRef is set (set even on GET failure in reconcile's finally, so saves never stall). Width clobber is fixed by the same gate (the clobbering PUT was this tab-put carrying the placeholder width).

Tests

RED→GREEN regression: a pre-hydration mutation must not put. Verified ✗ without the fix, ✓ with it. Full suite 777/777, typecheck + build clean.

release label → publishes 0.5.9.

I-am-nothing and others added 2 commits June 14, 2026 17:48
…load clobber)

schedulePut() only gated on persistence+enabled, so a mount-time mutation (host bridge setOpen, route-driven tab change) PUT the empty un-hydrated strip before the GET settled — permanently overwriting the server's saved state with {tabs:[], placeholder width}. Reproduced live: persisted width 653 -> server clobbered to {tabs:[],activeTabId:null,width:384} after a few reloads. Gate schedulePut on hasHydratedRef (set even on GET failure, so saves never stall). Adds a RED/GREEN regression test (pre-hydration mutation must not PUT).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ships the sidebar save-clobber fix. release label publishes on merge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@I-am-nothing I-am-nothing added the release Trigger a version bump on merge label Jun 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/311/

github-actions Bot added a commit that referenced this pull request Jun 14, 2026
@I-am-nothing I-am-nothing merged commit 2c4c69d into main Jun 14, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in MirrorStack Platform Jun 14, 2026
github-actions Bot added a commit that referenced this pull request Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Trigger a version bump on merge

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant