Inference connections and profiles
The inference document is deprecated for one release. A nonempty CODEHAWK_INFERENCE overrides provider and model routes in the default-branch settings file. Caps still come from that file. New installations should use Models and spend caps.
Settings map directly to this advanced document: provider and base_url select a connection, credential selects an optional slot, and model, reasoning_effort and price select a profile. jobs.<role> selects that role's profile and ordered fallbacks. Omitted roles use default. Standard provider secrets replace explicit slots when credential is omitted.
The trusted caller supplies one JSON document through the action/workflow inference input, mapped to CODEHAWK_INFERENCE. Direct providers work without Cloudflare. Keep keys in named secrets, never in JSON.
Start with one direct provider
Section titled “Start with one direct provider”Save this as the trusted CODEHAWK_INFERENCE repository or organisation variable. Replace your-model-id with an available OpenAI model id, and save its provider key as CODEHAWK_CREDENTIAL_1.
{ "version": 1, "connections": { "direct": { "type": "openai", "credential": 1 } }, "profiles": { "default": { "connection": "direct", "model": "your-model-id" } }, "default_profile": "default"}One profile handles every omitted role, with no role-by-role setup. Forward the variable and only the used secret:
with: inference: ${{ vars.CODEHAWK_INFERENCE }}secrets: CODEHAWK_CREDENTIAL_1: ${{ secrets.CODEHAWK_CREDENTIAL_1 }}That snippet is for a reusable inference workflow. Hosted tokens need no App ID or private key. See getting started. Composite actions instead take credential-1 in with.
A one-profile installation runs ordinary roles, including weekly find passes. It cannot independently confirm its own findings. Those findings remain unchecked in the summary and are never filed. There is no implicit second provider or built-in checker.
Mixed providers and ordered fallbacks
Section titled “Mixed providers and ordered fallbacks”Connections select a protocol and credential slot. Profiles select a connection, model and optional reasoning or price settings. Role chains try their primary profile followed by explicitly ordered fallbacks.
{ "version": 1, "connections": { "primary": { "type": "openai", "credential": 1 }, "second": { "type": "google", "credential": 2 }, "messages": { "type": "anthropic", "credential": 3 }, "compatible": { "type": "openai-compatible", "base_url": "https://models.example.com/v1", "credential": 4 } }, "profiles": { "default": { "connection": "primary", "model": "your-review-model", "reasoning_effort": "low" }, "checker": { "connection": "second", "model": "your-independent-check-model" }, "backup": { "connection": "messages", "model": "your-backup-model" }, "custom": { "connection": "compatible", "model": "vendor/model", "price": { "input": 2, "output": 8 } } }, "default_profile": "default", "roles": { "pr_review": { "profile": "default", "fallbacks": ["backup"] }, "weekly_confirm": { "profile": "checker", "fallbacks": ["custom"] }, "flows_driver": { "profile": "custom", "fallbacks": ["default"] } }}Use actual available model ids and approved prices. The example names and prices are not provider recommendations or a current price quote. A fallback receives the original prompt, not the previous profile's failed answer. Each profile retains the existing retry and one-repair limits. Exhausted 429/5xx, transport, timeout, unreadable response and unusable JSON failures can advance the chain. Missing credentials, invalid configuration, independent-confirmation failure, spend caps, redirects and ordinary 4xx stop immediately.
Roles and independent confirmation
Section titled “Roles and independent confirmation”| Role | Work |
|---|---|
pr_review |
Added-line review |
pr_summary |
Pull request summary |
pr_reply |
Answers in review threads and mentions |
weekly_security |
Weekly security finder |
weekly_bug |
Weekly bug finder |
weekly_confirm |
Independent check of each weekly finding |
fix_issues |
Fix and failing-first test generation |
flows_plan |
Select or write flows for the change |
flows_driver |
Browser action selection |
flows_diagnosis |
Links captured failed-flow evidence to supported added lines |
roles may be absent or empty. An omitted role uses default_profile with no fallbacks. Each configured role has exactly profile and optional fallbacks, with at most eight fallbacks and no duplicate profile in its chain.
Weekly checking excludes the actual successful finder profile, including a finder reached through fallback. It also excludes every profile with the same configured model string across all connections, including direct/gateway aliases. Merely renaming a profile or connection does not create independence. If two different model names refer to the same actual model, the trusted caller must keep them out of one another's confirmation chain. A chain with no independent profile produces an unchecked outcome without a request.
Connections and trusted endpoint rules
Section titled “Connections and trusted endpoint rules”| Type | Required fields beyond type |
Destination |
|---|---|---|
openai |
credential |
Fixed https://api.openai.com origin |
anthropic |
credential |
Fixed https://api.anthropic.com origin |
google |
credential |
Fixed https://generativelanguage.googleapis.com origin |
openai-compatible |
credential, base_url |
Approved HTTPS endpoint, with /chat/completions appended |
cloudflare |
credential, account_id, gateway_id |
Fixed https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id} route |
The legacy inference input comes from the caller or organisation variable. File-based routes instead come from settings read only from the default branch, including endpoint and credential selection. Review settings changes as credential routing changes. Never derive the legacy document from PR text, model output, package metadata, a flows file or a provider response. Protect caller workflows with CODEOWNERS and rulesets, since branch writers can change their inputs on pull_request events. There is no environment expansion, arbitrary credential name, plugin, custom header or runtime connector registration.
A compatible base_url must use HTTPS, a DNS hostname with at least two labels, and the default port or explicit 443. No literal IPs, user information, query, fragment, backslash, percent escape, whitespace or control bytes are allowed. localhost and suffixes .localhost, .local and .internal are refused. Path segments use only letters, numbers, ., _, ~ and -, and cannot be . or ... Trailing slashes are removed, and a base path is preserved when appending /chat/completions.
The trusted caller owns DNS and endpoint approval. These checks are not DNS/IP-based SSRF filtering. Every connector rejects redirects. Provider responses and model text cannot supply new routes. Direct connectors send only their own authentication, never Cloudflare headers or another connection's key. Prompts and response payloads are not logged.
Optional Cloudflare
Section titled “Optional Cloudflare”Cloudflare routing is optional. To use an existing gateway, add a connection and profile like these to the trusted document:
{ "connections": { "gateway": { "type": "cloudflare", "account_id": "your-account", "gateway_id": "review", "credential": 5 } }, "profiles": { "through-gateway": { "connection": "gateway", "provider": "openai", "model": "your-model-id" } }}This is a fragment to merge into a complete version-1 document, not a second configuration source. provider is required only for Cloudflare and is one of openai, anthropic or google. It is forbidden on other profile types. Account and gateway ids match [A-Za-z0-9_-]{1,64}. The slot holds the gateway token, not a direct provider key. Gateway calls use gateway authentication, metadata and disabled payload logging. No old gateway environment variable or public workflow input is used.
Schema limits and credential mapping
Section titled “Schema limits and credential mapping”version must be integer 1. Require 1 to 32 connections, 1 to 64 profiles, and an existing default_profile. All objects are JSON records, not arrays or null. Unknown keys are refused at every level, as are map keys __proto__, prototype and constructor. Connection/profile names match [A-Za-z][A-Za-z0-9_-]{0,63}. References must exist.
A profile has connection, model and optional provider, reasoning_effort, price. Model ids contain 1 to 200 characters matching [A-Za-z0-9][A-Za-z0-9._:/-]*. They are request data, never hostnames or import paths. Reasoning effort is empty, minimal, low, medium or high, and is sent only on OpenAI-shaped requests. A price has exactly positive finite input and output USD-per-million-token numbers.
Each connection's integer credential selects one of eight fixed slots. Slots may be reused intentionally. Only slots used by the eligible role chain are required, and all of those are checked before its first request. A missing slot stops the chain as a configuration error. Values must be nonempty strings, at most 8192 characters, without CR/LF.
JSON credential |
Reusable workflow secret and coordinator environment | Composite action input |
|---|---|---|
1 |
CODEHAWK_CREDENTIAL_1 |
credential-1 |
2 |
CODEHAWK_CREDENTIAL_2 |
credential-2 |
3 |
CODEHAWK_CREDENTIAL_3 |
credential-3 |
4 |
CODEHAWK_CREDENTIAL_4 |
credential-4 |
5 |
CODEHAWK_CREDENTIAL_5 |
credential-5 |
6 |
CODEHAWK_CREDENTIAL_6 |
credential-6 |
7 |
CODEHAWK_CREDENTIAL_7 |
credential-7 |
8 |
CODEHAWK_CREDENTIAL_8 |
credential-8 |
All eight workflow secrets and action inputs are optional declarations. Forward only used slots explicitly by name. Never inherit all secrets. No conventional alias such as OPENAI_API_KEY or legacy gateway variable is used as a fallback. Keep secrets step-scoped, out of JSON, arguments, artifacts, summaries and diagnostics. Fix publish receives neither the inference input nor slots nor test-image. Static scanning receives no inference configuration or credentials.
Conservative pricing and caps
Section titled “Conservative pricing and caps”Known direct/gateway models retain the built-in price table. Unknown models use $10 input and $50 output per million tokens. Compatible endpoints always use this ceiling unless their trusted profile declares a price, even if the model string matches a built-in entry. Default-branch settings prices or legacy caller profile prices can override these rates. Cache and thinking tokens retain their existing accounting.
One spend object covers concurrent roles, retries, repair and fallbacks. Each request reserves its full prompt/maximum-output cost before starting. Uncertain transport or timeout failures and unreadable successful responses settle that reservation before a new attempt. A valid answer with missing or invalid usage settles at the reservation ceiling with estimated: true, rather than counting as free. Valid zero counters remain valid. Reports retain model aggregates and add profile, connection and model totals with estimated markers. See costs and caps for optional budgets and caller overrides.
Flow application isolation
Section titled “Flow application isolation”Every repository-controlled install, application startup, setup, test and module load must run in secret-free containers with private PID namespaces. Never start repository code on the host or leave an earlier host process running into the credential-bearing coordinator step. Step-scoped environment alone is not isolation from same-user host processes.
Flows require trusted application-image and application-command. The image must be pinned as registry.example.com/app@sha256: plus the approved 64-character lowercase digest. Supply the command as a JSON argv array, passed directly without shell interpolation. Optional application-env names safe variables separately from setup-env. The action maps these to CODEHAWK_APPLICATION_IMAGE, CODEHAWK_APPLICATION_COMMAND and FLOWS_APPLICATION_ENV. base-url points to this managed container.
No approved digest-pinned image means flows refuse to run, including local runs. Do not substitute an existing host app. Build images and install dependencies in a separate job without inference credentials or in secret-free install containers. No container may use host PID, mount the Docker socket, receive inference configuration/slots, App/storage credentials, or expose the host coordinator through another proc mount. Host networking is allowed. The coordinator retains requests, uploads and posting while separate application, setup and browser containers execute repository code. Browser flows has a caller example. Fix tests likewise require a trusted digest-pinned test-image and run through the same isolated command boundary.
Migrating an existing installation
Section titled “Migrating an existing installation”Prepare one coordinated caller update without changing live settings until every part is ready:
- For a new installation, use the default-branch settings file. The steps below describe legacy inference callers during this compatibility release. Keep old callers pinned to their old commit while preparing trusted inference JSON. Copy each current model into a named profile, and the existing account/gateway ids into a Cloudflare connection. Map the old gateway token secret to one numbered slot explicitly. No token value moves into JSON.
- Bind
pr_review,pr_summaryandpr_replyto the previous PR profile. Bind weekly finder roles to their previous finder profiles, andweekly_confirmto a distinct checker with explicit ordered fallbacks. Bindfix_issues,flows_planandflows_driverto their previous profiles. Preserve reasoning settings in profiles and budgets in repository JSON/caller inputs. Remove old repository model/reasoning keys in the same migration. - Replace old gateway/model workflow and action inputs with
inferenceand named mappings for only used slots. Supply a digest-pinned fixtest-image, plus flowapplication-imageand JSON argvapplication-command. Move all repository-controlled installation, startup, setup, test and module execution into secret-free private-PID containers. Never leave earlier host application processes running when credentials arrive. Prepare images in a separate credential-free build job if needed. Without an approved application digest, do not enable flows. - Pin the new distribution commit only when the caller changes are ready together. Keep the two-commit self-pin scheme.