fix(runtime): discard stale inference after watchdog reset and warmup timeout - #320
ShubhJain09 wants to merge 3 commits into
Conversation
… timeout Signed-off-by: ShubhJain09 <shubhmohta07@gmail.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
RTC timeout handling retains a result-acceptance race, and its regression test uses nondeterministic synchronization.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
This PR prevents stale inference results from reaching robot action queues after watchdog or warmup timeouts.
Changes:
- Invalidates stuck asynchronous inference results during watchdog resets.
- Invalidates and clears timed-out RTC warmup requests.
- Adds regression tests for both stale-result paths.
| File | Description |
|---|---|
async_execution.py |
Invalidates watchdog-reset inference results. |
rtc.py |
Adds configurable warmup timeout and stale-result invalidation. |
test_execution.py |
Tests watchdog and warmup timeout behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if not signal.event.wait(timeout=_WARMUP_TIMEOUT_S): | ||
| with self._obs_lock: | ||
| if self._warmup_signal is signal: | ||
| self._warmup_signal = None | ||
| # The abandoned request may still be in the model. Its chunk | ||
| # must not seed the queue after warmup has reported failure. | ||
| self._incarnation += 1 |
There was a problem hiding this comment.
Good catch fixed in bcccaee by rechecking the signal under the lock and added a test that forces this exact interleaving
| assert returned.wait(timeout=5.0) | ||
| time.sleep(0.1) |
There was a problem hiding this comment.
Switched to waiting on the worker finishing _accept_result instead of a sleep so the test is deterministic now
Signed-off-by: ShubhJain09 <shubhmohta07@gmail.com>
|
Note fore reviewer: please ignore fuzzing failure, this is not related with this PR and will be fixed separately. @openvinotoolkit/physicalai-maintain |
|
@AlexanderBarabanov thanks for approving the CI run and for the note on the fuzz failure |
|
@ShubhJain09 Thanks for investigating this -- the fix and regression test will be very valuable. Please go ahead and open a separate PR. Thanks! |
|
@AlexanderBarabanov thank you for the suggestion |

Summary
_force_resetinAsyncExecutionnow bumps_incarnationso a stuck inference that finally returns after the watchdog fires gets thrown away instead of landing in the action queuewarmupinRTCExecutiondoes the same when it times out and also clears the pending observation slot_WARMUP_TIMEOUT_Sconstant so the test can shorten ittest_executionthat cover both pathsWhy
watchdog_timeout_sthe watchdog clears the busy state but never invalidates the call that is still running_pops_at_requestwas already overwritten by the next requestValidation
pytest tests/unit packages/*/testsgives 2275 passed and 0 failedprek run --all-filesis clean including ruff and pyreflyBreaking changes
Related issues