fix: silence hook stderr when running outside tmux#64
Open
asturwebs wants to merge 1 commit intosix-ddc:mainfrom
Open
fix: silence hook stderr when running outside tmux#64asturwebs wants to merge 1 commit intosix-ddc:mainfrom
asturwebs wants to merge 1 commit intosix-ddc:mainfrom
Conversation
Contributor
Author
|
Note: the 2 failing checks are pre-existing issues on
This PR's change to |
4 tasks
When TMUX_PANE is not set (Claude Code session outside tmux), the hook logged a WARNING to stderr. Claude Code treats any stderr output as a hook error, showing a spurious error message on every session start. Replace the warning with a silent return — the hook is simply not applicable outside tmux. Co-Authored-By: BytIA <bytia@asturwebs.com>
d6ae68f to
7605a5b
Compare
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
TMUX_PANEenv var is not set, the hook now exits silently instead of logging a WARNING to stderrRoot Cause
hook.py:193calledlogger.warning("TMUX_PANE not set...")which writes to stderr vialogging.basicConfig(stream=sys.stderr). Since the hook is designed to run as aSessionStarthook, it fires on every Claude Code session — including those outside tmux where it's not applicable.Changes
src/ccbot/handlers/hook.py(line 192-194):logger.warning()callTest plan
ruff checkpassesruff format --checkpassespyright— 0 errorsecho '{"session_id":"...","hook_event_name":"SessionStart","cwd":"/tmp"}' | ccbot hookoutside tmux — no stderr output🤖 Generated with Claude Code