Repository navigation
fix: /ask on outdated review comments crashes with TypeError - #2784
Conversation
Fall back to original_start_line/original_line when GitHub nulls start_line/line on outdated comments. Defensively convert line params to int in extract_hunk_lines_from_patch. Fixes The-PR-Agent#2783
PR Summary by QodoFix /ask crash on outdated GitHub review comments
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1. OverflowError still unhandled
|
|
The string literal is already double-quoted — the single quotes inside are part of the expected output ( |
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Thanks for the report and for fixing it yourself the same day; the captured payload made this quick to confirm. Verified against three comment shapes, and there is one thing inline I would rather not lose before this merges.
Address review feedback: log a warning when line_start/line_end are coerced from invalid values to -1, so the fallback isn't silent.
|
Code review by qodo was updated up to the latest commit cae68c5 |
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Thanks for adding the warnings, that is what I meant: the coercion is greppable now. Approving.
One optional extra. Qodo is right that OverflowError escapes the tuple, and it is reachable: the question text is appended last to the /ask_line command, so /ask ... --line_start=.inf overrides the payload value, and _fix_key_value yaml-parses .inf into a float. Nothing crashes, because the function's own except Exception catches it and returns ("", ""), but that is an error log and no answer rather than the warning and -1 you have just added. Adding OverflowError to both tuples makes it consistent, and token_handler.py:131 and utils.py:1173 already spell it that way.
Description
Fixes #2783
github_app.py—handle_line_comments()now falls back tooriginal_start_line/original_linewhenstart_line/lineare null.git_patch_processing.py—extract_hunk_lines_from_patch()now convertsline_start/line_endto int at entry, falling back to -1 for invalid values.Type of change
Verification
New tests:
test_non_numeric_line_params_do_not_crash(parametrized:"",None,"None")test_string_line_params_are_coerced_to_inttest_outdated_comment_falls_back_to_original_linetest_outdated_comment_single_line_falls_back_to_originalManually verified:
/askon an outdated review comment now responds instead of crashing silently.