Skip to content

fix(local-agent): handle empty-string hook_event_name from STDIN#178

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:worktree-fix-empty-hook-event-name
Jul 10, 2026
Merged

fix(local-agent): handle empty-string hook_event_name from STDIN#178
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:worktree-fix-empty-hook-event-name

Conversation

@m0Nst3r873

@m0Nst3r873 m0Nst3r873 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace ??= with falsy check for hookData.hook_event_name, so empty strings from STDIN are correctly overwritten with the CLI-derived event name
  • Fixes org-binding prompts and all event-gated logic not triggering on WorkBuddy and CodeBuddy

Root Cause

WorkBuddy/CodeBuddy pass hook_event_name: "" in the hook STDIN JSON payload. The ??= operator only overwrites null/undefined, not empty string "". So the empty value was kept, parseHookEvent returned null (mapEventType("")null), and context.event stayed undefined — causing ensureWorkspaceBinding (session_start) and emitBindingHint (prompt_submit) to be skipped.

Fix

- hookData.hook_event_name ??= hookEventName(eventName);
+ if (!hookData.hook_event_name) hookData.hook_event_name = hookEventName(eventName);

1 line change. Empty string is now treated the same as missing — the event name derived from the CLI argument (session-startSessionStart, etc.) takes over.

Test plan

  • On WorkBuddy: open a new project, verify org-binding prompt appears
  • On CodeBuddy: same verification
  • debug.log should show [xxxxxx] [workbuddy] tags (local-agent path) instead of [status-report] tags
  • npx tsc --noEmit passes

🤖 Generated with Claude Code

…STDIN

WorkBuddy/CodeBuddy pass hook_event_name: "" in hook STDIN JSON. The
hookDispatchCli already knows the correct event from the CLI argument,
so normalize empty/missing hook_event_name before dispatching. Without
this, parseHookEvent returns null and binding prompts (ensureWorkspace
Binding, emitBindingHint) never trigger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@m0Nst3r873 m0Nst3r873 force-pushed the worktree-fix-empty-hook-event-name branch from 5dbc3c3 to 55c3874 Compare July 10, 2026 09:12
@jeff-r2026 jeff-r2026 merged commit 0ba83f2 into Tencent:main Jul 10, 2026
7 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.

2 participants