Skip to content

Commit 182af6b

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr-388
2 parents 95f1a8c + 9b67a95 commit 182af6b

4 files changed

Lines changed: 38 additions & 5 deletions

File tree

‎docs/operating.md‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ user-owned profile file in the catalog root:
200200
{"schemaVersion":1,"defaultProfile":"my-route","profiles":{"my-route":{"routes":{"evidence-auditor":{"pi":{"provider":"nan","model":"glm5.3","effort":"high"}}}}}}
201201
```
202202

203+
Routes are keyed by role and then by backend token (`pi`, `claude`, `opencode`); a
204+
`qa run --backend <b>` reads only the `<b>` entry, and a role without one is refused
205+
as `route_incomplete` with a `route_missing_backend=<b>` line and a `qa setup ... --backend <b>` remedy. `qa setup`
206+
writes these entries for you.
207+
203208
Location: `<catalog-root>/cortex/qa-profiles.json` (mode 0600, regular file). The
204209
`defaultProfile` applies to every `qa run` without a `--profile` flag; pass
205210
`--profile <id>` to select another profile for one run. The three optional flags
@@ -302,14 +307,20 @@ run looks like, and where it currently stops:
302307
when the probe's verdict carried one, and is not a per-run profile check.
303308
2. **Configure the route.** The fleet ships no models, so pick a provider/model pair
304309
from the runtime's extension-free surface and run
305-
`cortex qa setup --catalog <catalog-root> --provider <p> --model <m>`. Relative and
310+
`cortex qa setup --catalog <catalog-root> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]`.
311+
On a machine whose pi backend is unavailable, pass `--backend claude` or
312+
`--backend opencode`; without `--backend` the route is written for `pi`. Relative and
306313
absolute roots are both accepted: the command resolves the path before it writes,
307314
so `qa setup --catalog catalog` and `qa run --catalog catalog` from the same
308315
directory address the same file (#324). The root must already exist and contain
309316
`catalog.json`; `qa setup` validates it before probing models and refuses to create
310317
the tree, so a typo fails instead of writing a profile no run reads. `qa setup`
311-
writes `<catalog>/cortex/qa-profiles.json` with one route per fleet role,
312-
pi-backend scoped (#328).
318+
writes `<catalog>/cortex/qa-profiles.json` with one route per fleet role for the
319+
selected backend and preserves routes already configured for other backends, so
320+
running it once per backend routes the whole fleet on each (#328). Only the `pi`
321+
pair is checked against the runtime's model table at setup; a `claude` or
322+
`opencode` pair is written as given and an unavailable model is refused at the
323+
run's `model_probe` preflight. `--effort` defaults to `high`.
313324
3. **Run one role with evidence.** Write a short bounded `request.txt`, then:
314325

315326
```sh

‎internal/cli/doctor.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func doctorPriorStateBlocker(resolveRoots func() ([]skillroot.UninstallRoot, err
246246

247247
const (
248248
qaUsage = "usage: cortex qa run --role <role> --request <file> --catalog <dir> [--backend pi|claude|opencode] [--evidence <file.json>] [--profile <id>]\n" +
249-
"usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--effort <e>]\n"
249+
qaSetupUsageLine
250250
qaHelp = qaUsage + "\nQA evaluates evidence and does not run tests.\n" +
251251
"Write a short, bounded plain-text request (request.txt):\n" +
252252
"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" +

‎internal/cli/qa_test.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,24 @@ func TestQAHelpDocumentsEvidenceSidecarSchema(t *testing.T) {
342342
}
343343
}
344344

345+
func TestQAHelpDocumentsSetupBackendLikeSetupUsage(t *testing.T) {
346+
const setupLine = "usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]\n"
347+
help, helpErr := &bytes.Buffer{}, &bytes.Buffer{}
348+
if code := Run(context.Background(), []string{"qa", "--help"}, help, helpErr, nil); code != exitOK || helpErr.Len() != 0 {
349+
t.Fatalf("qa --help exit=%d stderr=%q", code, helpErr)
350+
}
351+
if !strings.Contains(help.String(), setupLine) {
352+
t.Fatalf("qa --help = %q, want setup usage %q", help, setupLine)
353+
}
354+
setupOut, setupErr := &bytes.Buffer{}, &bytes.Buffer{}
355+
if code := Run(context.Background(), []string{"qa", "setup"}, setupOut, setupErr, nil); code != exitUsage || setupOut.Len() != 0 {
356+
t.Fatalf("qa setup exit=%d stdout=%q", code, setupOut)
357+
}
358+
if !strings.HasSuffix(setupErr.String(), setupLine) {
359+
t.Fatalf("qa setup stderr = %q, want setup usage %q", setupErr, setupLine)
360+
}
361+
}
362+
345363
func TestQARunHonorsRouteProfileFromCatalog(t *testing.T) {
346364
args := disposableCatalogArgs(t, roleReportFixture(t, "requirements-analyst"))
347365
var catalogRoot string

‎internal/cli/qasetup.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ func runQASetup(ctx context.Context, args []string, stdout, stderr io.Writer) in
100100
return exitOK
101101
}
102102

103+
// qaSetupUsageLine is the single setup usage line shared by the setup refusal
104+
// and qa --help, so both surfaces name --backend identically (#336).
105+
const qaSetupUsageLine = "usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]\n"
106+
103107
func qaSetupUsage(stderr io.Writer) int {
104108
writeError(stderr, "invalid_arguments")
105-
_, _ = io.WriteString(stderr, "usage: cortex qa setup --catalog <dir> --provider <p> --model <m> [--backend pi|claude|opencode] [--effort <e>]\n")
109+
_, _ = io.WriteString(stderr, qaSetupUsageLine)
106110
return exitUsage
107111
}
108112

0 commit comments

Comments
 (0)