Skip to content

Fix multi-agent inference without next observations - #1320

Open
Yushu-Li wants to merge 1 commit into
thu-ml:masterfrom
Yushu-Li:fix/multiagent-inference-optional-next-obs
Open

Yushu-Li wants to merge 1 commit into
thu-ml:masterfrom
Yushu-Li:fix/multiagent-inference-optional-next-obs

Conversation

@Yushu-Li

@Yushu-Li Yushu-Li commented Nov 1, 2026

Copy link
Copy Markdown

MultiAgentPolicy.forward accepts a current-observation batch, but its unmasked-observation path unconditionally accesses tmp_batch.obs_next. Ordinary inference batches have no next observation yet, so dispatch fails with AttributeError: 'dict' object has no attribute 'obs_next' before the agent policy runs.

I guarded the optional next-observation access. Existing next observations are still unwrapped, and the masked-observation path is unchanged.

Refs #1244: this covers the missing-obs_next inference failure described in that discussion. It does not claim to resolve every multi-agent/on-policy preprocessing problem in that issue.

Validation on CPU:

  • Four regression cases use the existing real continuous/discrete PPO fixture, with and without next observations. Outputs match direct deterministic policy inference, and the input batch is preserved.
  • On the original source, both missing-next-observation cases fail; both supplied-next-observation controls pass.
  • Policy, Batch, Collector and return tests: 90 passed, 1 skipped.
  • Full Ruff lint and formatting checks passed.
  • Changed-file Mypy reports 8 existing diagnostics, also present on unchanged f240205 with the same uncached --follow-imports=silent command; there are no added diagnostic headers. This is not a clean type-check pass.
  • No full training, learning-curve benchmark or full project test run was performed.

I used Codex assistance for implementation and local regression checks.

  • Change described and relevant issue linked
  • Changelog updated
  • Regression tests added
  • Ruff formatting and lint checked
  • Related local tests run
  • Clean type check (baseline diagnostics documented above)
  • Full project tests and documentation build

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T07:19:29.905370Z 142fb66 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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