feat(sandbox): store default sandbox in profile#142
feat(sandbox): store default sandbox in profile#142Ramon Nogueira (ramon-langchain) wants to merge 2 commits into
Conversation
| if err := setDefaultSandboxName(cmd, defaultName); err != nil { | ||
| return nil, fmt.Errorf("setting default sandbox: %w", err) | ||
| } |
There was a problem hiding this comment.
🟡 sandbox create returns error and hides successful creation when config write fails
In sandboxCreateCommand.Action, after the sandbox is successfully created on the server via c.SDK.Sandboxes.Boxes.New(), the code calls setDefaultSandboxName() to persist the default sandbox name to the config file. If this config write fails (e.g., read-only filesystem, disk full, corrupted config), the action returns (nil, err). Because the structured.Command framework at internal/structured/command.go:28-29 checks if err != nil { return err } before rendering, the successfully created sandbox's details (name, ID, status) are never shown to the user. The user sees only an error like setting default sandbox: ... and may not realize the sandbox was created, potentially retrying and creating duplicates or leaving an orphaned sandbox they can't identify.
| if err := setDefaultSandboxName(cmd, defaultName); err != nil { | |
| return nil, fmt.Errorf("setting default sandbox: %w", err) | |
| } | |
| if err := setDefaultSandboxName(cmd, defaultName); err != nil { | |
| fmt.Fprintf(os.Stderr, "warning: could not set default sandbox: %v\n", err) | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Store the current sandbox on the active profile and use it when sandbox commands omit the sandbox name.
Test Plan