Skip to content

Fix no-progress timeout bug and apply code formatting#236

Merged
jbrodovsky merged 3 commits into
feature/sim-timeoutsfrom
copilot/sub-pr-235
Jan 16, 2026
Merged

Fix no-progress timeout bug and apply code formatting#236
jbrodovsky merged 3 commits into
feature/sim-timeoutsfrom
copilot/sub-pr-235

Conversation

Copilot AI commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

The ExecutionMonitor::check() method was updating last_progress on every call, preventing the no-progress timeout from ever triggering.

Changes

  • Fixed no-progress timeout mechanism: Removed automatic last_progress update from check(), added explicit mark_progress() method that callers must invoke after successfully processing each event
  • Updated integration points: Modified run_closed_loop and particle filter loops to call mark_progress() after each event
  • Applied code formatting: Fixed duplicate imports, collapsed nested if statements, resolved mutable borrow issues in particle filter measurement handling

Example

// Before: check() always updated last_progress, timeout never triggered
monitor.check("context")?;  // This would reset the progress timer

// After: Progress must be explicitly marked
monitor.check("context")?;  // Only checks, doesn't reset timer
process_event();
monitor.mark_progress();    // Explicitly mark progress after successful work

Known Limitation

The _execution_limits variable in run_geo_closed_loop_cli remains unused because geophysical navigation functions in the geonav crate don't yet accept ExecutionLimits parameters.


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

Copilot AI and others added 2 commits January 16, 2026 22:52
- Fix duplicate ExecutionMonitor import in core/src/sim.rs
- Apply clippy suggestions to collapse nested if statements
- Fix mutable borrow issues in particle filter code
- Apply rustfmt formatting throughout the workspace
- Add execution_limits to run_particle_filter function

Co-authored-by: jbrodovsky <57160841+jbrodovsky@users.noreply.github.com>
- Remove automatic last_progress update from check() method
- Add mark_progress() method to explicitly mark progress
- Update all callers to call mark_progress() after successful event processing
- Fix test_execution_monitor_no_progress_timeout to properly test the timeout

The no-progress timeout can now correctly detect when no progress has been made
for the specified duration. Previously, check() was updating last_progress on
every call, which prevented the timeout from ever triggering.

Co-authored-by: jbrodovsky <57160841+jbrodovsky@users.noreply.github.com>
Copilot AI changed the title [WIP] Add execution timeouts for simulations Fix no-progress timeout bug and apply code formatting Jan 16, 2026
Copilot AI requested a review from jbrodovsky January 16, 2026 22:59
@jbrodovsky
jbrodovsky marked this pull request as ready for review January 16, 2026 23:32
Copilot AI review requested due to automatic review settings January 16, 2026 23:32
@jbrodovsky
jbrodovsky merged commit 720c7ea into feature/sim-timeouts Jan 16, 2026
4 checks passed
@jbrodovsky
jbrodovsky deleted the copilot/sub-pr-235 branch January 16, 2026 23:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug in the ExecutionMonitor's no-progress timeout mechanism and applies code formatting improvements. The timeout was being reset on every call to check(), preventing it from ever triggering, which defeated its purpose as a watchdog timer.

Changes:

  • Fixed ExecutionMonitor bug by separating timeout checking from progress marking
  • Added explicit mark_progress() calls in simulation loops after successful event processing
  • Applied code formatting improvements (collapsed nested if-statements, fixed import ordering, improved line wrapping)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/src/sim.rs Fixed ExecutionMonitor bug by removing automatic last_progress update from check() and adding new mark_progress() method; reorganized imports
sim/src/main.rs Added mark_progress() calls after event processing in particle filter loops; reordered duplicate imports; marked unused _execution_limits variable
sim/src/common.rs Collapsed nested if-statements into let-chain pattern for cleaner code
core/tests/integration_tests.rs Improved line wrapping for better readability
core/src/rbpf.rs Improved line wrapping in matrix operations

Comment thread core/src/sim.rs
Comment on lines +2643 to +2647
/// Mark that progress has been made in the simulation.
/// This should be called after successfully processing each event.
pub fn mark_progress(&mut self) {
self.last_progress = Instant::now();
}

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

The new mark_progress() method lacks test coverage. The existing test test_execution_monitor_no_progress_timeout validates that the timeout triggers when no progress is made, but there is no test verifying that calling mark_progress() correctly resets the timer and prevents the timeout from triggering. Consider adding a test that calls mark_progress() between checks to ensure the timeout doesn't trigger when progress is being made.

Copilot uses AI. Check for mistakes.
Comment thread sim/src/main.rs
let csv_files = get_csv_files(&args.sim.input)?;
let is_multiple = csv_files.len() > 1;
let execution_limits = execution_limits_from_args(&args.sim);
let _execution_limits = execution_limits_from_args(&args.sim);

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

The _execution_limits variable is intentionally unused because geo_closed_loop_ukf and geo_closed_loop_ekf functions in the geonav crate don't accept ExecutionLimits parameters. This creates an inconsistency where geophysical navigation simulations lack execution timeout protection that other simulation modes have. Consider either updating the geonav functions to accept ExecutionLimits or removing this line until the functionality is ready to be integrated.

Suggested change
let _execution_limits = execution_limits_from_args(&args.sim);

Copilot uses AI. Check for mistakes.
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.

3 participants