fix(honcho): graceful degradation for bad URL and add disable command#2757
Open
teyrebaz33 wants to merge 1 commit into
Open
fix(honcho): graceful degradation for bad URL and add disable command#2757teyrebaz33 wants to merge 1 commit into
teyrebaz33 wants to merge 1 commit into
Conversation
A terminal escape sequence accidentally pasted into honcho base_url (e.g. \x1b from copy-paste) caused the Honcho SDK to raise 'Invalid non-printable ASCII character' at startup. The exception was caught but the raw error string was printed back to the terminal, corrupting terminal state and making all tools appear broken. Changes: - Add _sanitize_url() in honcho_integration/client.py: returns None with a warning when base_url contains non-printable ASCII characters; applied in from_global_config(), from_env(), and get_honcho_client() escape sequences are never written raw to the terminal - Add 'hermes honcho disable' command (cmd_disable) that sets enabled: false in config and warns about leftover env vars - Add TestSanitizeUrl test class covering clean URL, config-file bad URL, and env-var bad URL scenarios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2736 (item 5)
Problem
A terminal escape sequence accidentally pasted into
honcho.base_url(e.g.\x1bfrom copy-paste) caused the Honcho SDK to raiseInvalid non-printable ASCII characterat startup. The exception was caught but the raw error string was printed to the terminal, corrupting terminal state and making all tools appear broken. Removinghoncho: {}from config did not fix it if the bad value was also in an env var.Changes
honcho_integration/client.py: Add_sanitize_url()helper that returnsNonewith a warning whenbase_urlcontains non-printable ASCII characters. Applied infrom_global_config(),from_env(), andget_honcho_client().honcho_integration/cli.py+hermes_cli/main.py: Addhermes honcho disablecommand that setsenabled: falsein config and warns the user about leftoverHONCHO_API_KEY/HONCHO_BASE_URLenvironment variables.tests/test_honcho_client_config.py: AddTestSanitizeUrlcovering clean URL, config-file bad URL, and env-var bad URL.Not implemented
The issue also mentions a full reinstall was required. This PR prevents the broken state from occurring; a recovery path beyond
hermes honcho disablewas not added as it would require broader changes.