fix(agent): preload jiter native parser - #33665
Closed
helix4u wants to merge 1 commit into
Closed
Conversation
helix4u
marked this pull request as ready for review
May 28, 2026 04:51
Contributor
|
Merged via PR #33692. Your commit was cherry-picked onto current main with your authorship preserved in git log (commit 459d769). Thanks for triaging the issue with Lucien on Discord and turning the workaround into a real fix — both the root-cause analysis (native Note on CI: 22/23 checks were green; |
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.
What does this PR do?
Preloads the OpenAI SDK's native
jiterstreaming parser during agent package import.A Windows support report showed
jiter.jitercould be imported directly from the Hermes venv, and Hermes launched from that same venv, but the first DeepSeek/OpenAI-compatible streaming request still failed withModuleNotFoundError: No module named 'jiter.jiter'. Launching Hermes withjiter.jiterpreloaded made the same session work, which points to an import-order/module-state problem in the threaded streaming path rather than a missing dependency.The preload is best-effort. If
jiteris truly missing or damaged, startup continues and the normal SDK request path still surfaces the underlying dependency error.Related Issue
Support thread: API Call Failed - jiter.jiter
Type of Change
Changes Made
agent/jiter_preload.py: add an idempotent best-effort preload forjiter.jiterandjiter.from_json.agent/__init__.py: import the preload helper during agent package initialization so CLI, gateway, and other agent entry points get the same behavior.tests/agent/test_jiter_preload.py: cover successful preload and missing-extension fallback behavior.How to Test
jiter.jiterimport succeeds from the Hermes venv, but a normal DeepSeek streaming request fails withNo module named 'jiter.jiter'.No module named 'jiter.jiter'.Local verification run:
./scripts/run_tests.sh -j 4 tests/agent/test_jiter_preload.pyResult: 2 passed.
Additional local sanity check:
./.venv/bin/python - <<'PY'import agentfrom agent import jiter_preloadprint(jiter_preload._JITER_PRELOADED)print(type(jiter_preload._JITER_PRELOAD_ERROR).__name__ if jiter_preload._JITER_PRELOAD_ERROR else 'None')import jiter.jiterprint('jiter ok')PYResult:
True,None,jiter ok.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Support report evidence:
jiter okandjiter.cp311-win_amd64.pydwas present under the Hermes venv..\venv\Scripts\hermes.exestill failed before delivery withNo module named 'jiter.jiter'.import jiter.jiter, runpy; runpy.run_module('hermes_cli.main', run_name='__main__')worked.