Skip to content

Fix resume creating new agents instead of restarting stopped ones#85

Closed
scion-gteam[bot] wants to merge 2 commits into
mainfrom
scion/dev-issue-61
Closed

Fix resume creating new agents instead of restarting stopped ones#85
scion-gteam[bot] wants to merge 2 commits into
mainfrom
scion/dev-issue-61

Conversation

@scion-gteam
Copy link
Copy Markdown

@scion-gteam scion-gteam Bot commented May 31, 2026

Summary

Fixes #61scion resume was creating new agents instead of resuming stopped ones.

  • Root cause: The Hub server's CreateAgentRequest struct was missing the Resume field that the CLI client sends. All stopped agents were treated as "stale" and deleted+recreated, losing the agent ID, template association, and metadata.
  • Fix: Added the Resume field to the Hub's CreateAgentRequest and added a new handler path in handleExistingAgent that restarts stopped agents in-place when Resume=true, mirroring the existing suspended-agent path.
  • Preserved behavior: scion start on a stopped agent (without Resume) still deletes and recreates — only scion resume triggers the in-place restart.

Test plan

  • TestCreateAgent_ResumeFromStoppedStatus — verifies resume returns 200, preserves agent ID, calls DispatchAgentStart (not delete+create)
  • TestCreateAgent_StartFromStoppedStatus_NoResume — verifies start (no resume flag) still recreates with 201
  • TestCreateProjectAgent_ResumeFromStoppedStatus — same resume test through project-scoped endpoint
  • Existing TestCreateAgent_RecreateFromStoppedStatus still passes (no regression)
  • Full go test ./pkg/hub/... passes
  • go vet ./... and go build ./... pass

ptone added 2 commits May 31, 2026 03:21
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.
@ptone ptone closed this May 31, 2026
@ptone
Copy link
Copy Markdown
Owner

ptone commented May 31, 2026

This pull request has been recreated on the target repository as GoogleCloudPlatform#271.

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.

Bug: scion resume creates new agents instead of resuming stopped ones

1 participant