Skip to content

feat(providers): add the AICraft OpenAI-compatible provider template (#6171) - #6288

Closed
Hmbown wants to merge 5 commits into
mainfrom
integration/aicraft-6171-20260916
Closed

Hmbown wants to merge 5 commits into
mainfrom
integration/aicraft-6171-20260916

Conversation

@Hmbown

@Hmbown Hmbown commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Lands @BX166's contribution from #6171. Their two commits are here verbatim,
with their authorship intact — this branch exists only because the fix below
could not be pushed to their fork.

What this adds

An AICraft (aicraftapi.com) OpenAI-compatible provider setup template,
following the descriptor-row pattern already used by SenseNova, Baseten, Groq,
Cerebras and Command Code: four consts plus one
ProviderSetupApply::Compatible row, inserted before the unpublished agnes
entry, with the two touched unit tests updated and the row documented in
docs/PROVIDERS.md.

No new enum variant and no compiled model roster — live GET /v1/models and the
Codewhale catalog remain the offering list.

Why an integration branch

Their PR's required Lint check was red on Check formatting: once aicraft
joins the tuple in hosted_openai_compat_hosts_are_templates_not_enum_variants
the line exceeds the width, so cargo fmt --all -- --check wants it wrapped.
Six lines, entirely mechanical.

maintainerCanModify is true on #6171, but pushing the fix to
BX166/Codewhale returned 404, so per AGENTS.md ("when the push is refused,
land the resolved merge on integration/<topic>-<pr>-<date> and land from
there") it lands here instead. Their branch is untouched.

Their CI had also never run at all: as a first-time contributor, every run sat
at action_required from Sept 14 until approved today, and the approval has to
be repeated on each new commit. That is a repo setting, not anything they did.

Verification

  • rustfmt --edition 2024 --check clean on the merged
    crates/config/src/provider_templates.rs
  • Their branch was updated from current main first, so this carries today's
    release work rather than a five-day-old base

Closes #6171

BX166 and others added 4 commits September 14, 2026 19:46
Once `aicraft` joins the tuple in
`hosted_openai_compat_hosts_are_templates_not_enum_variants` the line exceeds
the width, so `cargo fmt --all -- --check` rejected it and the required Lint
check stayed red.

Applied by a maintainer rather than sent back as a review round-trip. The
contribution is unchanged; only its formatting. Pushing to the fork was refused
despite maintainerCanModify, so this lands on an integration branch per
AGENTS.md.
Copilot AI lite review requested due to automatic review settings September 16, 2026 19:03
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@claude

claude Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Hmbown's task in 5m 28s —— View job


Reviewing PR #6288

  • Gather context (diff, files)
  • Review crates/config/src/provider_templates.rs changes
  • Review docs/PROVIDERS.md changes
  • Check test updates
  • Cross-check the parallel provider_descriptors.json / pricing coverage registry
  • Post findings

Summary

The AICraft descriptor row follows the existing SenseNova/Baseten/Groq/Cerebras
pattern cleanly: dedicated consts, a ProviderSetupApply::Compatible row
inserted before the unpublished agnes entry, both touched unit tests updated,
and docs/PROVIDERS.md kept in sync. Attribution is intact (31501a8,
936f1e8 by BX166; the 3f71635 fmt fix is a separate Hunter Bown commit).
No new ProviderKind variant, no compiled model roster — consistent with the
module's stated intent that live GET /v1/models and the Codewhale catalog
stay the offering list. Good adherence to rung 2 (reuse existing descriptor-row
shape rather than inventing a new mechanism).

Finding: new shipped default silently skips the pricing-coverage safety net

There is a second, parallel registry of the same "named OpenAI-compatible
custom route" concept: crates/config/assets/provider_descriptors.json
(consumed by crates/config/src/descriptors.rs). Every other Compatible
row in provider_templates.rssensenova, baseten, groq, cerebras,
command-code — has a matching entry there. AICraft does not.

That JSON is exactly what
shipped_default_routes_have_reviewed_pricing_coverage
(crates/tui/src/pricing/default_coverage_tests.rs:95) iterates to make sure
every shipped default host+model gets a reviewed pricing/billing-mode
disposition, recorded in default_coverage_unpriced.json (see the
unknown_billing_basis group, which lists cerebras/command-code/dashscope/
groq/sensenova explicitly). The test even pins the compatible-default count
with assert_eq!(defaults.len() - built_in_count, 6, ...)
(default_coverage_tests.rs:126) as a deliberate "review this when breadth
changes" receipt.

Because AICraft isn't in provider_descriptors.json, that receipt never
fires for it — a beginner who picks the new AICraft template and its default
model claude-4.6-sonnet gets a live, selectable default that has never gone
through the pricing/billing-mode review this test exists to enforce. This
isn't a compile-time or CI failure (nothing cross-checks the two lists), so
it's easy to miss — and docs/PROVIDERS.md itself never mentions
provider_descriptors.json, so there's no documented signal that a second
file needs touching for a "beginner template" PR.

Suggested fix: add an aicraft entry to
crates/config/assets/provider_descriptors.json (mirroring the base URL/
model/env already in provider_templates.rs), then add the matching
["aicraft", "claude-4.6-sonnet", "https://aicraftapi.com/v1", "chat_completions", "unknown"]
(or whatever billing mode is actually correct after review) row to
crates/tui/src/pricing/default_coverage_unpriced.json, and let
default_coverage_tests.rs's hardcoded counts move from 6 → 7 as the
intended "review changed" signal.

Fix this →

Other checks (no issues found)

  • Route/prefix safety: default model claude-4.6-sonnet is only ever
    used as a plain Chat Completions wire id here; grepped for "claude"-prefix
    based wire/provider inference in crates/config/src and crates/tui/src
    and found none — no risk of this string being misread as an Anthropic-wire
    signal.
  • Formatting: the module doc comment line and the multi-line test tuple
    are both within normal width; I could not execute cargo fmt --all -- --check
    or cargo test directly in this sandbox (Bash commands beyond basic
    git/read-only ones require approval I don't have here), so formatting/test
    execution should still be confirmed by CI before merge.
  • No dead code, no needless cloning, no secret-handling concerns — this is a
    pure data-row addition.

@claude

claude Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Hmbown's task in 1m 43s —— View job


Reviewing PR #6288

  • Gather context (diff, files)
  • Re-check whether prior finding (pricing-coverage registry) still applies
  • Review updated diff for correctness/provider-safety/reuse/tests
  • Post findings

Summary

Re-checked the branch as of 34e8a59. The provider_templates.rs / docs/PROVIDERS.md diff is unchanged in substance from the version already reviewed: dedicated consts, a ProviderSetupApply::Compatible row inserted before the unpublished agnes entry, both touched unit tests updated (settings_value_names_fillable_then_unpublished, the alias-lookup loop), and the doc table kept in sync. The module doc comment line (provider_templates.rs:9) that names AICraft alongside SenseNova/Baseten/Groq/Cerebras/Command Code is under rustfmt's line-length concern for comments — no formatting issue there or in the new guidance string. No new ProviderKind variant, no compiled roster, no provider/model inferred from the claude-4.6-sonnet wire id — it's used only as a plain Chat Completions literal, never pattern-matched for routing.

Finding: pricing-coverage safety net still doesn't see AICraft (unaddressed from prior review)

This still stands and nothing in the current diff touches it:

  • crates/config/assets/provider_descriptors.json (consumed by bundled_provider_descriptors() in crates/config/src/descriptors.rs) has no aicraft entry, even though every other Compatible row in provider_templates.rssensenova, baseten, groq, cerebras, command-code — has a matching one there.
  • shipped_default_routes_have_reviewed_pricing_coverage (crates/tui/src/pricing/default_coverage_tests.rs) builds its compatible-default set only from bundled_provider_descriptors() (lines 95–118), not from provider_templates.rs::TEMPLATES. Confirmed by reading the loop: it never iterates compatible_provider_setup_templates(), so a Compatible row that exists solely in provider_templates.rs is invisible to it.
  • The hardcoded receipt at default_coverage_tests.rs:126 (assert_eq!(defaults.len() - built_in_count, 6, "review compatible-default breadth")) is unchanged at 6 — proof the new AICraft default never entered the reviewed set.

Net effect: a user who picks the new AICraft template gets a live, selectable default (claude-4.6-sonnet @ https://aicraftapi.com/v1) that has never gone through the pricing/billing-mode review this test exists to enforce, and no CI check cross-references the two lists to catch the gap.

Suggested fix (unchanged from prior review): add an aicraft entry to crates/config/assets/provider_descriptors.json mirroring the base URL/model/env already in provider_templates.rs, add a matching reviewed exemption row to crates/tui/src/pricing/default_coverage_unpriced.json (e.g. under unknown_billing_basis, alongside cerebras/command-code/dashscope/groq/sensenova, once the actual billing mode is confirmed), and bump the 6 → 7 assertion in default_coverage_tests.rs:126 so the test's "review changed" signal actually fires for this addition.

Fix this →

Other checks (no issues found)

  • Route/prefix safety: claude-4.6-sonnet is only ever a plain Chat Completions wire id here; no code path pattern-matches a claude-/model-name prefix to infer provider selection.
  • Reuse: the new row follows the exact descriptor-row shape already used for SenseNova/Baseten/Groq/Cerebras/Command Code — no new mechanism introduced (good rung-2 adherence).
  • Tests: the two tests that needed updating for the new template (settings_value_names_fillable_then_unpublished, the alias-lookup table) were updated correctly. No alias entries were needed for aicraft (direct id match, consistent with groq/cerebras).
  • Security: no secret handling changes; this is a pure data-row addition. AICRAFT_API_KEY env var name, not a raw key, matches the pattern of the other rows.
  • I could not execute cargo fmt --all -- --check, cargo test, or awk/shell length checks directly in this sandbox (Bash beyond basic git/read-only commands requires approval I don't have here); line-length review above was done by reading the diff and grepping for long lines instead.

@Hmbown

Hmbown commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #6289. Closing the integration branch too — see the note on #6171.

@Hmbown Hmbown closed this Sep 16, 2026
@Hmbown
Hmbown deleted the integration/aicraft-6171-20260916 branch September 16, 2026 19:12

@codewhale-agent codewhale-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Codewhale review

Complete review coverage: 1/1 passes, 2 file patches, sha256:8951e750a699a4cbcd3dffc58fbfa16925c558f011fd0f1e0fa605ceb51bd3a1.

Pass 1: Mechanical addition of an AICraft OpenAI-compatible template row (four consts + one ProviderSetupApply::Compatible entry) plus the matching test-string update and a docs table row. By inspection the diff is internally consistent: constants match the descriptor row, the new row sits before agnes, the settings_value() expectation includes aicraft in the same order the templates are declared, the new tuple in hosted_openai_compat_hosts_are_templates_not_enum_variants matches the declared consts, and the docs/PROVIDERS.md row mirrors the descriptor (AICraft, https://aicraftapi.com/v1, claude-4.6-sonnet, AICRAFT_API_KEY). No defect was demonstrated from the supplied evidence.

Assessment

Pass 1: No defect is demonstrable from the supplied diff and context. The added consts (AICRAFT_TEMPLATE_ID = "aicraft", base URL ending in /v1, non-empty default model, AICRAFT_API_KEY) satisfy every invariant the surrounding code and visible tests assert about fillable compatible rows: https host, Some(default_model), Some(api_key_env), id not shadowing an alias (zen/opencodezen/opencodego/sense-nova/base-ten/commandcode/cmd-code), and the row is placed so the partition-based settings_value() string is "opencode-zen, opencode-go, sensenova, baseten, groq, cerebras, command-code, aicraft; agnes unpublished", exactly what the updated assertion expects. The docs/PROVIDERS.md row is column- and order-consistent with the descriptor list and with the doc-comment list updated in the same commit. Open questions that this review could not resolve because the files are outside the supplied scope, and that should be checked before merging: (1) no build, test or lint run was performed here, so the assertion in the new tuple that ProviderKind::parse("aicraft") is None (and compatible_template_ids_do_not_shadow_built_ins) depends on crates/config/src/provider_kind.rs, which was not inspected; (2) whether any snapshot/assertion outside this module (e.g. in crates/tui/src/config.rs, crates/agent/src/lib.rs, or config.example.toml/docs/CONFIGURATION.md) hardcodes the previous settings_value() string, the template count, or the compatible-template id list, and would now fail; (3) whether scripts/check-provider-registry.py or the repository's docs-parity rule requires the same template row in docs/zh_hans/PROVIDERS.md, which this diff does not touch; (4) the credential_url for AICraft points at the site root rather than a key-management page as Groq/Baseten/Command Code do — a usability nit at most, not a defect, and not worth a finding on its own.


Advisory review by Codewhale (codewhale review --pr 6288 --post, head 34e8a5953fefc3c6c3140aae3b53839a4b1e2c7f). Line-specific findings are also posted as inline review comments; mechanical fixes arrive as committable suggestions you can apply from the Files tab. CODEOWNERS approval still governs merge.

Hmbown pushed a commit that referenced this pull request Sep 17, 2026
…6289)

Slice 1 of the template removal: hosted Chat Completions backends are
ordinary named [providers.<name>] tables now, so the vendor list becomes
documentation (base URLs, example models, key envs) instead of compiled
rows. AICraft joins the table per #6171/#6288 with its advertised model
families and no Anthropic default, per the issue.

Gate: codewhale-config provider_templates 9 passed 0 failed (doc-drift
test still green).
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.

3 participants