Skip to content

Move Claude, Codex and Grok behind the provider adapter contract (registry U1) #155

Closed

Description

@ericlitman

Goal

Move the Claude, Codex and Grok CLIs behind one provider adapter contract and a typed registry, with no behavior change. This is unit U1 of the approved model and provider registry design (design, PR #154, issue #103).

Scope

  • Add runner/registry/contract.ts (Lane, ProviderAdapter), registry/family.ts, registry/models.ts (FAMILIES, ROLE_DEFAULTS, RELEASED_PAIRS), registry/providers.ts (ADAPTERS, the only provider list) and registry/index.ts (resolveModel, resolveLane, defaultDescriptor). Paths are under plugins/pstack/skills/poteto-mode/scripts/runner/.
  • Add providers/{claude,codex,grok}.ts, providers/shared.ts and the shared adapter test suite.
  • Make run.ts and cli.ts provider-generic. Delete commands.ts, parse-output.ts and model-aliases.ts in the same change.
  • Add the default effort value (decision 5): a flag adapter omits its effort flag for default.
  • Families: today's four, plus kept predecessors codex:gpt-5.6-sol (efforts low to ultra) and grok:grok-4.6 (decision 3).
  • Set tsconfig.json include to ["**/*.ts"].

Acceptance criteria

  • Given today's valid Claude, Codex and Grok lanes and controlled timestamps, durations and paths, when the runner builds argv and receipts, then their serialization, field order and failure evidence are identical to main. The existing run.test.ts assertions and argv tests pass; only lane construction changes, through resolveLane.
  • Two behavior changes are intended: the resolver rejects an effort that a registered family does not list, where cli.ts accepts any effort in the global list today, and default becomes a valid effort.
  • Given an unregistered (provider, model) pair, when the runner runs it, then the pair passes to the CLI unchanged, as today (decision 2).
  • Given a versioned claude-opus-<revision> that the parent did not normalize, when the runner receives it, then it refuses with today's message.
  • run.ts contains no child-provider branch; the parent sandbox diagnostic stays. Outside providers/, only registry/providers.ts imports providers/* (import-boundary test).
  • Every released pair resolves to its recorded family (RELEASED_PAIRS test).
  • No implicit timeout, no weaker-model fallback, no model-execution retry. The Grok preflight keeps its one bounded retry.
  • Bun tests, strict typecheck, static invariants and plugin validation pass.

Live checks (feature runner)

  • From a Claude Code parent: codex:gpt-6.1-sol@max, grok:grok-4.7@xhigh, the kept codex:gpt-5.6-sol@max, and the unregistered grok:grok-4.5@high passed through unchanged.
  • From a Codex parent: claude:opus@max, and one Claude isolated-write lane in a linked worktree, which proves the shared .git deny moved intact.

Verifier change

The writer live check needs a new linked-worktree writer case in .claude/skills/verify-open-pstack/features/recipes.ts, because the runner recipe asserts read-only. This makes the PR a verifier change: its live run uses the candidate head as publisher revision with --self-test, and it opens after #152 merges.

Order

First unit. U2 (#156) and U3 (#157) depend on it. Blocks #54, #69, #80, #71, #68 and #37.

Activity

  1. added
    enhancement
    on Oct 12, 2026
  2. ericlitman commented on Oct 12, 2026

    @ericlitman
    OwnerAuthor

    Design pass (2026-10-12, Astra high, read-only at 748a9bc)

    Record: ~/projects/docs/projects/open-pstack/records/2026-10-12-batch-153/design-155.md (private docs repo).

    Accepted

    • "No behavior change" has two named exceptions. Today cli.ts:99-101 accepts any effort in the global list. The resolver rejects an effort that a registered family does not list, and it adds default. Every lane that is valid today runs unchanged.
    • Receipt parity means identical serialization, field order and failure evidence for identical controlled inputs. Timestamps, elapsed time and paths are controlled in the tests. writerSandbox and providerSidecarPath are not added in U1. They belong to U7 and U5.
    • Released-pair resolution recognizes stale claude-fable-<revision> and claude-opus-<revision> pairs without making them runnable, as model-aliases.ts:9-14 and run.ts:700-705 do today.
    • Tests change where the contract changes: the effort-universe assertion gains default. Argv fixtures that build same-provider lanes get a valid parent and keep their argv assertions.
    • The import boundary covers production consumers outside providers/. Shared helpers and adapter tests inside providers/ may import each other.
    • run.ts keeps the parent's sandbox diagnostic (run.ts:746-747, 1032-1034). "No provider-name branch" applies to child providers.
    • The writer live check needs a recipe. The runner recipe asserts read-only (recipes.ts:248-254), so this PR adds one focused linked-worktree writer case. That makes U1 a verifier change. Its live run uses the candidate head as publisher revision with --self-test, and it opens after verify-open-pstack: accept only the resolver launcher in the Reflect recipe, and give the fixture openers equal length #152 merges, because both edit features/recipes.ts.

    Rejected

    • None.
  3. added a commit that references this issue on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions