fix(flows): pin generated Claude agent model

Merged
KH
2mo ago
+160-27

Summary

Every executable agent step generated by the software-factory onboarding now carries an explicit CLI and model. The generator uses verified per-harness defaults:

  • Claude: claude-sonnet-5
  • Codex: gpt-5.6-sol
  • Cursor: gpt-5.6-sol-high
  • Grok: grok-4.7

Explicit per-step overrides still win. Changing an unavailable saved agent falls back to the selected agent and its generated default. Prototype agents now serialize model unconditionally, and default effective models no longer inflate custom_model telemetry.

This repairs failed Cloud v2 run b5d6ab22-caee-58c5-a1c7-4c02d4aa9e26: deterministic steps completed, then agent-3 was refused before execution because the generated Slack Simple source omitted model. Relayflows correctly inherited and probed Claude's adapter default, claude-opus-5, which that connected credential could not use.

Failed run: https://agentrelay.com/cloud/dashboard/workflow/b5d6ab22-caee-58c5-a1c7-4c02d4aa9e26/runner

Contract

  • Preserve Relayflows' fail-closed exact (cli, model) readiness probe and its actionable refusal.
  • Preserve explicit user overrides; the runtime still proves those exact pairs.
  • Materialize a model for every generated Simple, Traditional, and Prototype agent, including conditional discovery, repair, fixer, adversary, and prototype branches.
  • Preserve Cloud/local and GitHub/Slack generation parity.
  • Keep the enabled-agent default map exhaustive so a new enabled harness cannot silently restore omission.

Regression coverage

The invariant matrix enumerates:

  • workflows: Simple, Traditional, Prototype
  • targets: Cloud, local kit
  • sources: GitHub, Slack
  • selections: Claude; Codex; Claude + Codex; Cursor; Grok

Across all 60 variants it executes failure/repair/review paths with a capturing f.agent, asserts every observed pair matches the generator contract, and independently parses every emitted f.agent object with the TypeScript AST to require literal cli and model fields. Separate assertions cover Cloud handoff/local-kit preservation, explicit overrides, malformed persisted models, unavailable saved agents, and the third Simple agent from the failed topology.

Exact-head verification

Head: cadc1cd32a267c881c5bae1638b79d3f46e70aa4

  • related generator/preview suites: 5 files, 155 passing
  • full web suite: 32 files, 317 passing
  • router suite: 5 files, 72 passing
  • npm run build: passing (Next.js compile, TypeScript, 459 static pages)
  • git diff --check origin/main...HEAD: passing
  • Claude claude-sonnet-5: used by current Flows canonical fixtures and exact readiness round-trip exit 0
  • Codex gpt-5.6-sol: used by the current Flows real-adapter contract and exact readiness round-trip exit 0. The similarly named gpt-5.6-codex control returned HTTP 400 as unsupported for this ChatGPT-account Codex credential, so it is deliberately not used here.
  • Cursor gpt-5.6-sol-high: present in the live account catalog and exact readiness round-trip exit 0
  • Grok grok-4.7: named as the live CLI catalog default; the exact request reached the provider but returned HTTP 402 because this local credential's usage balance is exhausted. That proves the literal is recognized, not that this credential can execute it. Relayflows therefore remains responsible for the exact credential/model readiness check and will fail closed before agent work.

The accepted incident-minimal first commit is patch-identical to tested handoff 47f6315 (stable patch-id 5e28a962e6c12bb8af9f5612f574abc3c2d94cba). Review findings led to a deliberate split between blank editable overrides and explicit generated models: prompt-only edits keep telemetry and persistence clean, while executable source and previews show the current pinned model.

Rollout / rollback

Rollout is the normal reviewed PR path; this PR does not deploy. Roll back by reverting the PR commits, which restores adapter-default inheritance and would reintroduce the reported Claude refusal.

Follow-up train

Flows first-party sources and Cloud recommended-catalog/model-persistence paths contain the same omission class and require ordered follow-up PRs. This PR does not weaken or globally change the Relayflows adapter contract.