Repository navigation
Conversation
Register tracing cleanup when an instance acquires its context so close and setup failure both release local recording and relay subscriptions. Keep independently owned recorders and caller-supplied Hub contexts active.
|
@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": "d90959d0f9c931799479e0761613d65cfbee350a",
"result": {
"overallSummary": "Fixes a tracing bug where closing or failing to set up a devframe/Hub instance could leave its local recorder subscribed to Node's diagnostics channel, causing duplicate captures when a replacement instance recorded the same channel. The fix registers tracing cleanup at context-creation time (before setup runs) so both clean close and setup failure release owned subscriptions, while channels still owned by a caller-supplied (borrowed) context are left intact and their stopped state is published for any hub still watching them.",
"groups": [
{
"key": "tracing-lifecycle",
"label": "Tracing lifecycle cleanup",
"summary": "Ensures a devframe/Hub instance releases the tracing recorder it owns when its context is created locally, on both normal close and setup failure, while leaving tracing alone when the context was supplied by the caller. Adds detach/dispose bookkeeping in `DevframeTracingHostImpl` so attached sources are unsubscribed (not stopped) and local channels are stopped, streams closed, and their stopped state published for any hub still borrowing the context.",
"category": "core",
"filePaths": [
"packages/devframe/src/node/host-tracing.ts",
"packages/devframe/src/node/instance-shell.ts",
"packages/devframe/src/adapters/initiate.ts",
"packages/hub/src/node/initiate.ts"
],
"critical": true,
"fileNotes": [
{
"path": "packages/devframe/src/node/host-tracing.ts",
"text": "`dispose()` stops locally-owned channels and detaches external sources without stopping them; it also keeps publishing channel updates to a borrowing hub via `publishClosedChannels` until that hub itself disposes.",
"critical": true
},
{
"path": "packages/devframe/src/node/instance-shell.ts",
"text": "`ownTracing()` registers the context's tracing host for cleanup before setup runs, so a setup-time throw still releases the subscription via the new `init().catch(...)` and `close()` paths."
}
]
},
{
"key": "tracing-tests",
"label": "Tracing lifecycle tests",
"summary": "Adds coverage for the new teardown behavior: reattachment during unsubscribe, instance replacement scenarios, setup-failure cleanup, and borrowed-context handling across both devframe and Hub entry points.",
"category": "tests",
"filePaths": [
"packages/devframe/src/node/__tests__/host-tracing.test.ts",
"packages/hub/src/node/__tests__/tracing-lifecycle.test.ts"
]
},
{
"key": "api-snapshot",
"label": "API snapshot update",
"summary": "Generated type snapshot update reflecting the new `ownTracing` method on `InstanceShellApi`.",
"category": "other",
"filePaths": [
"tests/__snapshots__/tsnapi/devframe/internal.snapshot.d.ts"
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-28T07:14:30.451Z",
"model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
"locale": "en"
}
} |
Publish the local recorder's final state when its owner closes. A hub sharing the context can still read and clear history, so mirror later channel metadata changes without reopening recording or streams.
SaKaNa-Y
marked this pull request as ready for review
November 28, 2026 07:38
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
Closing a devframe or Hub while its local recorder was active left it subscribed to Node's diagnostics channel. If a replacement recorded the same channel in the same process, both instances captured the next call. Setup could leave the same subscription behind if it started recording and then threw.
initDevframe()andinitHub()now register tracing cleanup when they create a context, before setup runs. A Hub that still serves that context can read the stopped channels and clear their history.Evidence
123. After the change, only the replacement captured it. For both entry points, a setup failure released the local subscription and preserved the original error.DF0030. With this change, the second Hub's SSE client readrecording: false, nostreamId, and one buffered record. Clearing history through RPC changed the count to zero.Merge Danger
Door: Two-way. Reverting restores the previous cleanup behavior.
Blast Radius: Tracing. Stopping an external recorder would make its owner miss later calls. The close tests confirm that both an attached tool and the owner of a borrowed context can keep recording.