Skip to content

fix(optimizer): retain the agent result after prompt updates - #100

Open
liuzhengyang699 wants to merge 1 commit into
SkyworkAI:mainfrom
liuzhengyang699:fix/optimizer-rerun-state
Open

liuzhengyang699 wants to merge 1 commit into
SkyworkAI:mainfrom
liuzhengyang699:fix/optimizer-rerun-state

Conversation

@liuzhengyang699

Copy link
Copy Markdown

After Phase 1 updates a prompt and reruns the agent, the GRPO and REINFORCE++ optimizers update current_solution using temporary current_result / current_reasoning variables. They leave current_agent_result and current_agent_reasoning unchanged. As a result, evaluation can approve the new answer while optimize() 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 -q passed 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, and git diff --check passed.

No related issue or API change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant