Skip to content

fix: wire eval_path and iterations_left into MetaAgent.forward#36

Closed
xbrxr03 wants to merge 1 commit into
facebookresearch:mainfrom
xbrxr03:fix/meta-agent-unused-params
Closed

fix: wire eval_path and iterations_left into MetaAgent.forward#36
xbrxr03 wants to merge 1 commit into
facebookresearch:mainfrom
xbrxr03:fix/meta-agent-unused-params

Conversation

@xbrxr03

@xbrxr03 xbrxr03 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

MetaAgent.forward accepts eval_path and iterations_left parameters but silently drops them — the agent never sees prior evaluation results or knows its iteration budget, making recursive self-improvement amnesic.

Fixes #30.

What changed

meta_agent.py

  • Added _read_eval_summaries(eval_path) helper that scans the eval directory for:
    • JSON result files → extracts score-like keys (pass_rate, accuracy, reward, success, score, metric, result)
    • Markdown report files → takes first 10 lines as preview
  • When eval_path has results, they are appended to the agent instruction so the meta-agent can learn from prior generations
  • When iterations_left is provided, the instruction includes the remaining budget and guidance to prioritize high-impact improvements

test_meta_agent.py (new)

  • 9 tests for _read_eval_summaries covering: None/empty paths, nonexistent directories, JSON extraction, markdown preview, irrelevant key filtering, mixed files, corrupt JSON

Testing

9 passed

All edge cases handled: missing directories, corrupt JSON, empty eval folders, mixed file types. The helper degrades gracefully — if eval_path is missing or contains no relevant data, the agent falls back to the original bare instruction.

Notes

  • No changes to run_meta_agent.py — callers already pass these args correctly, they were just being ignored
  • The _read_eval_summaries function is deliberately conservative: it only extracts fields with score-like names, not arbitrary JSON keys, to keep the prompt focused
  • CLA: happy to sign if needed

MetaAgent.forward accepts eval_path and iterations_left but silently
drops them — the agent never sees prior evaluation results or knows
its iteration budget, making recursive self-improvement amnesic.

Changes:
- Add _read_eval_summaries() helper that scans eval_path for JSON
  score files and markdown reports, extracting score-like fields
  (pass_rate, accuracy, reward, success, etc.) into a prompt-friendly
  summary
- Append eval summaries to the agent instruction when available
- Include iteration budget in the instruction when iterations_left
  is provided, guiding the agent to prioritize high-impact changes
- Add 9 unit tests for _read_eval_summaries covering edge cases
  (None paths, empty dirs, corrupt JSON, mixed file types)

Fixes facebookresearch#30
@meta-cla

meta-cla Bot commented Jun 23, 2026

Copy link
Copy Markdown

Hi @xbrxr03!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@xbrxr03

xbrxr03 commented Jun 29, 2026

Copy link
Copy Markdown
Author

Closing this PR due to lack of maintainer engagement. I'm happy to reopen if there's interest. Thanks for the great project.

@xbrxr03 xbrxr03 closed this Jun 29, 2026
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.

MetaAgent.forward accepts eval_path and iterations_left parameters that are never used in the body

2 participants