Skip to content

feat(core)!: require documented Provider API access - #164

Open
patlux wants to merge 2 commits into
mainfrom
require-provider-api-access
Open

patlux wants to merge 2 commits into
mainfrom
require-provider-api-access

Conversation

@patlux

@patlux patlux commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Breaking change — separate review/release decision

Remove automatic /alpha/generate fallback when the documented Provider API responds with 403 upgrade_required. The official provider docs exclude Go API use; an internal CLI endpoint must not silently bypass that restriction. Related policy concern: #5.

  • Keep requests on the documented Provider API; produce a static actionable entitlement error for both host error events and rejected iterators. Diagnostics still receive the denied HTTP status.
  • Remove the generate dependency from the installed extension entrypoint and the sticky fallback state. Legacy low-level converter/core fixtures remain for now, but are not reachable from the registered provider; no opt-in bypass is added.
  • Preserve sessions/auth data. README/changelog describe account/plan migration or using the official CLI within its supported plan.
  • Remove the unsupported Go live profile. Both real-host mock suites assert exactly one denied provider request and zero generate retries; OMP advisory history is now checked on the provider wire.

Verification

  • Full npm test with Pi 1.1.0 and OMP 18.11.1 required: PASS.
  • Packed artifact installation and both real-host mock suites: PASS.
  • Typecheck, formatting and diff checks: PASS.
  • Unit coverage: repeated denials/key changes, emitted/rejected host errors, status callback, unrelated/malformed errors and abort classification.
  • No real account probes or paid model calls.

Based on current main including #154; this intentionally supersedes fallback behavior rather than duplicating its robustness fix. Keep this separate from a routine patch release: no version bump, tag, merge or npm publication is performed. Routing/diagnostics PRs #158/#159 remain separate and will need their small transport-adjacent overlap reconciled at integration.

BREAKING CHANGE: remove automatic internal generate fallback for accounts without Provider API access. Preserve sessions and credentials; provide explicit entitlement migration guidance.
@patlux patlux self-assigned this Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

Copy link
Copy Markdown
Contributor

Memory benchmark

Compared base 3e43a7c with PR head db13084 on the same GitHub-hosted darwin runner. Lower values are better.

Metric Base PR PR − Base Change
Stable RSS 120.7 MiB ± 1.0 MiB 120.6 MiB ± 1.2 MiB +0.4 MiB ± 1.4 MiB +0.3%
Physical footprint 66.5 MiB ± 1.4 MiB 66.4 MiB ± 0.4 MiB -0.0 MiB ± 1.5 MiB -0.0%
Physical peak 78.1 MiB ± 1.4 MiB 77.2 MiB ± 0.4 MiB -0.1 MiB ± 1.2 MiB -0.2%

Interpretation: No metric shows a clear Base-to-PR difference beyond its measured run-to-run variation.

Extension overhead above pi baseline

Metric Base overhead PR overhead Difference
Stable RSS +7.8 MiB ± 1.2 MiB +7.5 MiB ± 1.7 MiB +0.4 MiB ± 1.4 MiB
Physical footprint +4.9 MiB ± 1.5 MiB +4.6 MiB ± 1.4 MiB -0.0 MiB ± 1.5 MiB
Physical peak +7.1 MiB ± 0.5 MiB +6.4 MiB ± 1.7 MiB -0.1 MiB ± 1.2 MiB

Values are medians of 6 alternating, paired runs. The value after ± is the median absolute deviation (MAD). Each process was sampled 12 times after a 2500 ms warm-up.

Environment: pi 0.84.4, Bun 1.4.0, darwin arm64. RSS comes from ps; physical footprint and peak come from macOS footprint.

This is a comparative signal, not a pass/fail threshold. GitHub-hosted runner noise can affect absolute values.

