Repository navigation
Fix Greedy Best-First path reconstruction for reached and unreachable goals - #1485
Open
huxiaoyi-ovo wants to merge 3 commits into
Open
huxiaoyi-ovo wants to merge 3 commits into
huxiaoyi-ovo wants to merge 3 commits into
Conversation
huxiaoyi-ovo
marked this pull request as ready for review
October 29, 2026 09:14
This branch has not been deployed
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.
Summary
Greedy Best-First Search currently mishandles two outcomes in
planning():open_setis exhausted, the method still calls path reconstruction. It inserts the last expanded node under the goal's unset parent index (-1), returning a fabricated path that includes the unreachable goal.closed_setentry, then adds that goal node a second time to the returned coordinates.Fix
([], [])when the search frontier is empty.parentpointers.Regression tests
[(2, 2), (1, 2)]exactly, without repeating the goal.Changes are limited to the Greedy Best-First planner and its test file. No new dependencies.
See fork-only cross-platform CI validation for Linux, macOS, Windows and CodeQL checks.
AI disclosure: ChatGPT assisted with source analysis, implementation, and regression tests.