fix(perception): use pos_x/pos_y/pos_z metadata keys in spatial location queries#3123
Open
hvent90 wants to merge 2 commits into
Open
fix(perception): use pos_x/pos_y/pos_z metadata keys in spatial location queries#3123hvent90 wants to merge 2 commits into
hvent90 wants to merge 2 commits into
Conversation
…ion queries SpatialVectorDB.query_by_location and get_all_locations filtered stored frames on metadata keys "x"/"y"/"z", but frames are written with pos_x/pos_y/pos_z (SpatialMemory._process_frame), so both methods always returned empty results. Read the production keys instead, with a regression test that stores frames using the production metadata shape.
hvent90
requested review from
leshy,
mustafab0,
paul-nechifor and
spomichter
as code owners
July 21, 2026 21:26
Contributor
Greptile SummaryThis PR fixes spatial location queries to use the metadata keys written for stored frames. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "test(perception): cover frames stored wi..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #3123 +/- ##
==========================================
- Coverage 72.99% 72.77% -0.23%
==========================================
Files 1031 1034 +3
Lines 93177 93964 +787
Branches 8479 8609 +130
==========================================
+ Hits 68018 68384 +366
- Misses 22835 23251 +416
- Partials 2324 2329 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 42 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Location queries must skip entries whose metadata has no pos_x/pos_y rather than crash; covers the skip branch codecov flagged as partial.
Contributor
|
Hi @hvent90 . Thank you for the contribution. However, it looks like |
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.
Contribution path
Problem
SpatialVectorDB.query_by_location()andget_all_locations()filter stored frames by metadata keys"x"/"y"/"z", but frames are stored with keyspos_x/pos_y/pos_z(see the metadata dict built inSpatialMemory._process_frame). The keys never match, so both methods always return empty results against real spatial-memory data.Solution
Read
pos_x/pos_y/pos_zin both methods.Added
dimos/perception/test_spatial_vector_db.py: stores frames in an in-memorySpatialVectorDBusing the exact metadata shape_process_framewrites, and asserts location queries find them. The test fails against the oldcode and runs in the default (fast) CI suite.
How to Test
uv run pytest dimos/perception/test_spatial_vector_db.pyAlso verified against real recorded data:
First I populated the chromadb:
dimos --replay --replay-db go2_china_office run unitree-go2-spatial --disable perceive-loop-skill(--disablebecause the blueprint's PerceiveLoopSkill requires an agent module it doesn't include — separate issue). Let it logStored frame at position (…)for ~60s, then stop it.Then, I ran this script:
Running it on
mainproduced empty query results. Running it on this feature branch produced results.AI assistance
My associate (Fable 5) discovered the issue, proposed a fix, and implemented it. I then reviewed the output and manually ran the verification against the chromadb as outlined in the
How to Testsection.