Skip to content

fix: improve repair instruction#1309

Merged
akihikokuroda merged 2 commits into
generative-computing:mainfrom
akihikokuroda:clearrepair
Jun 22, 2026
Merged

fix: improve repair instruction#1309
akihikokuroda merged 2 commits into
generative-computing:mainfrom
akihikokuroda:clearrepair

Conversation

@akihikokuroda

Copy link
Copy Markdown
Member

Pull Request

Issue

Fixes #1308

Description

Improve the repair hint string to make LLM generate the code meet requirement validation.
It instructs to generate code like following

# Save the graph to file
plt.savefig('/var/folders/kl/cljphvzd64qgtl2sqnh30fs00000gn/T/graph_5.png')

instead of

# Save the graph to file
output_path = '/var/folders/kl/cljphvzd64qgtl2sqnh30fs00000gn/T/graph_5.png'
plt.savefig(output_path)

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
@akihikokuroda akihikokuroda requested a review from a team as a code owner June 19, 2026 23:37
@akihikokuroda akihikokuroda changed the title improve repair instruction bug: improve repair instruction Jun 19, 2026
@akihikokuroda akihikokuroda changed the title bug: improve repair instruction fix: improve repair instruction Jun 19, 2026
@github-actions github-actions Bot added the bug Something isn't working label Jun 19, 2026

@AngeloDanducci AngeloDanducci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small optional nit, LGTM.

f"Your code didn't save the plot to the expected file. "
f"Try: Add plt.savefig('{expected_path}') before plt.show() or plt.close()."
f"Try: Add plt.savefig('{expected_path}') before plt.show() or plt.close(). "
f"Do not use a variable as an argument of plt.savefig. Use a string literal as the argument like plt.savefig('{expected_path}'). "

@AngeloDanducci AngeloDanducci Jun 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be worth updating these two tests,
test_matplotlib_plot_file_saved_error_formatting
test_matplotlib_plot_file_saved_error_with_custom_path
to include: assert "string literal" in formatted or assert "Do not use a variable as an argument" in formatted.

Adding the assert would act as a safeguard if this gets changed in the future and cause a test failure/update required in case it is overlooked in a future update.

Otherwise LGTM!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll fix the tests..

Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
@akihikokuroda akihikokuroda added this pull request to the merge queue Jun 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 22, 2026
@akihikokuroda akihikokuroda added this pull request to the merge queue Jun 22, 2026
Merged via the queue into generative-computing:main with commit e718b60 Jun 22, 2026
14 of 17 checks passed
@akihikokuroda akihikokuroda deleted the clearrepair branch June 22, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: improve repair information for PlotFileSaved requirement

2 participants