Support anchor in agentic env gen#784
Conversation
Greptile SummaryThis PR extends the agentic environment generation pipeline to produce
Confidence Score: 4/5Safe to merge with minor polish; the conversion logic is straightforward and the prompt change is additive. Both changes are small and targeted. The conversion utility correctly gates the default-pose assignment on get_initial_pose() is None, so existing assets with an explicit pose are unaffected. The magic string is_anchor is a minor maintenance risk but poses no immediate runtime breakage. The system prompt instruction is clear enough for most cases but omits which node id the model should use as the is_anchor subject, which could lead to the model choosing the wrong asset in more complex scenes. arena_env_graph_conversion_utils.py — the hardcoded is_anchor string and the post-add_relation default-pose block deserve a second look. Important Files Changed
Reviews (1): Last reviewed commit: "Reformat system prompt for better readib..." | Re-trigger Greptile |
| # An is_anchor asset must have a fixed initial pose for the placement solver. | ||
| # If the asset class does not declare one, default to the world origin so | ||
| # LLM-generated specs (which never set an explicit pose) work out of the box. | ||
| if spatial_constraint.kind == "is_anchor" and subject_asset.get_initial_pose() is None: |
There was a problem hiding this comment.
The relation kind is compared to the hard-coded string
"is_anchor" rather than to a registry key or a constant. If the registered name for the anchor relation ever changes (e.g. to "IS_ANCHOR" or "anchor"), this check silently stops firing and LLM-generated specs will no longer receive the default pose. Defining a named constant or deriving the value from the registry would make the coupling explicit.
| if spatial_constraint.kind == "is_anchor" and subject_asset.get_initial_pose() is None: | |
| _IS_ANCHOR_KIND = "is_anchor" | |
| if spatial_constraint.kind == _IS_ANCHOR_KIND and subject_asset.get_initial_pose() is None: |
| Do NOT hallucinate values — the resolver tolerates nulls; it cannot fix invented data. | ||
| - For binary relations (e.g. on), subject is the placed object and reference is \ | ||
| the surface it is relative to (typically the background name). | ||
| - REQUIRED: include an is_anchor (unary) relation for the surface other objects rest on. |
There was a problem hiding this comment.
The new bullet says
is_anchor is "REQUIRED" for "the surface other objects rest on", but the prompt does not explain what to use as the subject of the unary relation (the background node id, an object-reference id, or something else). Without that detail the LLM may apply is_anchor to an incorrect node, causing the relation solver to fail or silently misplace objects. Adding a concrete example (e.g. subject = background node id) in the same bullet would remove the ambiguity.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
EnvGenAgent adds the is_anchor relation.
Detailed description
is_anchor is currently missing from agent generated spec.
-- agent prompt is updated to include request for is_anchor in system prompt.
-- reformat system prompt for better readibility.
-- pose is required for anchor object. set pose during conversion to arena env if missing.
-- Agent generated env spec should now work with relation solver.