Skip to content

Commit 8c66f38

Browse files
authored
Merge pull request #381 from depot/billy/fix/wait-msg
fix: change up some wording around how to resume existing depot claude sessions
2 parents 06671eb + ea917a8 commit 8c66f38

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

pkg/cmd/claude/claude.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Subcommands:
6868
# Run Claude in remote sandbox (default)
6969
depot claude --session-id sandbox-work
7070
71+
# Wait for an existing session to complete
72+
depot claude --wait --resume sandbox-work
73+
7174
# Run Claude locally instead of in sandbox
7275
depot claude --local --session-id local-work
7376

pkg/cmd/claude/remote.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,25 @@ func RunAgentRemote(ctx context.Context, opts *AgentRemoteOptions) error {
7575
}
7676
}
7777

78-
if foundSandbox != nil && foundSandbox.CompletedAt == nil {
78+
if foundSandbox == nil {
79+
if opts.Wait {
80+
return fmt.Errorf("session '%s' not found or already completed. To resume locally, use: depot claude --local --resume %s", opts.ResumeSessionID, opts.ResumeSessionID)
81+
}
82+
} else if foundSandbox.CompletedAt != nil {
83+
if opts.Wait {
84+
fmt.Fprintf(opts.Stdout, "Session %s has already completed.\n", opts.ResumeSessionID)
85+
fmt.Fprintf(opts.Stdout, "\nTo resume the session locally, run:\n")
86+
fmt.Fprintf(opts.Stdout, " depot claude --local --resume %s\n", opts.ResumeSessionID)
87+
return nil
88+
}
89+
} else {
90+
// Sandbox is still running
7991
if !opts.Wait {
8092
fmt.Fprintf(opts.Stdout, "\n✓ Claude sandbox is already running for session %s!\n", opts.ResumeSessionID)
8193
fmt.Fprintf(opts.Stdout, "\nTo wait for this session to complete, run:\n")
8294
fmt.Fprintf(opts.Stdout, " depot claude --wait --resume %s\n", opts.ResumeSessionID)
8395
return nil
8496
}
85-
8697
fmt.Fprintf(opts.Stderr, "Claude sandbox for session %s is already running, waiting for it to complete...\n", opts.ResumeSessionID)
8798
return streamSandboxLogs(ctx, sandboxClient, token, foundSandbox.SandboxId, foundSandbox.SessionId, foundSandbox.OrganizationId, opts.Stdout, opts.Stderr)
8899
}
@@ -135,7 +146,7 @@ func RunAgentRemote(ctx context.Context, opts *AgentRemoteOptions) error {
135146
fmt.Fprintf(opts.Stdout, "Session ID: %s\n", sessionID)
136147
fmt.Fprintf(opts.Stdout, "\nTo view the Claude session, visit: https://depot.dev/orgs/%s/claude/%s\n", opts.OrgID, sessionID)
137148
fmt.Fprintf(opts.Stdout, "\nTo wait for this session to complete, run:\n")
138-
fmt.Fprintf(opts.Stdout, " depot claude --wait --session-id %s\n", sessionID)
149+
fmt.Fprintf(opts.Stdout, " depot claude --wait --resume %s\n", sessionID)
139150
return nil
140151
}
141152

0 commit comments

Comments
 (0)