Skip to content

fix(llm_agent): prevent TypeError when agent.pos is None in _build_observation()#245

Merged
wang-boyu merged 4 commits intomesa:mainfrom
abikooo:fix/none-pos-observation-crash
Apr 12, 2026
Merged

fix(llm_agent): prevent TypeError when agent.pos is None in _build_observation()#245
wang-boyu merged 4 commits intomesa:mainfrom
abikooo:fix/none-pos-observation-crash

Conversation

@abikooo
Copy link
Copy Markdown
Contributor

@abikooo abikooo commented Mar 18, 2026

Fixes #244

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56a6e53a-d699-4b04-8174-813d9084d7e3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@souro26
Copy link
Copy Markdown

souro26 commented Mar 19, 2026

please add the tests in the existing test file instead of a new one

… move test

Refactor _build_observation() to handle self.pos is None with a single
early return at the top of the vision block, instead of duplicating
the guard in each grid/space branch.

Move test_generate_obs_with_none_pos from standalone
test_agent_observation_none_pos.py into test_llm_agent.py.
Delete the standalone file per review feedback.
@abikooo abikooo force-pushed the fix/none-pos-observation-crash branch from 93b1554 to 292a85e Compare March 19, 2026 12:42
@abikooo
Copy link
Copy Markdown
Contributor Author

abikooo commented Mar 19, 2026

thanks for the review, @souro26 . both points addressed. refactored to a single early return at the top and moved tests into test_llm_agent.py. all checks passing.

@wang-boyu wang-boyu added the bug Release notes label label Apr 12, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.83%. Comparing base (09f14bb) to head (4e30f57).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
- Coverage   91.88%   91.83%   -0.06%     
==========================================
  Files          19       19              
  Lines        1627     1629       +2     
==========================================
+ Hits         1495     1496       +1     
- Misses        132      133       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wang-boyu
Copy link
Copy Markdown
Member

Thanks for the fix. main is merged into this branch to solve conflicts. Merging now.

@wang-boyu wang-boyu merged commit d37133f into mesa:main Apr 12, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: _build_observation() crashes with TypeError when agent.pos is None

3 participants