fix(hooks): enforce socket-based Kitty remote control in v3.0 tab-setter#675
Merged
kaimagnus merged 1 commit intodanielmiessler:mainfrom Feb 17, 2026
Merged
Conversation
Resolves the escape sequence leak issue from danielmiessler#493 for the v3.0 hook architecture. When kitty @ commands run without --to flag in subprocess contexts, Kitty responds via escape sequences that leak into terminal output as visible garbage (e.g. "P@kitty-cmd{...}"). Changes to lib/tab-setter.ts (centralized in v3.0): - Add default socket fallback (/tmp/kitty-$USER) to getKittyEnv() - Require socket for all kitten @ commands (skip gracefully if unavailable) - Fix cleanupStaleStateFiles() to also use socket-based IPC - Remove conditional --to flag (now always required when executing) User configuration required in kitty.conf: allow_remote_control socket-only listen_on unix:/tmp/kitty-{user} Closes danielmiessler#493 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Resolves the escape sequence leak issue originally reported in #493, rebased against the v3.0 hook architecture.
Problem: When
kitty @/kitten @commands run without the--to <socket>flag in subprocess contexts (hooks), Kitty responds via escape sequences that leak into terminal output as visible garbage text likeP@kitty-cmd{"ok": false, "error": "Remote control is disabled"}.Root cause: In v3.0's
lib/tab-setter.ts,getKittyEnv()resolves the socket from env vars and per-session files, but when neither is available, kitten commands fall through to escape-sequence-based IPC — the exact bug #493 fixed for v2.x.Fix (single file —
Releases/v3.0/.claude/hooks/lib/tab-setter.ts):/tmp/kitty-$USER) togetKittyEnv()for socket-only configskitten @commands — skip gracefully if unavailable instead of falling back to escape-sequence IPCcleanupStaleStateFiles()to also use socket-based IPC--toflag pattern (now always required when executing)User Configuration Required
Context
This is a rebase of #493 against the v3.0 architecture. The original PR targeted the v2.x
Packs/pai-hook-system/src/hooks/paths which no longer exist. In v3.0, all kitty interaction is centralized inlib/tab-setter.ts, making this a cleaner single-file fix.Closes #493
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com