Skip to content

fix(hooks): display WARNING to client when hook fails with onFailure: warn#442

Open
ambient-code[bot] wants to merge 1 commit intomainfrom
fix/hook-warn-log-source-246
Open

fix(hooks): display WARNING to client when hook fails with onFailure: warn#442
ambient-code[bot] wants to merge 1 commit intomainfrom
fix/hook-warn-log-source-246

Conversation

@ambient-code
Copy link
Copy Markdown
Contributor

@ambient-code ambient-code bot commented Apr 8, 2026

Summary

  • When a hook fails with onFailure: warn (the default), the WARNING log from _handle_hook_failure was emitted outside the context_log_source context manager, causing it to be tagged with SYSTEM source instead of the hook source (BEFORE_LEASE_HOOK / AFTER_LEASE_HOOK)
  • Since only hook-sourced logs are shown to the client by default (without --exporter-logs), the warning was invisible
  • Moved the failure handling inside context_log_source so the WARNING log is correctly tagged and always visible to the client
  • Added a regression test that verifies the WARNING is emitted within the log source context

Fixes #246

Test plan

  • All 33 hooks tests pass (including new regression test)
  • All 140 CLI tests pass
  • Linting passes (make lint-fix)
  • E2e hooks tests H3/H4 verify warning display end-to-end

🤖 Generated with Claude Code

…ibility

When a hook fails with onFailure: warn, the WARNING log from
_handle_hook_failure was emitted outside the context_log_source context
manager, causing it to be tagged with SYSTEM source instead of the hook
source. This made the warning invisible to clients without --exporter-logs
since only hook-sourced logs are shown by default.

Move the failure handling inside context_log_source so the WARNING is
tagged with BEFORE_LEASE_HOOK / AFTER_LEASE_HOOK and always visible.

Fixes #246

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 8, 2026

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit aebd85a
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/69d6c0bcef51c90008df3f21
😎 Deploy Preview https://deploy-preview-442--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd2e2069-3ca2-4115-9033-1a9295a20195

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hook-warn-log-source-246

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

hooks enabled: no WARNING displayed at the client for failing hooks with default onfailure warn

0 participants