Repository navigation
Description
Summary
Resume state is written only after a signal, so a run that ends because its time budget ran out, or because the reliability guard aborted it, leaves nothing to continue from. Time-boxed CI scans therefore test the same first part of the wordlist on every run.
Where
main_session.go:780main_session.go:782main_resume.go:130internal/scan/verdict.go:44action.yml:40
Details
finish saves resume state only after a signal: if s.signalCode.Load() != 0 { saveResumeState(s) } else if s.resume != nil && !s.anyFailed { os.Remove(s.resume.path) ... } (main_session.go:780-787). A run that reaches -max-duration ends "normally" with Skipped > 0 && Expired and a degraded verdict (internal/scan/verdict.go:44-45), and a reliability abort also ends without a signal, so neither writes a state file. Yet main_resume.go:130-134 already treats -max-duration as "a budget for each invocation rather than for the scan (#190)" and exempts it from the resume settings check, which only makes sense if a budgeted run can be resumed. The Action's max-duration input (action.yml:40-47) and docs/monitoring.md:119 recommend the budget for scheduled jobs. Assumption (medium confidence on this part only): a resumed run that then hits its budget is not anyFailed, so line 782 removes its state file although candidates are still untested. Checked against #73, #107, #108, #109, #156, #190, #217, #237, #255 (all closed, none cover this) and the open list.
Impact
The users who most need continuation are the ones with a time box: a CI job with a 20 minute budget over a large wordlist tests the same first N names on every run and never reaches the rest, and never produces a complete baseline (the Action only saves a baseline on complete, action.yml:210). After a guard abort, the only recovery is a full rescan.
Suggested fix
In finish, also call saveResumeState when any target's final stats have Expired set (and, as a second step, when a target ended with a resolver abort), and print the same "continue with: subenum -resume " line. Do not remove a resumed run's state when the resumed part expired again. Keep exit code 0 for expiry. Then let the Action carry the state file in the baseline artifact so each scheduled run continues where the last stopped. Open questions: whether to write the file by default or only when -state is given explicitly (a state file appearing after a normal exit may surprise scripts); -retry-inconclusive is skipped at expiry and should run at the end of the resumed run; stdin inputs still cannot be replayed.
Acceptance criteria
- A run that ends with candidates skipped by
-max-durationwrites a resume state and prints how to continue - A resumed run that expires again keeps its state file
- Exit code for an expired run is unchanged
- Documented in the
-max-durationand-resumehelp and in docs/monitoring.md
Getting started
- Relevant files:
main_session.go,main_resume.go,internal/scan/verdict.go,action.yml - How to run tests:
make test(orgo test ./...). Tests must stay hermetic: use-simulate,-simulate-zoneor the local DNS test server, never a live domain. - Related docs:
docs/DEVELOPER_GUIDE.md,docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at d0c56f0. Severity: high. Effort: M. audit-key: enhancement|main_session.go|finish.saveResumeState
Activity
TMHSDigital commentedon Nov 15, 2026
Fixed in 274df44.
A run that
-max-durationstopped with names untested, or that the reliability guard aborted, now saves its resume state to the-statefile and printscontinue with: subenum -resume <file>, like an interrupted run. Exit codes are unchanged. A resumed run that runs out again saves its state again, and a scan finished by a resume reportscompletewith nothing skipped.Verified with two new end-to-end tests:
TestE2EMaxDurationSavesResumeState(simulation: run, resume until finished, state removed, verdict complete) andTestE2EAbortSavesResumeState(in-process DNS server: aborted run, then a resume against the healed server tests every name).go test ./...andgolangci-lint runpass.Not included: the GitHub Action does not carry the state file between scheduled runs (
docs/monitoring.mdsays so), and-retry-inconclusiveon a resumed run does not retry names the earlier part left inconclusive.Say "stopped run" in resume messages, not "interrupt" (#341)
Save resume state when -max-duration or the guard stops a run (TMHSDi…