Repository navigation
Fail startup closed when a state pass misses its deadline - #287
Merged
Merged
Conversation
The startup state timeout was checked only when a pass returned. A fuel or oxidizer command that never completed left the valve open and the loop never reached the next check. A pass now fail-closes at the deadline without waiting on that command, and the closed loop keeps retrying the shutdown. Co-authored-by: Pejman Haghighatnia <pejmantheory@users.noreply.github.com>
Keep the sensor-read timeout fail-closed tests and the in-flight deadline tests. A timed-out sample and a pass that misses its state deadline both shut the valves without stopping the loop. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Startup checked its state timeout only when a pass returned to the top of the control loop. Fuel and oxidizer admission wait inside the pass after the valve is already open. A command or sensor read that never completed left that valve at the last commanded position: the deadline was not consulted again, and the loop task never reached the next check.
A pass now arms the remaining state budget. When the deadline expires first, the sequence fail-closes and commands every valve shut without waiting for the in-flight call. The closed-state loop keeps retrying that shutdown. Stopping the loop still propagates cancellation. A sensor or actuator timeout raised on its own token is unchanged: a startup sensor-read timeout still leaves the pass, and an actuator-command timeout still fail-closes inside the command helper.
Related issues
None.
Type of change
How to test
dotnet test Tests/HelloblueGK.Tests.csproj -c Release --filter FullyQualifiedName~StartupSequenceControllerTestsFuelFlow_InFlightCommandPastTheDeadline_FailClosesWithoutWaitingreturns in well under the one-second flow wait, latchesError, and closes the fuel valve.FuelFlow_InFlightCommandPastTheDeadline_LeavesTheControlLoopRunningkeepsIsRunningtrue and continues shutdown retries after the fuel deadline.Checklist
dotnet buildsucceeds locally (or I ran the equivalent CI steps)dotnet test Tests/HelloblueGK.Tests.csprojpasses (or tests are not applicable).envfilesCertification/unless the issue asked for itScreenshots / logs (optional)
Release startup-sequence tests passed, including the two new deadline cases. Full Release suite: 1574 passed, and
LargeDataSet_ShouldHandleEfficientlyfailed once at 21s while a package audit ran in parallel, then passed alone in about 1s.dotnet list package --vulnerable --include-transitivereported no vulnerable packages forHelloblueGK,HelloblueGK.WebAPI, andHelloblueGK.Tests.Note
High Risk
Changes real-time engine startup valve timing and fail-closed behavior; incorrect deadline/cancellation handling could close propellants early or leave them open.
Overview
Fixes a safety gap where startup state timeouts were only evaluated between control-loop passes, so a hung fuel/oxidizer valve command or sensor read could leave propellants open indefinitely.
Each pass now bounds in-flight state work to the remaining per-state deadline (
Task.WhenAny+CancelAfteron a linked token). When the budget expires first, the sequence fail-closes immediately—commands valves shut and latchesError—without awaiting I/O that ignores cancellation. Hung work is torn down viaReleaseStatePassso the loop keeps running shutdown retries. State dispatch moves intoExecuteCurrentStateAsync; tests gainSetStateEnteredAtand two cases for never-returning fuel open commands.Reviewed by Cursor Bugbot for commit 8fb5e4e. Bugbot is set up for automated code reviews on this repo. Configure here.