gh-workflow-mcp: Error message and logging improvements
Error Message and Logging Improvements
Tracking 2 error handling improvements identified in PR #432 all-hands-review (iteration 4) but deemed out-of-scope for immediate implementation.
Items from Silent Failure Hunter
Issue #6: Console Logging Levels Inconsistent
Priority: MEDIUM
Files: Multiple locations in gh-workflow-mcp-server/src/utils/gh-watch.ts
Description: The logging uses a mix of console.warn, console.error, and console.debug inconsistently:
- Line 78:
console.warnfor timeout (appropriate) - Line 101:
console.errorfor execution failure (appropriate) - Some locations use
console.debugfor normal operational events that should be visible
Recommendation: Standardize logging levels:
console.error: Unrecoverable failuresconsole.warn: Recoverable issues that need attentionconsole.infoorconsole.log: Normal operational eventsconsole.debug: Detailed diagnostics
Example: Change debug level to info for fail-fast detection - it's normal operation, not a debugging situation.
---
Issue #7: Unclear Error Message for Empty Run Results
Priority: MEDIUM
Files: Multiple files in gh-workflow-mcp-server
Description: When no workflow runs are found for a PR, the error message isn't actionable:
if (!Array.isArray(checks) || checks.length === 0) {
throw new ValidationError(`No workflow runs found for PR #${input.pr_number}`);
}
This doesn't tell users:
- Why there might be no runs (PR too new, workflows not configured, filters too restrictive)
- What they can do about it
- Whether they should wait or fix configuration
Recommendation: Provide more context:
if (!Array.isArray(checks) || checks.length === 0) {
throw new ValidationError(
`No workflow runs found for PR #${input.pr_number}. This could mean:\n` +
` - The PR was just opened and workflows haven't started yet\n` +
` - No workflows are configured to run on this PR\n` +
` - Check your repository's .github/workflows/ configuration`
);
}
Apply this pattern to other "not found" error messages across the gh-workflow-mcp server.
---
Priority
Medium - These improvements would enhance user experience and debugging but don't affect core functionality.
Related Issues
- #432 - Parent PR for gh watch implementation
- #15372 - Documentation and comment quality improvements
- #15373 - Additional test coverage for edge cases
- #15374 - Type design improvements
- #539 - Runtime validation improvements
Notes
- This is a general quality improvement not specific to the watch implementation
- Can be implemented independently of #432
- Consider applying these patterns across all MCP servers for consistency
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