Skip to content

Conversation

Copy link

Copilot AI commented Feb 3, 2026

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.rs in the MaxTripLegs constraint's valid_frontier method (lines 72-96).

Bug: When continuing with the same mode (active_mode == edge_mode), the constraint returns n_legs = 0 instead of n_existing_legs, which incorrectly validates as always passing the check 0 <= 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

  • Analyze the codebase to understand the bug
  • Fix the MaxTripLegs constraint logic to properly check existing legs when continuing with same mode
  • Run existing tests to verify the fix doesn't break anything
  • Add or verify tests that cover the edge case of continuing with same mode at max legs
  • Request code review
  • Run security checks
Original prompt

This section details on the original issue you should resolve

<issue_title>bugs during test of template TOML file</issue_title>
<issue_description>this issue tracks debugging related to #96. the original error is recorded below and was solved by updating the constraints of the multimodal frontier model.

current bug

while running bambam from the working template TOML file the app is killed by the system during search, without returning a single successful search result:

queries assigned per executor: [230, 230, 230, 230, 230, 230, 230, 229]
zsh: killed     RUST_LOG=info ../rust/target/release/bambam -c denver/bambam-config-omf.toml 

this is likely a search running without bounds. some possible issues:

  • thrashing in the frontier space due to repeated labels
  • solution size is not sufficient for a termination condition with label setting
  • we should be able to run bambam with query-time assignment of available_modes, but, it seems it is only set at config time (see rust/bambam/src/model/frontier/multimodal/service.rs for the build() method implementation)

original bug

failure executing traversal model due to search state: invalid leg id 5 >= max leg id 5

while attempting a test run from a bambam-omf import using a new template configuration TOML file as part of #96, we can get as far as running each search for each grid cell. however, all rows fail with the following error message:

The search failed due to traversal model error. The traversal model performs edge traversals by updating the various search dimensions, based on the state and cost models. Please review the [traversal] section of your Compass Configuration. Source: failure executing traversal model due to search state: invalid leg id 5 >= max leg id 5

this error message can be traced to the bambam::model::traversal::multimodal::multimodal_state_ops::validate_leg_idx function. this means that some trip with 5 max trip legs was allowed to perform an additional mode (aka edge list) transition during a run where the user configuration specifically set the max_trip_legs to 5. this should be guarded by the frontier model's constraint entry which limits </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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.

bugs during test of template TOML file

2 participants