Fix resume creating new agents instead of restarting stopped ones#85
Closed
scion-gteam[bot] wants to merge 2 commits into
Closed
Fix resume creating new agents instead of restarting stopped ones#85scion-gteam[bot] wants to merge 2 commits into
scion-gteam[bot] wants to merge 2 commits into
Conversation
The Hub server's CreateAgentRequest struct was missing the Resume field that the CLI client sends, causing all stopped agents to be treated as stale and deleted+recreated rather than restarted in-place. Add the Resume field to the Hub's CreateAgentRequest and handle the stopped+resume case in handleExistingAgent: when Resume=true and the agent is in PhaseStopped, restart it in-place (preserving agent ID, metadata, and template association) rather than deleting and recreating. When Resume is not set (i.e. scion start), the existing delete+recreate behavior is preserved unchanged.
Owner
|
This pull request has been recreated on the target repository as GoogleCloudPlatform#271. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes #61 —
scion resumewas creating new agents instead of resuming stopped ones.CreateAgentRequeststruct was missing theResumefield that the CLI client sends. All stopped agents were treated as "stale" and deleted+recreated, losing the agent ID, template association, and metadata.Resumefield to the Hub'sCreateAgentRequestand added a new handler path inhandleExistingAgentthat restarts stopped agents in-place whenResume=true, mirroring the existing suspended-agent path.scion starton a stopped agent (withoutResume) still deletes and recreates — onlyscion resumetriggers the in-place restart.Test plan
TestCreateAgent_ResumeFromStoppedStatus— verifies resume returns 200, preserves agent ID, callsDispatchAgentStart(not delete+create)TestCreateAgent_StartFromStoppedStatus_NoResume— verifies start (no resume flag) still recreates with 201TestCreateProjectAgent_ResumeFromStoppedStatus— same resume test through project-scoped endpointTestCreateAgent_RecreateFromStoppedStatusstill passes (no regression)go test ./pkg/hub/...passesgo vet ./...andgo build ./...pass