Skip to content

fix: refresh stale MCP daemon for session CLI - #55

Merged
benvinegar merged 2 commits into
mainfrom
feat/session-cli-tool-compat-fix
Mar 22, 2026
Merged

fix: refresh stale MCP daemon for session CLI#55
benvinegar merged 2 commits into
mainfrom
feat/session-cli-tool-compat-fix

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • detect when hunk session is talking to an older live Hunk MCP daemon missing newer tools
  • refresh that stale daemon from the current source tree before running newer session commands
  • surface real MCP tool errors instead of vague empty-payload failures

Problem

A real live Hunk session could stay connected to an older daemon that only exposed list_sessions, get_session, and comment. In that state:

  • hunk session list worked
  • hunk session get worked
  • hunk session comment add worked
  • but hunk session context, comment list, and comment rm failed

This happened because the CLI was talking to a stale daemon rather than the current checkout's newer MCP tool surface.

Fix

  • probe available MCP tools before running session commands
  • if a command requires newer tools and the daemon looks like an older Hunk daemon, stop it and start a fresh daemon from the current source tree
  • wait for the target live Hunk session to reconnect before proceeding
  • throw actual MCP tool errors instead of silently treating them as missing payloads

Validation

  • bun run typecheck
  • bun test test/session-cli.test.ts test/cli.test.ts test/mcp-client.test.ts test/mcp-daemon.test.ts
  • manual verification against a real live Hunk session:
    • session context works
    • session comment list works
    • session comment rm works

@benvinegar
benvinegar merged commit ac84eb4 into main Mar 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant