Skip to content

feat(harness): model catalog, connection test, edit matrix in the create/edit wizard (PHNX-2218) - #3293

Merged
muqsitnawaz merged 3 commits into
mainfrom
phnx-2218-harness-wizard
Aug 30, 2026
Merged

feat(harness): model catalog, connection test, edit matrix in the create/edit wizard (PHNX-2218)#3293
muqsitnawaz merged 3 commits into
mainfrom
phnx-2218-harness-wizard

Conversation

@muqsitnawaz

Copy link
Copy Markdown
Contributor

Lands the harness create/edit wizard cluster — PHNX-2218 (parent) and its three open subtasks PHNX-2220 / 2221 / 2222 — by filling the typed no-op seams the RUSH-2219 wizard scaffold (harness-wizard.ts) shipped. One worktree, built in ticket order.

What each ticket delivered

  • PHNX-2220 — param surface + model catalog. The model step is a catalog pick from the host's own getModelCatalog (same list behind agents models <host>) with a tier/alias hint and an always-present "type a custom model id…" escape hatch; a host with no probeable catalog falls back to free text. The endpoint step is gated to hosts that carry a base-URL slot. New src/commands/harness-hooks.ts implements the pickModel hook (+ pure buildModelChoices), passed into both wizard runs.
  • PHNX-2221 — pre-save connection test. New src/lib/harness-connection-test.ts runs a real agents run <name> "say alive in one word" --headless --timeout 60s through the live path (resolveProfileForRun -> resolveProfileEnv -> buildExecEnv -> spawn) and classifies the outcome into pass / auth / endpoint / model / unknown. Behind a confirm (default yes) with --test / --no-test; non-interactive skips unless --test. A failure never blocks silently — on a TTY it offers keep / edit now / delete-and-cancel.
  • PHNX-2222 — editability matrix. harnessEditable(host) is sourced entirely from the resolver maps (baseUrlEnvKeyForHost / authEnvKeyForHost / isSelfUpdatingAgent), each disabled field carrying its reason; defaultEditable is now its boolean projection, so the wizard enable/disable can never drift from what a run honors.

Run evidence

Real connection test on the live path (fresh HOME, claude unresolvable -> classified + non-interactive keep+hint):

$ agents harness add corp --host claude --model gpt-x --base-url http://127.0.0.1:1/v1 --test
Harness 'corp' added — claude + gpt-x.
Testing 'corp' — sending "say alive in one word" through agents run…
Run failed (exit 1). (Resolved custom harness 'corp' -> claude)
Kept anyway. Fix and retest with: agents harness edit corp

Endpoint gating (opencode carries no base-URL slot, not asked/dropped):

$ agents harness add spark --host opencode --model meta/muse-spark-1.1 --no-test
Harness 'spark' added — opencode + meta/muse-spark-1.1.

Tests

  • src/lib/harness-connection-test.test.ts — classifier maps real provider stderr -> auth / model / endpoint / unknown / pass.
  • src/commands/harness-hooks.test.ts — catalog -> select choices (escape hatch, keep-current, tier/alias hints).
  • src/commands/harness-wizard.test.ts — extended for harnessEditable.
  • Full suite running on a fleet worker.

Docs: cli/docs/profiles.md + CHANGELOG fragment cli/.changelog/next/PHNX-2218.md.

Closes PHNX-2220, PHNX-2221, PHNX-2222; advances PHNX-2218.

Generated with Claude Code

Muqsit and others added 2 commits August 29, 2026 23:16
…ard (PHNX-2218)

Fills the three remaining seams the RUSH-2219 wizard scaffold left open, landing
the full interactive create/edit surface for `agents harness`:

- PHNX-2220 param surface + model catalog: the model step is a catalog pick from
  the host's own `getModelCatalog` (with a free-text escape hatch + fallback);
  the endpoint step is gated to hosts that carry a base-URL slot. Wired via a new
  `harness-hooks.ts` `pickModel` hook, passed into the wizard runs.
- PHNX-2221 connection test: a shared `harness-connection-test.ts` runs a real
  `agents run <name> "say alive in one word" --headless --timeout 60s` through the
  live resolution path and classifies the result (pass / auth / endpoint / model
  / unknown). Behind a confirm with `--test`/`--no-test`; on failure a TTY offers
  keep / edit / delete, never a silent block.
- PHNX-2222 editability matrix: `harnessEditable(host)` sourced entirely from the
  resolver maps (baseUrl/auth env keys + isSelfUpdatingAgent), each disabled field
  carrying its reason; `defaultEditable` is now its boolean projection so they
  can't drift.

Docs (profiles.md) + CHANGELOG updated; new unit tests for the classifier, the
catalog choice builder, and the matrix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…view follow-up)

Addresses the code-reviewer CHANGES-REQUESTED findings on PR #3293:

- Extract the tri-state connection-test decision into a pure exported
  `connectionTestGate(testFlag, interactive)` and unit-test all six cases
  (--test/--no-test forced on/off, TTY-ask, non-interactive skip).
- Extract `chooseModelFromCatalog` from `pickModel` and export both; test the
  pick / keep-current / custom-id branches with a scripted IO, plus pickModel's
  no-host free-text fallthrough.
- Doc callout: a --test failure in a non-interactive shell warns and keeps
  (exit 0), not a hard CI gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@muqsitnawaz

Copy link
Copy Markdown
Contributor Author

Non-author review — code-reviewer subagent (prix-cloud paused per #1767)

Verdict: APPROVE

Reviewed the full diff vs origin/main against cli/CLAUDE.md §Code review conventions and the ticket intent.

Clean on the substance:

  • harnessEditable is sourced entirely from the resolver maps (baseUrlEnvKeyForHost / authEnvKeyForHost / isSelfUpdatingAgent); defaultEditable is a pure projection — no lying/hardcoded capability table. Pinned against MANAGED_AGENT_IDS in tests.
  • The connection-test classifier is exhaustively tested against real provider error shapes (auth / model / endpoint / unknown / pass).
  • Base-URL step fails loud / disables-with-reason at the boundary rather than silently dropping.
  • connectionTestStep()'s permanent skip is intentional (superseded by runConnectionTest, wired at both call sites), not a stub.
  • Docs (cli/docs/profiles.md) + CHANGELOG (cli/.changelog/next/PHNX-2218.md) in sync with behavior.

First round was CHANGES REQUESTED on two test-coverage gaps (the tri-state --test/--no-test gate and the pickModel wiring). Both resolved in a17520318 by extracting pure exported functions (connectionTestGate, chooseModelFromCatalog, pickModel) with real unit tests, plus a doc callout for the non-interactive --test behavior. All 74 harness tests pass.

Non-blocking residual: pickModel's "host known but catalog empty" branch and catalogVersionFor remain untested — thin wiring already covered indirectly; not worth another round.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@muqsitnawaz
muqsitnawaz merged commit fd8479a into main Aug 30, 2026
9 checks passed
muqsitnawaz pushed a commit that referenced this pull request Aug 30, 2026
…view follow-up)

Addresses the code-reviewer CHANGES-REQUESTED findings on PR #3293:

- Extract the tri-state connection-test decision into a pure exported
  `connectionTestGate(testFlag, interactive)` and unit-test all six cases
  (--test/--no-test forced on/off, TTY-ask, non-interactive skip).
- Extract `chooseModelFromCatalog` from `pickModel` and export both; test the
  pick / keep-current / custom-id branches with a scripted IO, plus pickModel's
  no-host free-text fallthrough.
- Doc callout: a --test failure in a non-interactive shell warns and keeps
  (exit 0), not a hard CI gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@muqsitnawaz
muqsitnawaz deleted the phnx-2218-harness-wizard branch August 30, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant