Skip to content

mcp: check floor procedural-item footprints in collision checks - #1303

Open
kruschdev wants to merge 7 commits into
pascalorg:mainfrom
kruschdev:fix/procedural-item-collisions
Open

kruschdev wants to merge 7 commits into
pascalorg:mainfrom
kruschdev:fix/procedural-item-collisions

Conversation

@kruschdev

@kruschdev kruschdev commented Nov 22, 2026 •

Copy link
Copy Markdown

What does this PR do?

Fixes #1255

check_collisions and layout-clearance (collectOccupiedFootprints and findItemItemCollisions, used by verify_scene, furnish_room, and place_in_room) previously filtered strictly on node.type === 'item'. As a result, overlapping floor-standing procedural-item nodes returned status: "checked" with empty checkedItems, skippedItems, and collisions, while verify_scene reported hasIssues: false.

I updated @pascal-app/core and @pascal-app/mcp so floor-standing procedural-item nodes participate in plan footprint and vertical-interval collision checks under the same contract as item nodes:

  • Plan footprint and inspection (door-clearance.ts, item-space.ts): Added proceduralNodePlanCorners, proceduralNodePlanAabb, inspectProceduralItemPlanFootprint, and proceduralItemLevelPose using @pascal-app/core/procedural-items directly so standalone MCP bridges without @pascal-app/nodes loaded still evaluate recipe bounds accurately, including off-center recipe datums under yaw, named surface attachment host chains, and consistent unsupported_attachment skipping for wall-side and ceiling mounting designs parented to a level.
  • Layout clearance, stacking, and pair roles (layout-clearance.ts, furniture-kind.ts): Included procedural-item in collectOccupiedFootprints and findItemItemCollisions, extended designedTogether to ProceduralItemNode so procedural dining/bedside pairs within the 0.08 m clearance band are not false-positived as item_too_close, added proceduralHeightsInLevel and shared floor-lift election (electFloorPlacedLift) so items hosted on or resting atop procedural surfaces still honor STACK_TOLERANCE, filtered flat procedural rug underlays, and guarded ItemNode-only helpers (isWallDressing, itemSolidsInLevel, boxSolid).
  • MCP check_collisions (check-collisions.ts): Scoped, inspected, and gated procedural-item alongside item with catalog: "procedural" source metadata, recording unsupported_attachment, parent_local_coordinates, and non_planar_rotation in skippedItems (insufficient_evidence or partial) and excluding skipped procedural nodes from findItemItemCollisions.

How to test

  1. Run bunx biome check on the modified files in packages/core and packages/mcp (0 errors, 0 warnings).
  2. Run bunx turbo run build check-types test --filter=@pascal-app/core --filter=@pascal-app/mcp and verify the new #1255 regression cases pass in packages/core/src/agent-operations/layout-clearance.test.ts and packages/mcp/src/tools/check-collisions.test.ts.
  3. In a sandbox scene on level_0, place two floor-standing 2 m x 2 m x 0.9 m procedural-item nodes at [0, 0, 0] and call check_collisions({ levelId, minimumClearance: 0, floorOnly: true }) and verify_scene({}): check_collisions now reports checkedItems length 2 (catalog: "procedural") and 1 overlap collision, and verify_scene reports hasIssues: true with item_overlap.

Screenshots / screen recording

N/A (MCP and core layout-clearance logic; verified locally in both bun dev and production build).

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Note

Medium Risk
Touches shared layout/collision logic used by verify_scene, furnishing, and MCP tools; behavior changes are broad but guarded with conservative skips and extensive regression tests.

Overview
Floor-standing procedural-item nodes now participate in the same plan-footprint and vertical collision path as catalog item nodes, fixing silent “all clear” results when procedural furniture overlapped.

Core layout clearance gains recipe-driven plan AABBs (proceduralNodePlanCorners / inspectProceduralItemPlanFootprint), level-frame poses through procedural host chains and named attachment surfaces, and proceduralHeightsInLevel (including ceiling-mounted items with motion reach from evaluateRecipe). collectOccupiedFootprints and findItemItemCollisions honor procedural rugs, designedTogether dining pairs, and stacked children on procedural surfaces; ceiling/wall-hosted procedural nodes are skipped with explicit reasons.

The MCP check_collisions tool inspects procedural items alongside items, emits catalog: "procedural" metadata, and surfaces skip reasons (unsupported_attachment, non_planar_rotation, etc.). Regression coverage is added under #1255 in core and MCP tests.

Reviewed by Cursor Bugbot for commit bd0c21d. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@Aymericr Aymericr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kruschdev, this closes a real false-negative (#1255): floor-standing procedural-items now go through the same footprint and vertical-interval checks as items, and the bridge path no longer needs @pascal-app/nodes loaded. I ran the new suites locally on this branch: layout-clearance.test.ts 51/51 and check-collisions.test.ts 16/16.

A few small things before merge:

  1. Optional chaining on recipe (check-collisions.ts): the name uses node.recipe?.name, but source.assetId uses node.recipe.name. If recipe is always present by schema, drop the ?.. If it isn't, guard both.
  2. Skip reason for wall-hosted procedural items: a procedural item with wallId is skipped as parent_local_coordinates when floorOnly is false. It isn't in parent-local coordinates, it's wall-attached, so unsupported_attachment seems more accurate in both modes. An agent reading the result will act on that reason.
  3. Scope: furniture-kind.ts (+81) isn't mentioned in the description. If it's needed for procedural footprints, a sentence on why would help. Otherwise it could be a separate PR.

CI for this fork is waiting on maintainer approval to run.

@kruschdev

Copy link
Copy Markdown
Author

Thanks @Aymericr! I addressed all three points in e40f704:

  1. Consistent recipe access (check-collisions.ts): Dropped the redundant ?. on node.recipe.name since ProceduralItemNode always validates a required recipe, matching node.recipe.name in source.assetId and node.asset.name for catalog items.
  2. Wall-hosted procedural skip reason: Split out the node.type === 'procedural-item' && node.wallId check ahead of the generic non-level parent check so wall-hosted procedural items report unsupported_attachment in both floorOnly: true and floorOnly: false modes, and added a regression assertion for both modes in check-collisions.test.ts.
  3. Why furniture-kind.ts is included: Once floor-standing procedural-item nodes enter collectOccupiedFootprints and findItemItemCollisions, layoutIssuesFromScene needs isFloorUnderlay and designedTogether / pairRole to recognize ProceduralItemNode as well; otherwise procedural rugs and intentionally paired procedural furniture (like dining chairs near tables) trigger false-positive item_overlap or item_too_close findings in verify_scene. (I noted this in the second bullet of the PR description as well.)

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7989f5f. Configure here.

This branch has not been deployed

No deployments
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.

[Bug] check_collisions and verify_scene silently ignore overlapping procedural-item nodes

2 participants