Skip to content

fix(tui): allow nullable session_id in /reload-mcp params#17774

Closed
Heltman wants to merge 1 commit intoNousResearch:mainfrom
Heltman:fix/tui-reload-mcp-session-id-null
Closed

fix(tui): allow nullable session_id in /reload-mcp params#17774
Heltman wants to merge 1 commit intoNousResearch:mainfrom
Heltman:fix/tui-reload-mcp-session-id-null

Conversation

@Heltman
Copy link
Copy Markdown
Contributor

@Heltman Heltman commented Apr 30, 2026

Fixes #17773.

Problem

hermes --tui fails to build on current main because the /reload-mcp slash command declares its params with a non-nullable session_id: string, but ctx.sid is typed as string | null:

src/app/slash/commands/ops.ts(86,9): error TS2322: Type 'string | null' is not assignable to type 'string'.

First invocation on a fresh install dies during the auto-build step; dist/entry.js is never produced; TUI is effectively unusable.

Fix

Widen the param type to string | null to match ctx.sid and the convention used by every other slash command that forwards the session id (e.g. session.tsprompt.background, config.set, session.compress, session.branch, image.attach all just spread session_id: ctx.sid without narrowing, and the gateway already handles null).

Smallest correct change; no runtime behavior difference.

Verification

cd ui-tui && npm run build   # now clean
hermes --tui -z "smoke test" # → responds normally

Regression introduced in

4d7fc0f37feat(gateway,cli): confirm /reload-mcp to warn about prompt cache invalidation. The TUI dev loop (tsx --watch) skips tsc -p tsconfig.build.json, so the build-time typecheck only fires when end users hit the launcher's on-demand build path. A CI job running npm run build on the TUI would catch future regressions of this class.

The params object literal for the /reload-mcp RPC declared
`session_id: string`, but `ctx.sid` is typed as `string | null`. TypeScript
fails the strict build with:

    src/app/slash/commands/ops.ts(86,9): error TS2322:
    Type 'string | null' is not assignable to type 'string'.

Every other slash command that forwards ctx.sid (e.g. prompt.background,
config.set, session.compress, session.branch in session.ts) passes it
through as-is — the gateway already handles a null session_id. Widen the
param type to match and unblock the TUI build.

Regression from 4d7fc0f (feat(gateway,cli): confirm /reload-mcp to warn
about prompt cache invalidation).
@alt-glitch alt-glitch added P1 High — major feature broken, no workaround type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Apr 30, 2026
@teknium1
Copy link
Copy Markdown
Contributor

Thanks @Heltman — this was already fixed on main in #17836 (fd0796947) as part of a CI stabilization batch, landed a few hours before your PR. The fix on main is the same one-line widen you proposed (session_id: string | null in ops.ts line 85).\n\nYour diagnosis was spot-on — same regression commit (4d7fc0f37), same fix direction. Crediting you here; closing as superseded.\n\nIssue #17773 can be closed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: hermes --tui fails to build on main — TS2322 in ops.ts /reload-mcp params

3 participants