Repository navigation
fix(hermes): trim registered session env names so Windows bash -c never overflows - #52703
Merged
Merged
Conversation
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryThis PR reduces the environment names registered with Hermes and moves CLI routing lookup into
No actionable issues were found. Review was based on source inspection; tests were not run.
|
11 tasks done
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 #51914.
Root Cause
Hermes's
tools/environments/base_session_env.pyemits ~500 bytes of bash save/restore wrapper per variable registered withctx.register_session_env(...)on everybash -cinvocation. Registering all 14ORCA_*variables inorca-status/__init__.pyinflated the wrapper to ~7.7 KiB before the command itself, overflowing Windows Git Bash's ~8,186-byte-ccap and truncating the wrapper tail (breaking every terminal call andread_file/write_file/patch/search_files).Fix
orca-status/__init__.py:ORCA_AGENT_SESSION_TOOL_TOKENandORCA_CLI_COMMAND(~990 bytes instead of ~6,924 bytes — ~86% reduction, leaving >5.5 KiB for commands on Windows). UpdatingpluginInitTemplate()also bumpsHERMES_PLUGIN_GENERATION, so existing running Hermes gateways automatically update and reload in place on the next chat start.orcaCLI: Before tradingORCA_AGENT_SESSION_TOOL_TOKENwith the host,adoptSessionToolCallerreads the matching<home>/orca-sessions/<sessionId>.jsonfile and appliesSHARED_TOOL_PROCESS_CLI_ENV(ORCA_USER_DATA_PATH,ORCA_STRUCTURED_SESSION,ORCA_CLI_COMMAND,ORCA_ENVIRONMENT,ORCA_PAIRING_CODE,ORCA_REMOTE_PAIRING, andORCA_RUNTIME_SOURCE_*), deleting anynullentries so stale gateway routing never leaks.dropForeignTerminalHandleinsrc/cli/index.tsso foreign-handle checks run against the session's own routing env and handle rather than stale values inherited from a shared gateway.Verification
orca-status/__init__.pyinpython3and verifiedregister_session_envregisters only['ORCA_AGENT_SESSION_TOOL_TOKEN', 'ORCA_CLI_COMMAND']and_session_envfilters to those keys (and unsetsORCA_AGENT_SESSION_TOOL_TOKENwhen unpublished or closed).src/cli/runtime/session-tool-caller.test.tsandsrc/main/hermes/hermes-session-tool-env.test.ts.pnpm check:changedpassed (31/31 checks).