Skip to content

fix: prevent hypothesis refiner CLI crash on agent failures#77

Closed
DavidJBianco wants to merge 1 commit into
mainfrom
codex/fix-unhandled-exception-in-hypothesis-refiner-cli
Closed

fix: prevent hypothesis refiner CLI crash on agent failures#77
DavidJBianco wants to merge 1 commit into
mainfrom
codex/fix-unhandled-exception-in-hypothesis-refiner-cli

Conversation

@DavidJBianco

Copy link
Copy Markdown
Collaborator

Motivation

  • A recent refactor changed the hypothesis refiner error path to raise exceptions instead of returning error results, which can cause the CLI loop to fail with an unhandled exception and terminate the process.
  • The goal is to handle runtime errors at the CLI boundary so the tool exits cleanly and prints a concise error message instead of crashing with a traceback.

Description

  • Wrapped the asyncio.run(refiner(...)) invocation in hypothesis_refiner_cli.main() with a try/except to catch exceptions raised by the refiner.
  • On failure, the CLI now prints a short error to stderr and exits with sys.exit(1) instead of propagating an unhandled exception.
  • Preserved the existing successful-codepath so normal refinement and user feedback behavior are unchanged.
  • Changes are contained to peak_assistant/hypothesis_assistant/hypothesis_refiner_cli.py and are minimal to restore CLI robustness.

Testing

  • Ran python -m py_compile peak_assistant/hypothesis_assistant/hypothesis_refiner_cli.py and the file compiled successfully.

Codex Task

@DavidJBianco

Copy link
Copy Markdown
Collaborator Author

Superseded by #88 with a root-cause fix: removed the inner try/except in refiner() that was double-wrapping exceptions and printing to stdout, then added a clean CLI boundary handler in main() that prints to stderr and respects --verbose. Merged into dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant