Skip to content

fix: accept healthy processes after automatic restart - #556

Draft
awjdean wants to merge 1 commit into
F1bonacc1:mainfrom
awjdean:fix/readiness-after-restart
Draft

awjdean wants to merge 1 commit into
F1bonacc1:mainfrom
awjdean:fix/readiness-after-restart

Conversation

@awjdean

@awjdean awjdean commented Oct 2, 2026 •

Copy link
Copy Markdown

Problem

When a process fails and is restarted automatically, its state keeps the exit code of the failed run. project is-ready treats that old, nonzero exit code as a failure, so it reports the process as not ready even when the restarted process is running and healthy.

project is-ready --wait has the same problem: it keeps waiting after the process has recovered.

Fix

Reject an unsuccessful exit code only when the process is no longer running.

Everything else stays the same:

  • The previous exit code is kept in the process state for diagnostics.
  • The existing status and health checks still apply.
  • A process that failed and stopped is still not ready.
  • A restarted process whose health check is pending or failing is still not ready.

Reproduction

A process exits with code 7 on its first attempt, then restarts and prints its ready log. Its state is then:

{"status":"Running","is_running":true,"is_ready":"Ready","restarts":1,"exit_code":7}
  • Before this fix: project is-ready fails with failed with exit code 7.
  • After this fix: project is-ready succeeds.

Tests

New regression cases cover a process that is running again after a failure:

Case Expected
No health probe ready
Health probe, healthy ready
Health probe, still pending not ready
Health probe, unhealthy not ready

Existing cases still cover failed completed processes and success_exit_codes.

Validation

On Linux with Go 1.26.8:

  • Confirmed the new recovered-process cases fail before the fix.
  • go test ./src/types -count=1 — passed.
  • make build — passed.
  • make testrace — full suite passed.
  • make lint — zero issues.
  • Reproduction against the built binary: a process exits with code 7, restarts automatically and emits its ready log. project is-ready then succeeds, and the previous exit code is still shown in the process status.

Not run: the optional Nix build, because Nix is not installed.

Notes

  • No dependencies were added or updated.
  • This fix is independent of a separate issue, where log-based readiness that is still unknown is accepted before the ready log appears.

Fixes #558

@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

project is-ready rejects a healthy process after automatic restart

1 participant