fix(parsers): bound the JS and Go parse subprocesses with a timeout - #135
Merged
Conversation
_parse_javascript and _parse_go called subprocess.run with no timeout, while _parse_c / _parse_ruby / _parse_php / _parse_zig all pass timeout=1800. A hung inner Node/Go parser therefore blocked the Python parent indefinitely for any direct caller of parse_repository (library API, tests, tooling); the four already-timed parsers fail cleanly instead. - Add timeout=1800 (30 min) to the subprocess.run in _parse_javascript and _parse_go, matching the placement and value of the other four parsers. Parity/robustness change only. Verified against origin/master (98f5504): analyzer output is byte-identical with vs without the timeout on a real repo (a non-firing timeout is a no-op), and a runaway subprocess is killed cleanly with TimeoutExpired rather than hanging. Note: PR #98 bounds the OUTER Go-CLI -> python subprocess; this bounds the INNER python -> node/go parse subprocess one level deeper -- complementary, not redundant (direct-Python callers get no protection from #98). Regression test (fails on master, passes here): $ python -m pytest tests/test_parser_adapter_timeout.py -q 3 passed Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gadievron
requested review from
dgeyshis,
shahar-davidson and
sounil
as code owners
July 9, 2026 11:17
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
Add a 30-minute timeout to the JavaScript and Go parse subprocesses in
core/parser_adapter.py, matching the four other parsers.Root cause
_parse_javascriptand_parse_gocallsubprocess.run(...)with notimeout=, while_parse_c/_parse_ruby/_parse_php/_parse_zigall passtimeout=1800. When the inner Node/Go parser hangs, the Python parent blocks with no bound for any direct caller ofparse_repository(library API, tests, tooling). The four already-timed parsers fail cleanly instead.How
core/parser_adapter.py: addtimeout=1800to thesubprocess.runin_parse_javascriptand_parse_go, at the same placement and value as the four already-timed parsers.Regression test
tests/test_parser_adapter_timeout.pymonkeypatchessubprocess.runto capture thetimeoutkwarg the parse step passes (asserting JS and Go each pass1800), plus a parity assertion that every language whose parse runs as a subprocess carries a timeout.RED on
origin/master(98f5504):GREEN on this branch:
Full parser test suite unchanged vs base (delta is exactly these 3 new tests).
Compatibility / scope
TimeoutExpiredrather than hanging — the same policy the four other parsers already apply.npm installin_ensure_js_parser_dependencies(parser_adapter.py:499) is a separate unbounded subprocess (dependency bootstrap, not a parse step); a tracked follow-up, out of scope here.Author notes
timeout=1800lines in_parse_javascriptand_parse_go.TimeoutExpired.🤖 Generated with Claude Code