Skip to content

fix: print usage when ccgate claude / ccgate codex runs on a tty#85

Merged
tak848 merged 1 commit into
mainfrom
fix/codex-tty-usage
May 12, 2026
Merged

fix: print usage when ccgate claude / ccgate codex runs on a tty#85
tak848 merged 1 commit into
mainfrom
fix/codex-tty-usage

Conversation

@tak848
Copy link
Copy Markdown
Owner

@tak848 tak848 commented May 12, 2026

Why

Running ccgate codex (or ccgate claude) directly in an interactive
terminal blocked on stdin while trying to JSON-decode it as a
PermissionRequest hook payload. Any keystrokes the user typed —
Ctrl-C, Ctrl-\, escape sequences — leaked into the decoder and
produced cryptic errors like:

❯ ccgate codex
^A^C^C^[[165;5u
... ERROR failed to decode stdin error="invalid character '\x1b' looking for beginning of value"

Bare ccgate already handled this case: tty stdin → print usage,
piped stdin → run the hook. The explicit claude / codex forms
skipped that guard and went straight into the decoder.

Fixes #80

What

  • Apply the same isTerminal(stdin) check to the claude and
    codex dispatch branches.
  • Thread version through dispatch so it can call printUsage.

Running the explicit forms in a terminal blocked on stdin, so any
keystrokes (Ctrl-C, Ctrl-\, escape sequences) leaked into the JSON
decoder and produced cryptic decode errors. The bare 'ccgate'
invocation already detected a tty stdin and printed usage; extend
the same guard to the explicit 'claude' and 'codex' hook commands.

Fixes #80
@tak848 tak848 marked this pull request as ready for review May 12, 2026 12:19
@tak848 tak848 merged commit ad837fe into main May 12, 2026
4 checks passed
@tak848 tak848 deleted the fix/codex-tty-usage branch May 12, 2026 12:21
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.

ccgate codex stuck at launch

1 participant