Git provider
Other
System Info
- PR-Agent version: 0.43.0, branch
main (commit 739ea8a6)
- Python: 3.12 (CI image
python:3.12.13-slim); also reproduced on 3.13
- Deployment type: app / action / cli
- Model: any (the defect is independent of the model)
Bug details
/improve fails when the model answers in prose or omits the suggestions key
_prepare_pr_code_suggestions iterates data['code_suggestions'] without checking that the key exists or holds a list.
Steps to reproduce
Run /improve on a PR with nothing worth suggesting, where the model replies:
No suggestions found for this PR.
The same failure occurs when the model renames the key, emits it with no value, or returns something that
cannot be parsed as YAML at all.
Expected behaviour
The tool reports that there are no suggestions.
Actual behaviour
prose answer -> TypeError: string indices must be integers, not 'str'
renamed key -> KeyError: 'code_suggestions'
empty value -> TypeError: 'NoneType' object is not iterable
The per-suggestion try starts inside the loop, so it cannot protect the subscript. On the single-call path
nothing catches it and run() publishes "Failed to generate code suggestions for PR".
Root cause
Answering in prose when there is nothing to suggest is the behaviour of a helpful assistant, and it is
exactly the case the tool should report cleanly. Instead it is the case that loses the run.
Git provider
Other
System Info
main(commit739ea8a6)python:3.12.13-slim); also reproduced on 3.13Bug details
/improvefails when the model answers in prose or omits the suggestions key_prepare_pr_code_suggestionsiteratesdata['code_suggestions']without checking that the key exists or holds a list.Steps to reproduce
Run
/improveon a PR with nothing worth suggesting, where the model replies:The same failure occurs when the model renames the key, emits it with no value, or returns something that
cannot be parsed as YAML at all.
Expected behaviour
The tool reports that there are no suggestions.
Actual behaviour
The per-suggestion
trystarts inside the loop, so it cannot protect the subscript. On the single-call pathnothing catches it and
run()publishes "Failed to generate code suggestions for PR".Root cause
Answering in prose when there is nothing to suggest is the behaviour of a helpful assistant, and it is
exactly the case the tool should report cleanly. Instead it is the case that loses the run.