Repository navigation
Conversation
Scope message cursors to their issuing Hub instance so a retained cache can recover after an explicit replacement connection. Return full snapshots for legacy numeric-only readers and pass instance IDs through both message consumers.
|
@SaKaNa-Y is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
|
👁️🗨️ Review this pull request with grouped, summarized diffs at: raw result💭 analyzed by {
"headSha": "b6f75d1f642d1175191fb450e828ce9ee72c25c2",
"result": {
"overallSummary": "Fixes a message-sync bug where a reader reconnecting to a restarted Hub could receive a stale or foreign delta if the new instance happened to reach the same numeric version, and where a mounted standalone viewer could mix notifications/state between its old and new connections. The Hub now stamps each list result with an instance ID that callers must echo back; the RPC layer tracks that ID per connection so legacy numeric-only callers still get deltas when possible; and the hub-ui keeps messages, toasts, selection and the standalone dock shell scoped per connection so a replacement connection starts clean.",
"groups": [
{
"key": "hub-instance-delta",
"label": "Hub instance-aware deltas",
"summary": "`DevframeMessagesHost.listSince` now requires the caller's cursor to match the host's own instance ID before serving a delta, so a reader that survives a Hub restart and happens to land on the same numeric clock value gets a full snapshot instead of a stale or foreign delta.",
"category": "core",
"filePaths": [
"packages/hub/src/node/host-messages.ts",
"packages/hub/src/types/messages.ts",
"docs/content/8.references/6.hub-api.md"
],
"critical": true,
"fileNotes": [
{
"path": "packages/hub/src/node/host-messages.ts",
"text": "The delta is only returned when `instanceId` matches `_instanceId`; any mismatch (including legacy callers that omit it) now falls back to a full snapshot before the existing trimmed/ahead-of-clock checks run.",
"critical": true
}
]
},
{
"key": "messages-rpc-cursor",
"label": "Messages RPC cursor handling",
"summary": "The `list` RPC function now forwards the host's instance ID to clients and, for callers that only send a numeric cursor, remembers the instance ID from their first snapshot per connection so a legacy or overlapping follow-up read can still resolve to a delta instead of repeating a full snapshot.",
"category": "api",
"filePaths": [
"plugins/messages/src/node/rpc/functions/list.ts",
"plugins/messages/app/client/state/messages.ts"
],
"fileNotes": [
{
"path": "plugins/messages/src/node/rpc/functions/list.ts",
"text": "Uses a `WeakMap` keyed by the RPC session to pin the instance ID of a peer's first full snapshot, so a subsequent numeric-only `since` call from that same connection can be resolved against the right instance even though the client never returns an instance ID.",
"critical": true
}
]
},
{
"key": "hub-ui-connection-isolation",
"label": "Hub UI connection isolation",
"summary": "Replaces the single global messages/toasts singletons with per-connection state (keyed by the RPC client) and remounts the standalone dock shell when its context changes, so a replacement connection gets its own feed, selection and toasts instead of leaking state from the previous one, and clicking a toast opens the panel on the connection that produced it.",
"category": "ui",
"filePaths": [
"packages/hub-ui/src/client/state/messages.ts",
"packages/hub-ui/src/client/state/toasts.ts",
"packages/hub-ui/src/client/components/display/ToastOverlay.vue",
"packages/hub-ui/src/client/components/dock/DockStandalone.vue",
"packages/hub-ui/src/client/components/dock/DockStandaloneShell.vue"
],
"critical": true,
"fileNotes": [
{
"path": "packages/hub-ui/src/client/state/messages.ts",
"text": "On a full snapshot from a different instance, all cached entries and toasts are dropped before applying the new list in snapshot order; a full refresh from the same instance still preserves surviving toasts.",
"critical": true
},
{
"path": "packages/hub-ui/src/client/components/dock/DockStandalone.vue",
"text": "Logic moved verbatim into the new `DockStandaloneShell.vue`; this file now just bumps a `key` to force a remount whenever `context` changes, since panes and trust subscriptions are tied to the context that created them."
}
]
},
{
"key": "tests-and-stories",
"label": "Tests and stories",
"summary": "Coverage for the host, RPC and UI changes above: foreign/expired cursors on the host, same-instance ID-reuse races over the wire, and per-connection isolation of the hub-ui messages/toasts state; the toast stories are updated for the new `createToastStore` API.",
"category": "tests",
"filePaths": [
"packages/hub/src/node/__tests__/host-messages.test.ts",
"packages/hub-ui/src/client/state/messages.test.ts",
"packages/hub-ui/src/client/state/toasts.test.ts",
"packages/hub-ui/src/client/components/display/ToastOverlay.stories.ts",
"plugins/messages/test/dev-server.test.ts",
"plugins/messages/test/message-state.test.ts"
],
"fileNotes": [
{
"path": "plugins/messages/test/dev-server.test.ts",
"text": "Covers the two legacy-reader scenarios: a numeric-only follow-up after a no-arg snapshot, and a reused message ID observed through overlapping reads on the same connection."
},
{
"path": "plugins/messages/test/message-state.test.ts",
"text": "New file exercising the plugin's `useMessages` client against a real `DevframeMessagesHost` across a simulated Hub restart (host instance swap plus trust re-flip)."
}
]
},
{
"key": "generated-snapshots",
"label": "Generated type snapshots",
"summary": "Auto-generated public API snapshots updated to reflect the new `instanceId` parameter/field on `listSince` and the `list` RPC function.",
"category": "other",
"filePaths": [
"tests/__snapshots__/tsnapi/@devframes/hub/index.snapshot.d.ts",
"tests/__snapshots__/tsnapi/@devframes/hub/node.snapshot.d.ts",
"tests/__snapshots__/tsnapi/@devframes/hub/node.snapshot.js",
"tests/__snapshots__/tsnapi/@devframes/hub/types.snapshot.d.ts",
"tests/__snapshots__/tsnapi/@devframes/plugin-messages/rpc.snapshot.d.ts"
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-16T07:00:07.907Z",
"model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
"locale": "en"
}
} |
Keep the feed, toast timers and message selection with their RPC client. On a full snapshot from another Hub instance, drop the previous entries and notifications before applying the new list in order.
Keep the toast, dock selection, trust subscription and iframe panes on the same connection when a mounted viewer receives a replacement context.
Keep the first full snapshot cursor for each legacy connection. A new connection starts from a snapshot, while overlapping reads on the same connection can still observe an ID removed and added again.
The legacy Messages panel starts with list() and sends only the version on its next read. Remember the first snapshot for that peer so an ID removed and reused between reads appears in the delta.
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.
Summary
A reader that connects to a restarted Hub can keep old messages and miss new ones when both instances reach the same numeric version. A mounted standalone viewer can also show a notification from its new connection while the visible panel still belongs to the first connection.
The Hub includes its instance ID in each list result. The messages panel and Hub UI return that ID with their next read.
A replacement connection gets its own message list, selection, toasts and timers. Replacing a standalone viewer’s context also remounts its dock shell, so clicking a toast opens the panel on the same connection. On a full snapshot from a different instance, the UI drops old notifications and rebuilds the feed in snapshot order. A full refresh from the same instance preserves surviving notifications.
Evidence
list(), its nextlist(version)used to return another full snapshot. It now returns the removal and the replacement entry when the Hub reuses a message ID. The older Hub UI starts withlist(null)and receives the same removal across overlapping reads. A fresh connection that sends only a version still gets a full snapshot.Merge Danger
Door: two-way
Blast Radius: message-sync
Direct numeric-only
listSincecalls receive full snapshots. The live messages RPC can serve deltas to older readers after establishing a snapshot on their connection. Older results and static snapshots may omit the instance ID. Connection replacement remains explicit.