Skip to content

An open-source, faster Devin alternative

TypeScript

fix(cli): oc shell accepts sb-* short sandbox IDs (#168)

Mohamed Habib5f644012005f
diff --git a/cmd/oc/internal/commands/shell.go b/cmd/oc/internal/commands/shell.go
index 7014ad6f..ad1868c1 100644
--- a/cmd/oc/internal/commands/shell.go
+++ b/cmd/oc/internal/commands/shell.go
@@ -6,6 +6,7 @@ import (
"os"
"os/signal"
"regexp"
+ "strings"
"syscall"
"github.com/gorilla/websocket"
@@ -31,9 +32,10 @@ Examples:
sandboxID := args[0]
shellPath, _ := cmd.Flags().GetString("shell")
- // If the argument doesn't look like a UUID, try to resolve it as an
- // agent name through sessions-api → agent → instance → sandbox_id.
- if !uuidPattern.MatchString(sandboxID) {
+ // If the argument doesn't look like a sandbox ID (full UUID or sb-* short form),
+ // try to resolve it as an agent name through sessions-api.
+ isSandboxID := uuidPattern.MatchString(sandboxID) || strings.HasPrefix(sandboxID, "sb-")
+ if !isSandboxID {
sc := client.SessionsFromContext(cmd.Context())
if sc != nil {
resolved, err := resolveAgentSandbox(cmd, sc, sandboxID)