Skip to content

Conversation

@sisyphus-dev-ai
Copy link
Collaborator

@sisyphus-dev-ai sisyphus-dev-ai commented Jan 24, 2026

Summary

  • Adds defensive null checks for output parameter in tool.execute.after hooks
  • Fixes crash when /review command (and other Claude Code built-in commands) trigger hooks with undefined output

Problem

Claude Code's /review command triggers tool.execute.after hooks but passes output as undefined instead of the expected object with output, metadata, and title properties. This causes crashes when hooks try to access output.metadata.

Solution

Added early return guards in three locations (defense-in-depth):

  1. Main orchestrator (src/index.ts): Guards all downstream hooks
  2. Claude Code hooks (src/hooks/claude-code-hooks/index.ts): Additional safety layer
  3. Atlas hook (src/hooks/atlas/index.ts): Additional safety layer

Changes

  • src/index.ts: Add if (!output) return guard at start of tool.execute.after handler
  • src/hooks/claude-code-hooks/index.ts: Add if (!output) return guard
  • src/hooks/atlas/index.ts: Add if (!output) return guard
  • src/hooks/atlas/index.test.ts: Add test for undefined output handling

Testing

  • Added test case for undefined output in atlas hook tests
  • All existing tests pass
  • TypeScript typecheck passes

Fixes #1035


Summary by cubic

Add null guards in tool.execute.after to handle undefined output from /review and other Claude Code commands, preventing crashes. Fixes #1035.

  • Bug Fixes
    • Guard against undefined output in the orchestrator and Claude Code/Atlas hooks.
    • Prevent metadata/output access when output is missing.
    • Add a unit test for undefined output handling in the Atlas hook.

Written for commit e9412bd. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

/review command and some Claude Code built-in commands trigger
tool.execute.after hooks with undefined output, causing crashes
when accessing output.metadata or output.output.

Fixes #1035
@justsisyphus justsisyphus force-pushed the fix/issue-1035-undefined-output-crash branch from d75eb22 to e9412bd Compare January 24, 2026 07:45
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.

[Bug]: tool.execute.after hook crashes on /review command (output is undefined)

2 participants