Repository navigation
fix(optimizer): retain the agent result after prompt updates - #100
Open
liuzhengyang699 wants to merge 1 commit into
Open
liuzhengyang699 wants to merge 1 commit into
liuzhengyang699 wants to merge 1 commit into
Conversation
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.
After Phase 1 updates a prompt and reruns the agent, the GRPO and REINFORCE++ optimizers update
current_solutionusing temporarycurrent_result/current_reasoningvariables. They leavecurrent_agent_resultandcurrent_agent_reasoningunchanged. As a result, evaluation can approve the new answer whileoptimize()returns the initial one, and the next iteration scores the stale answer. This happens when solution refinement is disabled or produces no replacement.Update the shared answer and reasoning variables from the rerun before rebuilding
current_solution, matching the existing solution-refinement path.Validation:
python -m pytest tests/test_optimizer_rerun_state.py -qpassed 8 regression cases, all failing before the fix. They run both real optimizer loops for one and two iterations, with solution refinement disabled or returning no replacement, and check the returned answer, reward inputs, prompt updates, and evaluation inputs. External service registries, agent/model responses, and tokenization are stubbed; no live providers or browser/trading backends are started. Ruff and formatting on the new test, Python compilation, andgit diff --checkpassed.No related issue or API change.