refactor(agent-shell): dedupe the duplicate useSessionRuntime(virtualMcpId) call - #6678
Merged
pedrofrxncx merged 1 commit intoAug 28, 2026
Conversation
…McpId) call VmEventsBridge called useSessionRuntime(virtualMcpId) twice with identical args - once for the auto-fresh-branch staleness check (#6639), once further down for the sandbox events gate. Both calls resolve to the same answer for the same render; the second was pure recompute. Reuse the first result.
pedrofrxncx
enabled auto-merge (squash)
August 28, 2026 13:07
pedrofrxncx
deleted the
refactor/dedupe-session-runtime-call-in-vm-events-bridge
branch
August 28, 2026 13:19
decocms Bot
pushed a commit
that referenced
this pull request
Aug 28, 2026
PR: #6678 refactor(agent-shell): dedupe the duplicate useSessionRuntime(virtualMcpId) call Bump type: patch - decocms (apps/api/package.json): 4.291.1 -> 4.291.2 - @decocms/native (apps/native/package.json): 4.291.1 -> 4.291.2 Deploy-Scope: web
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.
Follows #6639, which added the auto-fresh-branch staleness check to
VmEventsBridgeinapps/web/src/layouts/agent-shell-layout/index.tsx.That PR's new code calls
useSessionRuntime(virtualMcpId)for the CMS-runtime check, and the pre-existing code further down in the same component callsuseSessionRuntime(virtualMcpId)again with the identical argument, to gate the sandbox-events subscription. Both calls resolve to the exact sameSessionRuntimeanswer for the same render (samevirtualMcpId, same underlyinguseVirtualMCP/useOptionalChatTaskreads) — the second call is pure redundant recompute inside a component that already fires on every branch/task/session change.Net: -5 / +3. Single call site, both usages now read from the same
sessionStateresult — behavior is unchanged (verified the two derivations,cmsRuntime/cmsRuntimeResolvedandsessionRuntime, are structurally identical reads off the same object).A reviewer can confirm by diffing: both former call sites reduce to reads of one
useSessionRuntime(virtualMcpId)result.Locally ran:
bun run fmt,bunx tsc --noEmit(apps/web — no new errors; one pre-existing, unrelated prosemirror-model version-skew error is present on main and untouched by this diff),bunx oxlint apps/web/src/layouts/agent-shell-layout/index.tsx(0 warnings/errors). No test file changes needed since this is a pure behavior-preserving call dedupe, not new logic. Full CI validates the rest.Summary by cubic
Dedupes the duplicate
useSessionRuntime(virtualMcpId)call inVmEventsBridgeso the same session state is no longer recomputed twice per render. Behavior is unchanged: both the auto-fresh-branch staleness check and the sandbox-events gate now read from the singlesessionStateresult.Written for commit 0f32ee7. Summary will update on new commits.