Repository navigation
fix: mark a run failed when it crashes instead of leaving it running (SECFOO-39) - #25
Merged
Merged
Conversation
…" (SECFOO-39) create_run() inserts the row as 'running' and only complete_run() moves it on, so any exception in between (adapter crash, disk error, a report parser) left the run 'running' forever in `secfoo list` and the dashboard. Found in the SECFOO-10 E2E, where a Copilot launch crash left two runs stuck. Wrap that span: on any exception (BaseException, so Ctrl+C is recorded too) the run is completed as 'failed' with its end time and the traceback as the stderr excerpt, then the exception is re-raised so callers behave exactly as before. Closing out the row never raises, so it can't mask the original error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3 of 4 tasks
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
Fixes SECFOO-39: a run that crashes stays
runningforever insecfoo listand the dashboard.Cause:
_run_single_skill()inserts the run asrunning(create_run) before the agent starts, and onlycomplete_run()at the end moves it on. Any exception in between skippedcomplete_run()and left the row stuck: an adapter crash, a file write error, a report parser, or Ctrl+C. This was seen in the SECFOO-10 E2E, where a Copilot launch crash (WinError 2, since fixed in #23) left two runs atrunningpermanently.Fix: wrap that span in
try/except BaseException:failed, with its end time, duration, and the traceback as the stderr excerpt.BaseExceptionmeans Ctrl+C mid-run is recorded too._mark_run_crashed()never raises, so a failure while recording can't hide the original error.Test plan
test_a_run_that_crashes_is_marked_failed_not_left_running: an adapter raisingFileNotFoundErrormust leave the runfailedwithfinished_atset and the traceback saved, and the exception must still reach the caller.runner.pyit fails withassert 'running' == 'failed'.pytest: 729 passed, 5 failed. The 5 (test_cloudpermissions and 4 architecture dashboard tests) fail the same way onmainon Windows.main, including Make cost tracking a CI control: --fail-on, --max-cost, --json #19's severity counts onRunOutcome.Not in this PR
Runs already stuck at
runningin existing databases aren't cleaned up. That could be a one-offUPDATEor a startup sweep if wanted.🤖 Generated with Claude Code