fix(tui): add null guard for ctx.sid in /reload-mcp slash command#17822
Closed
luyao618 wants to merge 1 commit into
Closed
fix(tui): add null guard for ctx.sid in /reload-mcp slash command#17822luyao618 wants to merge 1 commit into
luyao618 wants to merge 1 commit into
Conversation
When ctx.sid is null (no active session), /reload-mcp crashes because it passes null as session_id to the gateway RPC call. Other mutating slash commands (/rollback, /save) already have this guard. Add the same early-return pattern: check ctx.sid before building the RPC params, and show a user-friendly message instead of crashing. Closes NousResearch#17794
Collaborator
13 tasks
Collaborator
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
Add a null guard for
ctx.sidin the/reload-mcpslash command handler, matching the existing pattern used by/rollbackand/save.Problem
When
ctx.sidisnull(no active session),/reload-mcpcrashes because it passesnullassession_id: stringto thereload.mcpRPC call. The TypeScript type forparams.session_idisstring, butctx.sidisstring | null.Fix
Added an early-return null check at the top of the
runhandler, before building the RPC params:This matches the guard pattern already used by
/rollback(line 193) and/savein the same file.Changed Files
ui-tui/src/app/slash/commands/ops.ts— 3 lines addedCloses #17794