Skip to content

fix(radio_planner): exempt UNLOCK_RADIO_ACCESS from the failsafe panic - #1

Open
Mikefly123 wants to merge 1 commit into
mainfrom
fix/radio-planner-failsafe-exempt-unlock
Open

fix(radio_planner): exempt UNLOCK_RADIO_ACCESS from the failsafe panic#1
Mikefly123 wants to merge 1 commit into
mainfrom
fix/radio-planner-failsafe-exempt-unlock

Conversation

@Mikefly123

@Mikefly123 Mikefly123 commented Jul 24, 2026

Copy link
Copy Markdown

What

The radio planner's rp_callback() failsafe reboots the board (panic) if the current task has been RUNNING for more than 128 s. It already exempts RP_TASK_TYPE_LOCK_RADIO_ACCESS from this check, but was missing the same exemption for RP_TASK_TYPE_UNLOCK_RADIO_ACCESS.

Why

A lock task held open longer than the failsafe window (e.g. continuous RX under the raw RAC) keeps its original start_time_ms. When the client releases the lock, unlock_radio_access() retypes the still-RUNNING task from LOCK to UNLOCK before the engine processes it. The very next rp_callback() then evaluates the failsafe against that stale start_time_ms and panics — at the exact moment the client releases the lock. This produced a deterministic silent reboot any time a radio lock was held past 128 s.

The fix adds the same task-type exemption for RP_TASK_TYPE_UNLOCK_RADIO_ACCESS so the retype-on-release path is no longer misclassified as a hung task.

HWIL-validated as carried patch on PROVES FCB v5e.

Related: Open-Source-Space-Foundation/proves-core-reference#439

This is a candidate for true upstreaming to Lora-net/usp once validated further.


Stack position: 1/2 — base of stack main <- #1 <- #2. See #2 for the next layer.

The rp_callback() failsafe panics/reboots any task that has been
RUNNING for more than 128 s, with an explicit exemption for
RP_TASK_TYPE_LOCK_RADIO_ACCESS so a client holding the radio lock
open indefinitely doesn't trip it. RP_TASK_TYPE_UNLOCK_RADIO_ACCESS
was missing the same exemption.

A lock task held open longer than the failsafe window (e.g.
continuous RX under the raw RAC) keeps its original start_time_ms.
When the client releases the lock, unlock_radio_access() retypes the
still-RUNNING task from LOCK to UNLOCK before the engine processes
it. The very next rp_callback() then evaluates the failsafe against
that stale start_time_ms and panics at the exact moment the client
releases the lock, causing a silent reboot after any lock held past
128 s.

Add the same task-type exemption for RP_TASK_TYPE_UNLOCK_RADIO_ACCESS
so the retype-on-release path is no longer misclassified as a hung
task.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Prevented the failsafe from triggering incorrectly when radio access unlock operations remain in progress beyond the expected time window.

Walkthrough

The radio planner’s failsafe callback now excludes both LOCK_RADIO_ACCESS and UNLOCK_RADIO_ACCESS tasks from the panic condition while they remain running.

Changes

Radio planner failsafe

Layer / File(s) Summary
Update running-task failsafe exemptions
smtc_rac_lib/radio_planner/src/radio_planner.c
The rp_callback logic now exempts UNLOCK_RADIO_ACCESS alongside LOCK_RADIO_ACCESS from triggering RP_FAILSAFE.

Estimated code review effort: 2 (Simple) | ~5 minutes

Poem

I’m a bunny guarding the radio gate,
Lock and unlock may both wait.
No false panic, no startled stare,
The failsafe now handles each with care.
Hop, hop—access flows just right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main fix: exempting UNLOCK_RADIO_ACCESS from the radio planner failsafe panic.
Description check ✅ Passed The description explains the failsafe issue, the stale task timestamp, the fix, and its validation.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant