Skip to content

fix: capture ExitPlanMode and restore MultiEdit/NotebookEdit in Claude prompt hook#137

Open
joshazmy wants to merge 1 commit into
codeaholicguy:mainfrom
joshazmy:fix/110-telegram-missing-prompts
Open

fix: capture ExitPlanMode and restore MultiEdit/NotebookEdit in Claude prompt hook#137
joshazmy wants to merge 1 commit into
codeaholicguy:mainfrom
joshazmy:fix/110-telegram-missing-prompts

Conversation

@joshazmy

@joshazmy joshazmy commented Jul 6, 2026

Copy link
Copy Markdown

Summary

Fixes #110 — agent prompts (selection questions, permission approvals) were never showing up in the Telegram chat.

Root cause: the PreToolUse hook matcher regex in packages/cli/assets/claude/settings-hook.json only covered Bash|Edit|Write|AskUserQuestion. Any Claude Code tool call not matched by this regex never fires the hook, so it's never written to the agent-request store and never reaches the JS dispatch/formatting code (formatPromptMessage in channel-runner.ts, which already handles every tool name generically once it receives one). The drop happens entirely upstream, in the hook config itself — not in any routing/dispatch logic.

Two concrete gaps in that one matcher:

  • ExitPlanMode was never included, even in the original design doc — Plan Mode's approval prompt is one of the most common permission-approval prompts in normal Claude Code usage, and is very likely what the issue is describing.
  • MultiEdit|NotebookEdit were silently dropped by an unexplained "chore" commit (61a6633), uncaught because the only existing test exercised a synthetic fixture rather than the real shipped asset.

Fix: broaden the matcher to Bash|Edit|Write|MultiEdit|NotebookEdit|ExitPlanMode|AskUserQuestion.

A regression test was added that reads the real shipped settings-hook.json asset (not the synthetic fixture used elsewhere in the same test file), so this matcher can't silently regress again the way it did before.

Test plan

  • New regression test confirmed failing before the fix (AssertionError: expected [...] to include 'MultiEdit')
  • npx nx test cli — 872/872 passing after the fix
  • npx nx lint cli — 0 errors (5 pre-existing warnings, unrelated files)
  • Full monorepo npm run test (via pre-commit hook) — all 6 projects green (memory 110/110, channel-connector 69/69, memory-dashboard 22/22, task-manager 112/112, agent-manager 479/479, cli 872/872)

…Claude prompt hook

The Telegram channel never showed agent prompts (selection questions,
permission approvals) because the PreToolUse hook matcher in
settings-hook.json only covered Bash|Edit|Write|AskUserQuestion.

Any tool call not matched by this regex never fires the hook, so it's
never written to the agent-request store and never reaches the JS
dispatch/formatting code (formatPromptMessage in channel-runner.ts,
which already handles every tool name generically) — the drop happens
entirely upstream, in Claude Code's own hook config.

Two concrete gaps in that one matcher:
- ExitPlanMode was never included, even in the original design doc —
  Plan Mode's approval prompt is one of the most common
  permission-approval prompts in normal usage.
- MultiEdit|NotebookEdit were silently removed by an unexplained
  "chore" commit (61a6633), uncaught because the only existing test
  exercised a synthetic fixture instead of the real shipped asset.

Fix: broaden the matcher to
Bash|Edit|Write|MultiEdit|NotebookEdit|ExitPlanMode|AskUserQuestion.

Add a regression test that reads the real settings-hook.json asset
(not the synthetic fixture) so the matcher can't silently regress
again; confirmed it fails before this fix and passes after.

Fixes codeaholicguy#110
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.

Cannot receive agent prompts in Telegram

1 participant