[WIP] Fix bugs during test of template TOML file #98
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.
Fix bugs in multimodal frontier MaxTripLegs constraint
Analysis
The issue describes a bug where the app is killed during search without returning results, likely due to unbounded search. The original bug mentioned "invalid leg id 5 >= max leg id 5" which suggests the MaxTripLegs constraint is not properly preventing additional mode transitions.
After investigating the code, I found the root cause in
/home/runner/work/bambam/bambam/rust/bambam/src/model/frontier/multimodal/constraint.rsin theMaxTripLegsconstraint'svalid_frontiermethod (lines 72-96).Bug: When continuing with the same mode (active_mode == edge_mode), the constraint returns
n_legs = 0instead ofn_existing_legs, which incorrectly validates as always passing the check0 <= max_legs. This allows searches to continue even when they've already reached the maximum number of trip legs, as long as they keep using the same mode.Correct Behavior: The constraint should validate that the current number of legs doesn't exceed the maximum, regardless of whether we're adding a new leg or continuing with the same mode.
Plan
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.