Skip to content

Fail startup closed when a state pass misses its deadline - #287

Merged
pejmantheory merged 2 commits into
mainfrom
cursor/code-quality-and-security-5e23
Oct 23, 2026
Merged

pejmantheory merged 2 commits into
mainfrom
cursor/code-quality-and-security-5e23

Conversation

@cursor

@cursor cursor Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only
  • Refactor / chore (no behavior change)

How to test

  1. dotnet test Tests/HelloblueGK.Tests.csproj -c Release --filter FullyQualifiedName~StartupSequenceControllerTests
  2. Confirm FuelFlow_InFlightCommandPastTheDeadline_FailClosesWithoutWaiting returns in well under the one-second flow wait, latches Error, and closes the fuel valve.
  3. Confirm FuelFlow_InFlightCommandPastTheDeadline_LeavesTheControlLoopRunning keeps IsRunning true and continues shutdown retries after the fuel deadline.

Checklist

  • I read CONTRIBUTING.md and followed the development workflow
  • dotnet build succeeds locally (or I ran the equivalent CI steps)
  • dotnet test Tests/HelloblueGK.Tests.csproj passes (or tests are not applicable)
  • I added or updated tests for behavior changes
  • I updated documentation when behavior, APIs, or setup changed
  • My commit messages are clear and descriptive
  • I did not commit secrets, credentials, or .env files
  • First PR / docs-only work stays out of Certification/ unless the issue asked for it

Screenshots / logs (optional)

Release startup-sequence tests passed, including the two new deadline cases. Full Release suite: 1574 passed, and LargeDataSet_ShouldHandleEfficiently failed once at 21s while a package audit ran in parallel, then passed alone in about 1s. dotnet list package --vulnerable --include-transitive reported no vulnerable packages for HelloblueGK, HelloblueGK.WebAPI, and HelloblueGK.Tests.

Open in Web View Automation 

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 + CancelAfter on a linked token). When the budget expires first, the sequence fail-closes immediately—commands valves shut and latches Error—without awaiting I/O that ignores cancellation. Hung work is torn down via ReleaseStatePass so the loop keeps running shutdown retries. State dispatch moves into ExecuteCurrentStateAsync; tests gain SetStateEnteredAt and 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.

cursoragent and others added 2 commits October 22, 2026 16:17
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>
@pejmantheory
pejmantheory marked this pull request as ready for review October 23, 2026 04:44
@pejmantheory
pejmantheory requested a review from a team as a code owner October 23, 2026 04:44
@pejmantheory
pejmantheory merged commit 005d90a into main Oct 23, 2026
14 checks passed
@pejmantheory
pejmantheory deleted the cursor/code-quality-and-security-5e23 branch October 23, 2026 04:51
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.

2 participants