Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions docs/operating.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ user-owned profile file in the catalog root:
{"schemaVersion":1,"defaultProfile":"my-route","profiles":{"my-route":{"routes":{"evidence-auditor":{"pi":{"provider":"nan","model":"glm5.3","effort":"high"}}}}}}
```

Routes are keyed by role and then by backend token (`pi`, `claude`, `opencode`); a
`qa run --backend <b>` reads only the `<b>` entry, and a role without one is refused
as `route_incomplete` with a `route_missing_backend=<b>` line and a `qa setup ... --backend <b>` remedy. `qa setup`
writes these entries for you.

Location: `<catalog-root>/cortex/qa-profiles.json` (mode 0600, regular file). The
`defaultProfile` applies to every `qa run` without a `--profile` flag; pass
`--profile <id>` to select another profile for one run. The three optional flags
Expand Down Expand Up @@ -293,14 +298,20 @@ run looks like, and where it currently stops:
when the probe's verdict carried one, and is not a per-run profile check.
2. **Configure the route.** The fleet ships no models, so pick a provider/model pair
from the runtime's extension-free surface and run
`cortex qa setup --catalog <catalog-root> --provider <p> --model <m>`. Relative and
`cortex qa setup --catalog <catalog-root> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]`.
On a machine whose pi backend is unavailable, pass `--backend claude` or
`--backend opencode`; without `--backend` the route is written for `pi`. Relative and
absolute roots are both accepted: the command resolves the path before it writes,
so `qa setup --catalog catalog` and `qa run --catalog catalog` from the same
directory address the same file (#324). The root must already exist and contain
`catalog.json`; `qa setup` validates it before probing models and refuses to create
the tree, so a typo fails instead of writing a profile no run reads. `qa setup`
writes `<catalog>/cortex/qa-profiles.json` with one route per fleet role,
pi-backend scoped (#328).
writes `<catalog>/cortex/qa-profiles.json` with one route per fleet role for the
selected backend and preserves routes already configured for other backends, so
running it once per backend routes the whole fleet on each (#328). Only the `pi`
pair is checked against the runtime's model table at setup; a `claude` or
`opencode` pair is written as given and an unavailable model is refused at the
run's `model_probe` preflight. `--effort` defaults to `high`.
3. **Run one role with evidence.** Write a short bounded `request.txt`, then:

```sh
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func doctorPriorStateBlocker(resolveRoots func() ([]skillroot.UninstallRoot, err

const (
qaUsage = "usage: cortex qa run --role <role> --request <file> --catalog <dir> [--backend pi|claude|opencode] [--evidence <file.json>] [--profile <id>]\n" +
"usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--effort <e>]\n"
qaSetupUsageLine
qaHelp = qaUsage + "\nQA evaluates evidence and does not run tests.\n" +
"Write a short, bounded plain-text request (request.txt):\n" +
"printf 'R1: Responses must finish within 100 ms.\\nR2: Responses must wait at least 500 ms.\\nIdentify the contradiction; do not edit files.\\n' > request.txt\n" +
Expand Down
18 changes: 18 additions & 0 deletions internal/cli/qa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,24 @@ func TestQAHelpDocumentsEvidenceSidecarSchema(t *testing.T) {
}
}

func TestQAHelpDocumentsSetupBackendLikeSetupUsage(t *testing.T) {
const setupLine = "usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]\n"
help, helpErr := &bytes.Buffer{}, &bytes.Buffer{}
if code := Run(context.Background(), []string{"qa", "--help"}, help, helpErr, nil); code != exitOK || helpErr.Len() != 0 {
t.Fatalf("qa --help exit=%d stderr=%q", code, helpErr)
}
if !strings.Contains(help.String(), setupLine) {
t.Fatalf("qa --help = %q, want setup usage %q", help, setupLine)
}
setupOut, setupErr := &bytes.Buffer{}, &bytes.Buffer{}
if code := Run(context.Background(), []string{"qa", "setup"}, setupOut, setupErr, nil); code != exitUsage || setupOut.Len() != 0 {
t.Fatalf("qa setup exit=%d stdout=%q", code, setupOut)
}
if !strings.HasSuffix(setupErr.String(), setupLine) {
t.Fatalf("qa setup stderr = %q, want setup usage %q", setupErr, setupLine)
}
}

func TestQARunHonorsRouteProfileFromCatalog(t *testing.T) {
args := disposableCatalogArgs(t, roleReportFixture(t, "requirements-analyst"))
var catalogRoot string
Expand Down
6 changes: 5 additions & 1 deletion internal/cli/qasetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ func runQASetup(ctx context.Context, args []string, stdout, stderr io.Writer) in
return exitOK
}

// qaSetupUsageLine is the single setup usage line shared by the setup refusal
// and qa --help, so both surfaces name --backend identically (#336).
const qaSetupUsageLine = "usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]\n"

func qaSetupUsage(stderr io.Writer) int {
writeError(stderr, "invalid_arguments")
_, _ = io.WriteString(stderr, "usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]\n")
_, _ = io.WriteString(stderr, qaSetupUsageLine)
return exitUsage
}

Expand Down
Loading