@patlux patlux left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direction is right given #5, and the transport/test changes are clean (one request, no fallback, same message for emitted and rejected errors, abort classification). Three things I'd want resolved before this ships as 0.8.0:

  1. The generate client is still in the package (see index.ts comment).
  2. README is written as a proposal, but README is what npm renders for the released version (see README comments).
  3. The "documented Provider API only" principle stops at inference; quota still uses /alpha/* (see README comment).

Also: pre-1.0 breaking → 0.8.0, not a patch. Please note the intended version in the PR so the release PR doesn't ship it as 0.7.9.

Comment thread index.ts
import { pickCommandCodeApiKey, withResolvedCommandCodeApiKey } from "./src/converters.ts"
import { createStreamCommandCode } from "./src/core.ts"
import { calculateCommandCodeCost, commandCodeCostRatesAt } from "./src/cost.ts"
import { commandCodeCostRatesAt } from "./src/cost.ts"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generate client stays in the shipped package: src/core.ts (836 lines), src/transcript.ts, the converter paths and their tests remain, and files: ["src/"] publishes them. For a breaking change whose rationale is "do not touch the internal endpoint", shipping an unreachable /alpha/generate client is contradictory, and it leaves ~1.3k lines that are tested but never run in production.

This is already a feat!; remove it here (plus tests/test-core*, converter/transcript tests, calculateCommandCodeCost if it becomes unused), or open the follow-up and make it a blocker for the 0.8.0 release.

Comment thread src/transport.ts
const requestApiKey = options?.apiKey
if (transport === "generate") return deps.streamGenerate(model, context, options)

transport = "provider"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transport = "provider" is now set before the request, so /commandcode-status shows transport: provider for a Go account that was just denied — exactly the users who will read that status after hitting the new error. Either set it only after the first non-denied event (as before), or drop the transport state entirely now that it has one real value.

Comment thread README.md

> **Disclaimer:** This is an unofficial, community-maintained integration. It is not affiliated with, endorsed by, or supported by Command Code. You need your own Command Code account, API key, and a plan with Provider API access. Command Code's terms, availability, and pricing apply.

## Breaking migration: Provider API access required

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README is what npm renders for the released version. "The next breaking release removes…" will be wrong the moment this is released, and the section sits above Install. Write it as the state of the code ("This extension requires Provider API access. 403 upgrade_required stops with …") and keep the unreleased/proposal status in CHANGELOG and the PR.

Comment thread README.md
2. After changing accounts, run `/login` again and reload the host. Existing sessions, credentials and model selections are not deleted or migrated by this change.
3. Retry a small request and check `/commandcode-status`. There is no switch to re-enable internal generation. Do not use alternate endpoint overrides to bypass plan restrictions.

GOAT/Provider accounts with API entitlement continue to use the same documented inference endpoints. Quota reporting is unchanged. This is a breaking-change proposal, not a claim that the version on npm already includes it.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things in this paragraph:

  • "This is a breaking-change proposal, not a claim that the version on npm already includes it." — same as above, this sentence must not land on main.
  • "Quota reporting is unchanged": /commandcode-quota and the usage provider still call /alpha/whoami, /alpha/billing/*, /alpha/usage/summary — the same undocumented surface Use Command Code Provider API Instead #5 complains about. The PR's principle ("documented Provider API only") is not applied there. If that is deliberate (read-only, no plan bypass), say so explicitly; if not, it belongs in the same breaking release rather than a second one.

Comment thread CHANGELOG.md

## Unreleased

### Breaking changes

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-1.0 breaking change → minor bump (0.8.0). Consider naming the target version here or in the PR so the release PR cannot accidentally ship it as a patch. (#163's RELEASE.md text says the same.)

@pierreraby pierreraby left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — on the implementation and, deliberately, on the product call. Verified locally at the exact head in an isolated worktree (npm ci): tsc --noEmit PASS, test-transport 17/17, full test:unit exit 0 (400 checks), test-pi-local + test-omp-compat PASS (incl. exactly-one-denied-provider-request / zero-generate-retries on both hosts), Prettier + git diff --check PASS. I also had this head independently reviewed in a fresh context (APPROVE): all seven checks verified — no path from the registered provider to /alpha/generate, 403 upgrade_required detection preserved for both emitted error events and rejected iterators, unrelated errors/429s/malformed bodies/aborts untouched, no denial caching across key changes, legacy fixtures unreachable, migration docs complete. The docs URL in the error (https://commandcode.ai/docs/provider) resolves (HTTP 200).

On the product decision: the ToS basis is solid (founder request in #5 with ban warning, official docs excluding the Go plan), and I agree with the hard cut over a bypass flag — a grace switch would prolong exactly the usage Command Code asked to stop. Two asks for the release: (1) say explicitly in the release notes that this supersedes #154, which 0.7.8 had just hardened — the whiplash deserves one honest sentence; (2) consider the four polish notes from review, chiefly wrapping the router's raw errorMessage in the shared redactor (small step back vs #155) and softening "then sign in again" to retry-first unless accounts changed.

This branch has not been deployed

No deployments
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.

2 participants