Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test(profiles): pin missing-profile CLI guidance (PIN-307)

Luigi Agostie93b0da490ee
diff --git a/internal/cli/actions/actions_profiles_create_test.go b/internal/cli/actions/actions_profiles_create_test.go
index dd706149..48685a75 100644
--- a/internal/cli/actions/actions_profiles_create_test.go
+++ b/internal/cli/actions/actions_profiles_create_test.go
@@ -4,8 +4,12 @@ import (
"encoding/json"
"net/http"
"net/http/httptest"
+ "os"
+ "os/exec"
"strings"
"testing"
+
+ "github.com/spf13/cobra"
)
func TestProfilesCreatePostsTheNameAndPrintsTheCreatedIdentity(t *testing.T) {
@@ -36,3 +40,35 @@ func TestProfilesCreatePostsTheNameAndPrintsTheCreatedIdentity(t *testing.T) {
}
}
}
+
+func TestInstanceStartMissingProfilePrintsTheCreateRemedy(t *testing.T) {
+ if os.Getenv("PINCHTAB_TEST_INSTANCE_START_MISSING") == "1" {
+ cmd := &cobra.Command{}
+ cmd.Flags().String("profile", "", "")
+ cmd.Flags().String("mode", "", "")
+ cmd.Flags().String("port", "", "")
+ cmd.Flags().StringArray("extension", nil, "")
+ cmd.Flags().StringArray("allow-domain", nil, "")
+ cmd.Flags().String("browser", "", "")
+ cmd.Flags().StringArray("browser-fallback", nil, "")
+ _ = cmd.Flags().Set("profile", "missing")
+ InstanceStart(http.DefaultClient, os.Getenv("PINCHTAB_TEST_SERVER"), "", cmd)
+ return
+ }
+
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusNotFound)
+ _, _ = w.Write([]byte(`{"code":"profile_not_found","error":"profile missing","details":{"remedy":"pinchtab profiles create missing"}}`))
+ }))
+ defer srv.Close()
+
+ cmd := exec.Command(os.Args[0], "-test.run=^TestInstanceStartMissingProfilePrintsTheCreateRemedy$")
+ cmd.Env = append(os.Environ(), "PINCHTAB_TEST_INSTANCE_START_MISSING=1", "PINCHTAB_TEST_SERVER="+srv.URL)
+ out, err := cmd.CombinedOutput()
+ if err == nil {
+ t.Fatal("instance start unexpectedly succeeded for a missing profile")
+ }
+ if !strings.Contains(string(out), "Remedy: pinchtab profiles create missing") {
+ t.Fatalf("CLI output does not carry the profile creation remedy:\n%s", out)
+ }
+}
diff --git a/plugins/grok/skills/pinchtab/SKILL.md b/plugins/grok/skills/pinchtab/SKILL.md
index ddd3e37d..281803d5 100644
--- a/plugins/grok/skills/pinchtab/SKILL.md
+++ b/plugins/grok/skills/pinchtab/SKILL.md
@@ -87,7 +87,7 @@ If a site requires a CAPTCHA, anti-bot challenge, or other human verification, s
## Authentication and State
-Patterns: (1) one-off `pinchtab instance start`; (2) reuse a profile with `instance start --profile work`; (3) HTTP `POST /profiles` then `POST /profiles/<name>/start`. Human setup: `pinchtab profiles create work`, authenticate headed; agents reuse headless. Agent sessions: `pinchtab session create --agent-id <id>` or `POST /sessions` → set `PINCHTAB_SESSION=ses_...`.
+Patterns: (1) one-off `pinchtab instance start`; (2) reuse a profile with `instance start --profile work`; (3) HTTP `POST /profiles` then `POST /profiles/<name>/start`. The `--profile` pattern requires the profile to exist first. Human setup: `pinchtab profiles create work`, authenticate headed; agents reuse headless. Agent sessions: `pinchtab session create --agent-id <id>` or `POST /sessions` → set `PINCHTAB_SESSION=ses_...`.
**Session reuse safety:** When reusing authenticated browser sessions established by a human, use a dedicated low-privilege profile — not the user's personal browsing profile. Confirm with the user before performing account-changing actions (password changes, payment, deletion, permissions) in a reused session. Restrict navigation to the sites needed for the task.
diff --git a/skills/pinchtab/SKILL.md b/skills/pinchtab/SKILL.md
index ddd3e37d..281803d5 100644
--- a/skills/pinchtab/SKILL.md
+++ b/skills/pinchtab/SKILL.md
@@ -87,7 +87,7 @@ If a site requires a CAPTCHA, anti-bot challenge, or other human verification, s
## Authentication and State
-Patterns: (1) one-off `pinchtab instance start`; (2) reuse a profile with `instance start --profile work`; (3) HTTP `POST /profiles` then `POST /profiles/<name>/start`. Human setup: `pinchtab profiles create work`, authenticate headed; agents reuse headless. Agent sessions: `pinchtab session create --agent-id <id>` or `POST /sessions` → set `PINCHTAB_SESSION=ses_...`.
+Patterns: (1) one-off `pinchtab instance start`; (2) reuse a profile with `instance start --profile work`; (3) HTTP `POST /profiles` then `POST /profiles/<name>/start`. The `--profile` pattern requires the profile to exist first. Human setup: `pinchtab profiles create work`, authenticate headed; agents reuse headless. Agent sessions: `pinchtab session create --agent-id <id>` or `POST /sessions` → set `PINCHTAB_SESSION=ses_...`.
**Session reuse safety:** When reusing authenticated browser sessions established by a human, use a dedicated low-privilege profile — not the user's personal browsing profile. Confirm with the user before performing account-changing actions (password changes, payment, deletion, permissions) in a reused session. Restrict navigation to the sites needed for the task.