Skip to content

Remove failed first installations so the same command can be retried - #278

Merged
SaladDay merged 5 commits into
mainfrom
codex/install-failure-rollback
Sep 30, 2026
Merged

SaladDay merged 5 commits into
mainfrom
codex/install-failure-rollback

Conversation

@SaladDay

@SaladDay SaladDay commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

A failed first installation left a configured directory that kept failing on repair and refused corrected flags. First-install failures and handled interruptions now remove the installation's services, volumes and files, so the same command can be retried. Loaded images stay available for the retry.

Record completion only after services are healthy and Web-only Core authentication succeeds. Incomplete reruns clean their own state and accept fresh flags; completed installations retain repair-only behavior. Directories without installation state are preserved. The shared removal path keeps the installation lock and recovery state, and the release downloader lets the installer handle terminal and signal cleanup.

Validation: make check-distribution and make check-names pass. Tests cover failure, interruption, incomplete retry, complete-install protection, foreign files, completion guards and final cleanup recovery. Independent blind review covers deletion scope, signals, locking and recovery.

SIGKILL or power loss during the final state/launcher unlinks can require manual removal of the remaining files; handled SIGINT, SIGTERM and SIGHUP are ignored during that short finalization.

Review follow-up: the printed manual cleanup command now uses the same working-directory and Compose-environment isolation as automatic cleanup, with an executable fake-Docker regression. Stopping partially started services remains available; operations that could enable use of an incomplete installation are blocked.

A new installation records "complete": false in state.json and sets it once
apply converged and the services are healthy. Any failure or interrupt
(Ctrl-C, SIGTERM) before that runs oac_cli.remove: native Core's unit, the
installation's own Compose project with its volumes, and every file the
installer created, keeping loaded images. The directory goes too when the
installer created it. The error ends with "Nothing was kept; fix the problem
and rerun the same command.", or lists what is left and the commands that
remove it.

A rerun over an incomplete installation left by a hard kill removes it the
same way and installs with the flags given now. Complete installations keep
repair-only reruns. locked() refuses a lock whose path no longer names the
locked file, since a removal unlinks it with the directory.
A wrong --core-key-file is a first-install failure: the installer removes
what it created, and the same command can run again with the right file.
- create() writes state.json first, atomically, with the project name and
  complete: false. A directory without state.json is refused and never
  removed; the directory-name heuristic and state-less removal are gone.
- The release downloader execs the installer, so nothing kills it while it
  removes a failed installation. The installer treats SIGHUP like SIGTERM,
  removes before printing, runs compose down with its output discarded, and
  ignores output errors when it reports.
- remove() deletes state.json, the oac command and .oac.lock last, and a
  lone lock file is not reported as left over.
- apply, start, domain setup and rotate-core-key refuse an installation the
  installer has not finished; status reports it.
- The original error propagates after removal with its outcome attached,
  so an interrupt exits 130 and unexpected errors keep their traceback.
- compose down runs from / without COMPOSE_* variables; the Web-only key
  warning and the duplicate settings step are gone on the first-install path.
@SaladDay
SaladDay merged commit 75c6f23 into main Sep 30, 2026
@SaladDay
SaladDay deleted the codex/install-failure-rollback branch October 7, 2026 06:37
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