The default focus_only_on_problems instruction forbids the import a suggestion itself introduces
Split out of #3014. #3061 fixed the stray-brace half of that report (tracked separately as #3058); this is the other half. #3042 raised it and #3046 deliberately left it out, so it is untracked.
With the shipped default (configuration.toml:191, focus_only_on_problems=true) the /improve prompt renders the else branch at pr_code_suggestions_prompts.toml:24-32, whose line 28 says DO NOT suggest ... add missing import statement. That rule is meant to stop a standalone add-an-import suggestion, but it also applies when a suggestion itself introduces a new dependency, which is the case reported on #3014: the suggested code is not importable as committed.
The question is whether the rule should exempt imports required by the suggestion's own improved_code, or whether the syntax check from #3046 should extend to unresolved names. No proposal yet; this is the tracking issue.
Source: The-PR-Agent/pr-agent