Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

The handler manager was logging a warning and continuing when handlers didn't return functions, causing silent failures where safe outputs were never processed.

Changes:

  • safe_output_handler_manager.cjs: Changed validation from warning to fatal error

    • Throw error immediately when main() doesn't return a function
    • Re-throw validation errors from catch block to fail the step
    • Other errors (module not found) continue to log warnings
  • safe_output_handler_manager.test.cjs: Added test documentation for validation behavior

Before:

if (typeof messageHandler !== "function") {
  core.warning(`Handler ${type} main() did not return a function`);
  continue; // Silent failure
}

After:

if (typeof messageHandler !== "function") {
  const error = new Error(`Handler ${type} main() did not return a function - expected a message handler function but got ${typeof messageHandler}`);
  core.error(`✗ Fatal error loading handler ${type}: ${error.message}`);
  throw error;
}

Handler main() must follow factory pattern and return a message handler function. Handlers returning undefined will now fail loudly instead of silently skipping processing.

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/20625686133/job/59235880658#step:6:1

If a handler does not return a function, it should fail the step


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Change warning to fatal error in safe_output_handler_manager.cjs
- Handler validation now throws error instead of continuing
- Re-throw validation errors to fail the step immediately
- Add test documentation for the expected behavior
- All tests pass (JavaScript and Go)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fail step if handler does not return a function Fail step when safe output handler doesn't return function Dec 31, 2025
Copilot AI requested a review from pelikhan December 31, 2025 20:24
@pelikhan pelikhan marked this pull request as ready for review December 31, 2025 20:25
@pelikhan pelikhan merged commit 1610c8a into main Dec 31, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fail-step-if-no-return branch December 31, 2025 20:26
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