You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
revert the template VM state, API endpoints, and metadata fields
remove template-specific fork and deletion behavior so snapshot fanout can replace it
Tests
go test ./lib/instances/ -run 'Test(StateTransitions|ResolveForkTargetState|ValidateForkRequest|ForkInstanceFromStandbyCancelsCompressionJobAndCopiesRawMemory)'\n- go test ./cmd/api/api ./lib/scopes ./lib/builds (fails locally: bridge setup is not permitted and mkfs.erofs is unavailable)
Note
Medium Risk
Removes the Template lifecycle state and associated API endpoints, which is a breaking change for clients and alters fork/delete/restore behavior for standby instances. Risk is moderate due to lifecycle semantics and generated OpenAPI client/server surface changes.
Overview
Reverts the template instance concept by removing the Template state from instances (state machine, metadata fields, state derivation, and transition tests) and deleting all template-specific logic such as fork-from-template handling and delete/demote fork-count guards.
Removes the POST /instances/{id}/promote-template and POST /instances/{id}/demote-template endpoints end-to-end (API handlers, scopes, OpenAPI schema/enum, generated lib/oapi client/server code, and stainless.yaml), and drops the now-obsolete template-focused unit test suite.
Reviewed by Cursor Bugbot for commit 3787ab3. Bugbot is set up for automated code reviews on this repo. Configure here.
Your SDK build had at least one "note" diagnostic. generate ✅ → build ⏭️ → lint ✅ → test ✅
go get github.com/stainless-sdks/hypeman-go@537a68947307effc1c8a9efec8a9041fd6319e9d
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. If you push custom code to the preview branch, re-run this workflow to update the comment. Last updated: 2026-05-18 14:39:18 UTC
This PR removes the Template VM instance state and its associated PromoteInstanceToTemplate / DemoteInstanceTemplate API endpoints entirely. The change deletes ~1,400 lines across the instance manager, state machine, API handlers, OpenAPI spec, and OAPI client — cleaning up an unused lifecycle concept. After this deploy, instances with IsTemplate=true in stored metadata will be read back as plain Standby (since deriveState no longer checks IsTemplate), and callers hitting the removed endpoints will receive 404s.
Key risks to watch post-deploy: (1) any existing Template-state instances whose metadata is read back and misclassified, triggering unexpected state transitions; (2) a spike in 4xx/5xx errors on /instances/{id}/fork, /instances/{id}/restore, or the removed paths; (3) any panics or invalid_state errors in the API logs from code paths that still referenced StateTemplate but weren't caught by the test suite. Status updates will be posted automatically on this PR as monitoring progresses.
invalid_state or failed to promote/demote errors appearing in API logs post-deploy
404s on /instances/{id}/promote-template or /instances/{id}/demote-template (expected/benign if callers already migrated, but volume worth confirming is zero)
Metadata misread: instances previously in Template state now incorrectly treated as Standby
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
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
Tests
Note
Medium Risk
Removes the
Templatelifecycle state and associated API endpoints, which is a breaking change for clients and alters fork/delete/restore behavior for standby instances. Risk is moderate due to lifecycle semantics and generated OpenAPI client/server surface changes.Overview
Reverts the template instance concept by removing the
Templatestate frominstances(state machine, metadata fields, state derivation, and transition tests) and deleting all template-specific logic such as fork-from-template handling and delete/demote fork-count guards.Removes the
POST /instances/{id}/promote-templateandPOST /instances/{id}/demote-templateendpoints end-to-end (API handlers, scopes, OpenAPI schema/enum, generatedlib/oapiclient/server code, andstainless.yaml), and drops the now-obsolete template-focused unit test suite.Reviewed by Cursor Bugbot for commit 3787ab3. Bugbot is set up for automated code reviews on this repo. Configure here.