Add instance restart policy#233
Conversation
✱ Stainless preview builds for hypemanThis PR will update the Edit this comment to update it. It will appear in the SDK's changelogs. ✅ hypeman-openapi studio · code · diff
✅ hypeman-typescript studio · code · diff
✅ hypeman-go studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
383ad8b to
365fa7d
Compare
… into hypeship/restart-policy
… into hypeship/restart-policy # Conflicts: # lib/instances/health_check_controller.go
Monitoring Plan: Restart PolicyThis PR introduces a new The primary risks to watch are: stop/start loops if the reconciler misidentifies instances, a regression in |
… into hypeship/restart-policy
… into hypeship/restart-policy # Conflicts: # lib/instances/health_check_controller.go
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 65ff54e. Configure here.

Summary
Testing
Not run: full ./cmd/api/api package; it enters broader lifecycle coverage outside this focused change.
Note
Medium Risk
Adds new instance lifecycle behavior (automatic stop/start restarts) driven by both guest exits and health-check failures, which can affect availability and state transitions if misconfigured. Risk is mitigated by backoff/max-attempt limits, manual-stop suppression, and extensive unit/integration test coverage.
Overview
Adds whole-instance restart policy support end-to-end: new
restart_policyinput on create/update and newrestart_policy/restart_statusfields on instance responses, with OpenAPI + generated bindings updated accordingly.Introduces a
lib/restart-policymodule (normalization, backoff, max attempts, stable-window reset, and status tracking) and a new restart-policy controller inlib/instancesthat reconciles instances and performs automatic restarts fromStopped, while also handlingRunninginstances becomingunhealthyby stop/start cycling.Updates lifecycle semantics to suppress auto-restarts after manual
Stop(exposed asrestart_status.blocked_reason=manual_stop) and to clear restart status onStart; restart policy/state is cloned/reset appropriately on fork/snapshot. Adds tests across API mapping, controller behavior, metrics labels, and an integration path that triggers restarts via failing health checks, plus documentation clarifying health-check vs restart-policy responsibilities.Reviewed by Cursor Bugbot for commit 4f6aa80. Bugbot is set up for automated code reviews on this repo. Configure here.