01-pr29-provider-remap
evals/01-pr29-provider-remap ↑ +71.4 pts with plugin 100%Results
✓ pass finds-magic-string-remap
judge votes: PASS PASS PASS
# Brooks-Lint Review
**Mode:** PR Review
**Scope:** PR diff only — no local checkout available, so this is diff-based (3 files: `.github/actions/brooks-lint/action.yml`, `scripts/ci-review.mjs`, `scripts/run-evals-live.mjs`)
**Health Score:** 85/100
Solid, minimal-footprint feature addition with one real duplication debt — but there are three correctness/operational risks below that I'd resolve before merging regardless of the decay score.
---
## Findings
### 🟡 Warning
**Knowledge Duplication — provider dispatch logic copy-pasted across two scripts**
Symptom: `EXAMPLEGW_BASE_URL`, the `DEFAULT_MODELS` map, the `provider` validation block, and the `thinking: {type: "disabled"}` conditional spread are byte-for-byte identical in `scripts/ci-review.mjs` and `scripts/run-evals-live.mjs`.
Source: Hunt & Thomas — *The Pragmatic Programmer*, DRY / Fowler — *Refactoring*, Duplicate Code
Consequence: the two copies will drift the first time either needs a fix (e.g. gateway URL change, a new provider, or a correction to the thinking-disable behavior) — this PR is itself evidence of the pattern, since it introduced the duplicate rather than a shared helper.
Remedy: extract a small shared module (e.g. `scripts/lib/provider.mjs`) exporting something like `resolveProvider(providerName, requestedModel) -> { model, client, requestOverrides }`, imported by both scripts.
**Knowledge Duplication — "default Anthropic model" decision encoded in three unsynchronized places**
Symptom: `action.yml`'s `model` input default, `ci-review.mjs`'s `DEFAULT_MODELS.anthropic`, and the bash literal `if [ "$MODEL" = "claude-sonnet-4-6" ]` in `action.yml` all separately encode "the default model is claude-sonnet-4-6."
Source: Winters et al. — *Software Engineering at Google*, Ch. 1 (implicit contracts via observable coupling)
Consequence: bumping the default model in one place silently breaks the ExampleGW remap — the gateway then receives a bare, unresolvable model id and fails per-call with a gateway-side error rather than an obvious config error.
Remedy: have the bash remap consult the same table `ci-review.mjs` owns (or move the remap decision entirely into `ci-review.mjs`, since it's already the source of truth for `DEFAULT_MODELS`) instead of re-deriving it as a shell string comparison.
**Coverage Illusion — new provider-branching logic has no test coverage**
Symptom: the diff adds several new decision points (unknown-provider exit, missing-`examplegw-api-key` exit, model remap, thinking-disable branch) with no accompanying test changes.
Source: Feathers — *Working Effectively with Legacy Code*, Ch. 1
Consequence: this logic runs unattended in CI gating merges — a regression here surfaces as a confusing pipeline failure on someone else's unrelated PR, not as a caught test failure.
Remedy: add scenario coverage (via `run-evals-live.mjs`'s own harness or a lightweight script test) for: valid `examplegw` config, missing `examplegw-api-key`, and an unknown `--provider` value.
---
## Summary
Health Score reflects the decay-risk view (mostly one duplication smell, addressed by a shared helper). Recommended fix order: extract the shared provider module first — it resolves both duplication findings at once — then add the missing scenario tests.
---
## Beyond Brooks-Lint: correctness risks worth resolving before merge
These aren't decay/maintainability findings, but they'd block me from approving as-is:
1. **`https://api.examplegw.example` uses a reserved, non-routable TLD.** `.example` is carved out by RFC 2606 specifically so it never resolves on the public internet — if that's literally the string in the source (not a stand-in you substituted for pasting this diff to me), every ExampleGW request will fail DNS resolution. Worth a final grep before merge to confirm it's the real hostname.
2. **Unverified auth header.** The code authenticates to ExampleGW by setting `ANTHROPIC_API_KEY` and constructing a bare `new Anthropic({ baseURL })`. The Anthropic SDK sends that credential via the `x-api-key` header, not `Authorization: Bearer`. Given ExampleGW issues differently-prefixed keys (`sk-gw-...`), confirm it actually reads `x-api-key` — a mismatch fails as a runtime auth error, not at review time.
3. **Disabling thinking to fit the fixed `max_tokens: 4096` budget is a known footgun, not a safe workaround.** On current Claude models, `thinking: {type: "disabled"}` can cause the model to write a tool call or reasoning tags directly into visible text instead of a structured block, with no error raised — which would flow straight into this action's SARIF/JSON output. If ExampleGW proxies real Claude models, prefer leaving thinking on and controlling spend via `output_config: {effort: "low"}` (or raising `max_tokens`) instead of disabling it outright.
✓ pass finds-multiple-sources-of-truth
judge votes: PASS PASS PASS
# Brooks-Lint Review
**Mode:** PR Review
**Scope:** PR diff only — no local checkout available, so this is diff-based (3 files: `.github/actions/brooks-lint/action.yml`, `scripts/ci-review.mjs`, `scripts/run-evals-live.mjs`)
**Health Score:** 85/100
Solid, minimal-footprint feature addition with one real duplication debt — but there are three correctness/operational risks below that I'd resolve before merging regardless of the decay score.
---
## Findings
### 🟡 Warning
**Knowledge Duplication — provider dispatch logic copy-pasted across two scripts**
Symptom: `EXAMPLEGW_BASE_URL`, the `DEFAULT_MODELS` map, the `provider` validation block, and the `thinking: {type: "disabled"}` conditional spread are byte-for-byte identical in `scripts/ci-review.mjs` and `scripts/run-evals-live.mjs`.
Source: Hunt & Thomas — *The Pragmatic Programmer*, DRY / Fowler — *Refactoring*, Duplicate Code
Consequence: the two copies will drift the first time either needs a fix (e.g. gateway URL change, a new provider, or a correction to the thinking-disable behavior) — this PR is itself evidence of the pattern, since it introduced the duplicate rather than a shared helper.
Remedy: extract a small shared module (e.g. `scripts/lib/provider.mjs`) exporting something like `resolveProvider(providerName, requestedModel) -> { model, client, requestOverrides }`, imported by both scripts.
**Knowledge Duplication — "default Anthropic model" decision encoded in three unsynchronized places**
Symptom: `action.yml`'s `model` input default, `ci-review.mjs`'s `DEFAULT_MODELS.anthropic`, and the bash literal `if [ "$MODEL" = "claude-sonnet-4-6" ]` in `action.yml` all separately encode "the default model is claude-sonnet-4-6."
Source: Winters et al. — *Software Engineering at Google*, Ch. 1 (implicit contracts via observable coupling)
Consequence: bumping the default model in one place silently breaks the ExampleGW remap — the gateway then receives a bare, unresolvable model id and fails per-call with a gateway-side error rather than an obvious config error.
Remedy: have the bash remap consult the same table `ci-review.mjs` owns (or move the remap decision entirely into `ci-review.mjs`, since it's already the source of truth for `DEFAULT_MODELS`) instead of re-deriving it as a shell string comparison.
**Coverage Illusion — new provider-branching logic has no test coverage**
Symptom: the diff adds several new decision points (unknown-provider exit, missing-`examplegw-api-key` exit, model remap, thinking-disable branch) with no accompanying test changes.
Source: Feathers — *Working Effectively with Legacy Code*, Ch. 1
Consequence: this logic runs unattended in CI gating merges — a regression here surfaces as a confusing pipeline failure on someone else's unrelated PR, not as a caught test failure.
Remedy: add scenario coverage (via `run-evals-live.mjs`'s own harness or a lightweight script test) for: valid `examplegw` config, missing `examplegw-api-key`, and an unknown `--provider` value.
---
## Summary
Health Score reflects the decay-risk view (mostly one duplication smell, addressed by a shared helper). Recommended fix order: extract the shared provider module first — it resolves both duplication findings at once — then add the missing scenario tests.
---
## Beyond Brooks-Lint: correctness risks worth resolving before merge
These aren't decay/maintainability findings, but they'd block me from approving as-is:
1. **`https://api.examplegw.example` uses a reserved, non-routable TLD.** `.example` is carved out by RFC 2606 specifically so it never resolves on the public internet — if that's literally the string in the source (not a stand-in you substituted for pasting this diff to me), every ExampleGW request will fail DNS resolution. Worth a final grep before merge to confirm it's the real hostname.
2. **Unverified auth header.** The code authenticates to ExampleGW by setting `ANTHROPIC_API_KEY` and constructing a bare `new Anthropic({ baseURL })`. The Anthropic SDK sends that credential via the `x-api-key` header, not `Authorization: Bearer`. Given ExampleGW issues differently-prefixed keys (`sk-gw-...`), confirm it actually reads `x-api-key` — a mismatch fails as a runtime auth error, not at review time.
3. **Disabling thinking to fit the fixed `max_tokens: 4096` budget is a known footgun, not a safe workaround.** On current Claude models, `thinking: {type: "disabled"}` can cause the model to write a tool call or reasoning tags directly into visible text instead of a structured block, with no error raised — which would flow straight into this action's SARIF/JSON output. If ExampleGW proxies real Claude models, prefer leaving thinking on and controlling spend via `output_config: {effort: "low"}` (or raising `max_tokens`) instead of disabling it outright.
✓ pass health-score-line ×0.5
matched Health Score\W*\d{1,3}\s*/\s*100
✓ pass no-factual-misreads
judge votes: PASS PASS PASS
# Brooks-Lint Review
**Mode:** PR Review
**Scope:** PR diff only — no local checkout available, so this is diff-based (3 files: `.github/actions/brooks-lint/action.yml`, `scripts/ci-review.mjs`, `scripts/run-evals-live.mjs`)
**Health Score:** 85/100
Solid, minimal-footprint feature addition with one real duplication debt — but there are three correctness/operational risks below that I'd resolve before merging regardless of the decay score.
---
## Findings
### 🟡 Warning
**Knowledge Duplication — provider dispatch logic copy-pasted across two scripts**
Symptom: `EXAMPLEGW_BASE_URL`, the `DEFAULT_MODELS` map, the `provider` validation block, and the `thinking: {type: "disabled"}` conditional spread are byte-for-byte identical in `scripts/ci-review.mjs` and `scripts/run-evals-live.mjs`.
Source: Hunt & Thomas — *The Pragmatic Programmer*, DRY / Fowler — *Refactoring*, Duplicate Code
Consequence: the two copies will drift the first time either needs a fix (e.g. gateway URL change, a new provider, or a correction to the thinking-disable behavior) — this PR is itself evidence of the pattern, since it introduced the duplicate rather than a shared helper.
Remedy: extract a small shared module (e.g. `scripts/lib/provider.mjs`) exporting something like `resolveProvider(providerName, requestedModel) -> { model, client, requestOverrides }`, imported by both scripts.
**Knowledge Duplication — "default Anthropic model" decision encoded in three unsynchronized places**
Symptom: `action.yml`'s `model` input default, `ci-review.mjs`'s `DEFAULT_MODELS.anthropic`, and the bash literal `if [ "$MODEL" = "claude-sonnet-4-6" ]` in `action.yml` all separately encode "the default model is claude-sonnet-4-6."
Source: Winters et al. — *Software Engineering at Google*, Ch. 1 (implicit contracts via observable coupling)
Consequence: bumping the default model in one place silently breaks the ExampleGW remap — the gateway then receives a bare, unresolvable model id and fails per-call with a gateway-side error rather than an obvious config error.
Remedy: have the bash remap consult the same table `ci-review.mjs` owns (or move the remap decision entirely into `ci-review.mjs`, since it's already the source of truth for `DEFAULT_MODELS`) instead of re-deriving it as a shell string comparison.
**Coverage Illusion — new provider-branching logic has no test coverage**
Symptom: the diff adds several new decision points (unknown-provider exit, missing-`examplegw-api-key` exit, model remap, thinking-disable branch) with no accompanying test changes.
Source: Feathers — *Working Effectively with Legacy Code*, Ch. 1
Consequence: this logic runs unattended in CI gating merges — a regression here surfaces as a confusing pipeline failure on someone else's unrelated PR, not as a caught test failure.
Remedy: add scenario coverage (via `run-evals-live.mjs`'s own harness or a lightweight script test) for: valid `examplegw` config, missing `examplegw-api-key`, and an unknown `--provider` value.
---
## Summary
Health Score reflects the decay-risk view (mostly one duplication smell, addressed by a shared helper). Recommended fix order: extract the shared provider module first — it resolves both duplication findings at once — then add the missing scenario tests.
---
## Beyond Brooks-Lint: correctness risks worth resolving before merge
These aren't decay/maintainability findings, but they'd block me from approving as-is:
1. **`https://api.examplegw.example` uses a reserved, non-routable TLD.** `.example` is carved out by RFC 2606 specifically so it never resolves on the public internet — if that's literally the string in the source (not a stand-in you substituted for pasting this diff to me), every ExampleGW request will fail DNS resolution. Worth a final grep before merge to confirm it's the real hostname.
2. **Unverified auth header.** The code authenticates to ExampleGW by setting `ANTHROPIC_API_KEY` and constructing a bare `new Anthropic({ baseURL })`. The Anthropic SDK sends that credential via the `x-api-key` header, not `Authorization: Bearer`. Given ExampleGW issues differently-prefixed keys (`sk-gw-...`), confirm it actually reads `x-api-key` — a mismatch fails as a runtime auth error, not at review time.
3. **Disabling thinking to fit the fixed `max_tokens: 4096` budget is a known footgun, not a safe workaround.** On current Claude models, `thinking: {type: "disabled"}` can cause the model to write a tool call or reasoning tags directly into visible text instead of a structured block, with no error raised — which would flow straight into this action's SARIF/JSON output. If ExampleGW proxies real Claude models, prefer leaving thinking on and controlling spend via `output_config: {effort: "low"}` (or raising `max_tokens`) instead of disabling it outright.
✓ pass skill-fired plugin-fired indicator
Skill called 1x (expected 1..∞)
✓ pass finds-magic-string-remap
judge votes: PASS PASS PASS
The repo isn't checked out locally, so this review is based on the diff alone (confirmed `EXAMPLEGW_API_KEY` appears nowhere outside the diff hunks shown — there's no hidden wiring elsewhere).
## Real bug (likely breaks the feature, and is a credential-leak risk)
**`scripts/run-evals-live.mjs` never reads `EXAMPLEGW_API_KEY`.** The added header comment documents:
```
EXAMPLEGW_API_KEY=... node scripts/run-evals-live.mjs --provider examplegw
```
but nothing in the diff sets `process.env.ANTHROPIC_API_KEY = process.env.EXAMPLEGW_API_KEY` (or passes an explicit `apiKey` to the `Anthropic` constructor). The client is built as:
```js
const client = new Anthropic(provider === "examplegw" ? { baseURL: EXAMPLEGW_BASE_URL } : undefined);
```
Since the SDK falls back to `ANTHROPIC_API_KEY` from the environment when no `apiKey` is passed, this means:
- If the dev's shell has no `ANTHROPIC_API_KEY` set, the call just fails auth — annoying but safe.
- If the dev's shell *does* have `ANTHROPIC_API_KEY` set (common for local dev), running with `--provider examplegw` will silently send their **real Anthropic key** to `api.examplegw.example` instead of the intended `EXAMPLEGW_API_KEY`. That's a credential leak to a third-party endpoint, not just a functional bug.
Compare with `.github/actions/brooks-lint/action.yml`, which does this swap correctly at the bash level (`export ANTHROPIC_API_KEY="$EXAMPLEGW_API_KEY"`) before invoking `ci-review.mjs`. `run-evals-live.mjs` has no equivalent wrapper, so it needs the same swap done in-script, e.g.:
```js
const apiKey = provider === "examplegw" ? process.env.EXAMPLEGW_API_KEY : process.env.ANTHROPIC_API_KEY;
const client = new Anthropic(provider === "examplegw" ? { apiKey, baseURL: EXAMPLEGW_BASE_URL } : undefined);
```
This should block merge — it's the one path in the PR that's directly user-invoked (not wrapped by the composite action), and it does the wrong thing silently.
## Secondary issues worth a look
- **Model remap is too narrow.** Both the action's bash script and `ci-review.mjs`/`run-evals-live.mjs` only remap the model when it's exactly the literal default `claude-sonnet-4-6`. Any caller who explicitly passes `--model` (or overrides the `model` input) with a bare Anthropic ID when `provider=examplegw` will bypass remapping and hit ExampleGW with an unresolvable model ID — per your own comment, "bare Anthropic model ids are not resolvable through the gateway." Worth either validating/prefixing more generally for `examplegw`, or at minimum failing loudly instead of passing through unmapped IDs.
- **No upfront validation of `$PROVIDER` in the bash script.** `ci-review.mjs`/`run-evals-live.mjs` both explicitly reject unknown providers, but `action.yml`'s bash only branches on `= "examplegw"` vs. else-anthropic. A typo like `provider: ExampleGW` silently falls into the anthropic branch and produces a confusing "anthropic-api-key is required" error instead of "unknown provider."
- **Minor:** `examplegw-api-key` is documented as `sk-gw-...` but nothing checks the prefix — low severity, just noting since it's called out in the description text.
The Sonnet 5 + `thinking: {type: "disabled"}` combination used for the ExampleGW path is valid (Sonnet 5 accepts disabled thinking), so that part is fine as-is.
**Bottom line:** fix the `run-evals-live.mjs` API-key wiring before merging — as written it can silently exfiltrate a real Anthropic key to the gateway endpoint. The model-remap narrowness and provider-typo handling are worth a follow-up but aren't blockers.
✗ fail finds-multiple-sources-of-truth
judge votes: FAIL FAIL FAIL
The repo isn't checked out locally, so this review is based on the diff alone (confirmed `EXAMPLEGW_API_KEY` appears nowhere outside the diff hunks shown — there's no hidden wiring elsewhere).
## Real bug (likely breaks the feature, and is a credential-leak risk)
**`scripts/run-evals-live.mjs` never reads `EXAMPLEGW_API_KEY`.** The added header comment documents:
```
EXAMPLEGW_API_KEY=... node scripts/run-evals-live.mjs --provider examplegw
```
but nothing in the diff sets `process.env.ANTHROPIC_API_KEY = process.env.EXAMPLEGW_API_KEY` (or passes an explicit `apiKey` to the `Anthropic` constructor). The client is built as:
```js
const client = new Anthropic(provider === "examplegw" ? { baseURL: EXAMPLEGW_BASE_URL } : undefined);
```
Since the SDK falls back to `ANTHROPIC_API_KEY` from the environment when no `apiKey` is passed, this means:
- If the dev's shell has no `ANTHROPIC_API_KEY` set, the call just fails auth — annoying but safe.
- If the dev's shell *does* have `ANTHROPIC_API_KEY` set (common for local dev), running with `--provider examplegw` will silently send their **real Anthropic key** to `api.examplegw.example` instead of the intended `EXAMPLEGW_API_KEY`. That's a credential leak to a third-party endpoint, not just a functional bug.
Compare with `.github/actions/brooks-lint/action.yml`, which does this swap correctly at the bash level (`export ANTHROPIC_API_KEY="$EXAMPLEGW_API_KEY"`) before invoking `ci-review.mjs`. `run-evals-live.mjs` has no equivalent wrapper, so it needs the same swap done in-script, e.g.:
```js
const apiKey = provider === "examplegw" ? process.env.EXAMPLEGW_API_KEY : process.env.ANTHROPIC_API_KEY;
const client = new Anthropic(provider === "examplegw" ? { apiKey, baseURL: EXAMPLEGW_BASE_URL } : undefined);
```
This should block merge — it's the one path in the PR that's directly user-invoked (not wrapped by the composite action), and it does the wrong thing silently.
## Secondary issues worth a look
- **Model remap is too narrow.** Both the action's bash script and `ci-review.mjs`/`run-evals-live.mjs` only remap the model when it's exactly the literal default `claude-sonnet-4-6`. Any caller who explicitly passes `--model` (or overrides the `model` input) with a bare Anthropic ID when `provider=examplegw` will bypass remapping and hit ExampleGW with an unresolvable model ID — per your own comment, "bare Anthropic model ids are not resolvable through the gateway." Worth either validating/prefixing more generally for `examplegw`, or at minimum failing loudly instead of passing through unmapped IDs.
- **No upfront validation of `$PROVIDER` in the bash script.** `ci-review.mjs`/`run-evals-live.mjs` both explicitly reject unknown providers, but `action.yml`'s bash only branches on `= "examplegw"` vs. else-anthropic. A typo like `provider: ExampleGW` silently falls into the anthropic branch and produces a confusing "anthropic-api-key is required" error instead of "unknown provider."
- **Minor:** `examplegw-api-key` is documented as `sk-gw-...` but nothing checks the prefix — low severity, just noting since it's called out in the description text.
The Sonnet 5 + `thinking: {type: "disabled"}` combination used for the ExampleGW path is valid (Sonnet 5 accepts disabled thinking), so that part is fine as-is.
**Bottom line:** fix the `run-evals-live.mjs` API-key wiring before merging — as written it can silently exfiltrate a real Anthropic key to the gateway endpoint. The model-remap narrowness and provider-typo handling are worth a follow-up but aren't blockers.
✗ fail health-score-line ×0.5
pattern not found in last_message
✗ fail no-factual-misreads
judge votes: FAIL PASS FAIL
The repo isn't checked out locally, so this review is based on the diff alone (confirmed `EXAMPLEGW_API_KEY` appears nowhere outside the diff hunks shown — there's no hidden wiring elsewhere).
## Real bug (likely breaks the feature, and is a credential-leak risk)
**`scripts/run-evals-live.mjs` never reads `EXAMPLEGW_API_KEY`.** The added header comment documents:
```
EXAMPLEGW_API_KEY=... node scripts/run-evals-live.mjs --provider examplegw
```
but nothing in the diff sets `process.env.ANTHROPIC_API_KEY = process.env.EXAMPLEGW_API_KEY` (or passes an explicit `apiKey` to the `Anthropic` constructor). The client is built as:
```js
const client = new Anthropic(provider === "examplegw" ? { baseURL: EXAMPLEGW_BASE_URL } : undefined);
```
Since the SDK falls back to `ANTHROPIC_API_KEY` from the environment when no `apiKey` is passed, this means:
- If the dev's shell has no `ANTHROPIC_API_KEY` set, the call just fails auth — annoying but safe.
- If the dev's shell *does* have `ANTHROPIC_API_KEY` set (common for local dev), running with `--provider examplegw` will silently send their **real Anthropic key** to `api.examplegw.example` instead of the intended `EXAMPLEGW_API_KEY`. That's a credential leak to a third-party endpoint, not just a functional bug.
Compare with `.github/actions/brooks-lint/action.yml`, which does this swap correctly at the bash level (`export ANTHROPIC_API_KEY="$EXAMPLEGW_API_KEY"`) before invoking `ci-review.mjs`. `run-evals-live.mjs` has no equivalent wrapper, so it needs the same swap done in-script, e.g.:
```js
const apiKey = provider === "examplegw" ? process.env.EXAMPLEGW_API_KEY : process.env.ANTHROPIC_API_KEY;
const client = new Anthropic(provider === "examplegw" ? { apiKey, baseURL: EXAMPLEGW_BASE_URL } : undefined);
```
This should block merge — it's the one path in the PR that's directly user-invoked (not wrapped by the composite action), and it does the wrong thing silently.
## Secondary issues worth a look
- **Model remap is too narrow.** Both the action's bash script and `ci-review.mjs`/`run-evals-live.mjs` only remap the model when it's exactly the literal default `claude-sonnet-4-6`. Any caller who explicitly passes `--model` (or overrides the `model` input) with a bare Anthropic ID when `provider=examplegw` will bypass remapping and hit ExampleGW with an unresolvable model ID — per your own comment, "bare Anthropic model ids are not resolvable through the gateway." Worth either validating/prefixing more generally for `examplegw`, or at minimum failing loudly instead of passing through unmapped IDs.
- **No upfront validation of `$PROVIDER` in the bash script.** `ci-review.mjs`/`run-evals-live.mjs` both explicitly reject unknown providers, but `action.yml`'s bash only branches on `= "examplegw"` vs. else-anthropic. A typo like `provider: ExampleGW` silently falls into the anthropic branch and produces a confusing "anthropic-api-key is required" error instead of "unknown provider."
- **Minor:** `examplegw-api-key` is documented as `sk-gw-...` but nothing checks the prefix — low severity, just noting since it's called out in the description text.
The Sonnet 5 + `thinking: {type: "disabled"}` combination used for the ExampleGW path is valid (Sonnet 5 accepts disabled thinking), so that part is fine as-is.
**Bottom line:** fix the `run-evals-live.mjs` API-key wiring before merging — as written it can silently exfiltrate a real Anthropic key to the gateway endpoint. The model-remap narrowness and provider-typo handling are worth a follow-up but aren't blockers.
Prompt
Can you review this PR before I merge it? It lets our CI review action route requests through ExampleGW, an Anthropic-compatible model gateway, instead of calling Anthropic directly. Only the code files from the PR are included below.
diff --git a/.github/actions/brooks-lint/action.yml b/.github/actions/brooks-lint/action.yml
index 73977da..3f2e0b2 100644
--- a/.github/actions/brooks-lint/action.yml
+++ b/.github/actions/brooks-lint/action.yml
@@ -7,8 +7,14 @@ inputs:
description: "Review mode: review, audit, debt, test, health, sweep"
default: "review"
anthropic-api-key:
- description: "Anthropic API key"
- required: true
+ description: "Anthropic API key (required unless provider is examplegw)"
+ default: ""
+ provider:
+ description: "Model provider: anthropic (default) or examplegw"
+ default: "anthropic"
+ examplegw-api-key:
+ description: "ExampleGW API key, sk-gw-... (required when provider is examplegw)"
+ default: ""
fail-below:
description: "Fail the check if Health Score is below this threshold (0 = never fail)"
default: "0"
@@ -71,10 +77,29 @@ runs:
shell: bash
env:
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
+ EXAMPLEGW_API_KEY: ${{ inputs.examplegw-api-key }}
+ PROVIDER: ${{ inputs.provider }}
SARIF_FILE: ${{ inputs.sarif-file }}
MODE: ${{ inputs.mode }}
MODEL: ${{ inputs.model }}
run: |
+ if [ "$PROVIDER" = "examplegw" ]; then
+ # ExampleGW serves an Anthropic-compatible /v1/messages endpoint. The
+ # key lives in examplegw-api-key (sk-gw-...); bare Anthropic model
+ # ids are not resolvable through the gateway, so the action's default
+ # claude-sonnet-4-6 is remapped to the ExampleGW-pinned id.
+ if [ -z "$EXAMPLEGW_API_KEY" ]; then
+ echo "provider=examplegw requires examplegw-api-key (sk-gw-...)" >&2
+ exit 1
+ fi
+ export ANTHROPIC_API_KEY="$EXAMPLEGW_API_KEY"
+ if [ "$MODEL" = "claude-sonnet-4-6" ]; then
+ MODEL="anthropic/claude-sonnet-5"
+ fi
+ elif [ -z "$ANTHROPIC_API_KEY" ]; then
+ echo "anthropic-api-key is required unless provider=examplegw" >&2
+ exit 1
+ fi
sarif_arg=()
if [ -n "$SARIF_FILE" ]; then
sarif_arg=(--sarif-out "$SARIF_FILE")
@@ -82,6 +107,7 @@ runs:
node "$BROOKS_LINT_ROOT/scripts/ci-review.mjs" \
--mode "$MODE" \
--model "$MODEL" \
+ --provider "$PROVIDER" \
--skills-dir "$BROOKS_LINT_ROOT/skills" \
--project-dir "$GITHUB_WORKSPACE" \
"${sarif_arg[@]}" \
diff --git a/scripts/ci-review.mjs b/scripts/ci-review.mjs
index 61d67a7..91b31b6 100644
--- a/scripts/ci-review.mjs
+++ b/scripts/ci-review.mjs
@@ -13,11 +13,13 @@
* --model claude-sonnet-4-6 \
* --skills-dir ./skills \
* --project-dir /path/to/project \
+ * [--provider anthropic|examplegw] \
* [--format json|sarif] \
* [--sarif-out brooks-lint.sarif]
*
* Environment:
- * ANTHROPIC_API_KEY required
+ * ANTHROPIC_API_KEY required (provider=anthropic)
+ * EXAMPLEGW_API_KEY required (provider=examplegw; sk-gw-...)
*/
import { execFileSync } from "node:child_process";
@@ -35,8 +37,22 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const args = parseArgs(process.argv.slice(2));
+const provider = args.provider ?? "anthropic";
+if (!["anthropic", "examplegw"].includes(provider)) {
+ console.error(`Unknown provider: ${provider}. Valid providers: anthropic, examplegw`);
+ process.exit(1);
+}
+
+// ExampleGW serves an Anthropic-compatible /v1/messages endpoint. Bare Anthropic
+// model ids (e.g. claude-sonnet-4-6) are not resolvable through the gateway, so
+// the default is pinned to the ExampleGW-prefixed id.
+const DEFAULT_MODELS = {
+ anthropic: "claude-sonnet-4-6",
+ examplegw: "anthropic/claude-sonnet-5",
+};
+
const mode = args.mode ?? "review";
-const model = args.model ?? "claude-sonnet-4-6";
+const model = args.model ?? DEFAULT_MODELS[provider];
const format = args.format ?? "json";
const skillsDir = path.resolve(args["skills-dir"] ?? path.join(__dirname, "..", "skills"));
const projectDir = path.resolve(args["project-dir"] ?? process.cwd());
@@ -79,7 +95,9 @@ function getGitDiff(projectRoot) {
// ── Main ──────────────────────────────────────────────────────────────────────
-const client = new Anthropic();
+// ExampleGW's Anthropic-compatible endpoint — the client appends /v1/messages.
+const EXAMPLEGW_BASE_URL = "https://api.examplegw.example";
+const client = new Anthropic(provider === "examplegw" ? { baseURL: EXAMPLEGW_BASE_URL } : undefined);
const { diff, scope } = getGitDiff(projectDir);
const systemPrompt = assembleSystemPrompt(mode, skillsDir);
@@ -95,6 +113,10 @@ try {
max_tokens: 4096,
system: systemPrompt,
messages: [{ role: "user", content: userMessage }],
+ // Reasoning models on ExampleGW spend the output budget on thinking blocks
+ // by default; the 4096-token budget here assumes direct text output, so the
+ // gateway path disables extended thinking to preserve that contract.
+ ...(provider === "examplegw" ? { thinking: { type: "disabled" } } : {}),
});
} catch (err) {
console.error(JSON.stringify({ error: err.message, mode, scope }, null, 2));
diff --git a/scripts/run-evals-live.mjs b/scripts/run-evals-live.mjs
index cfdda01..bb64406 100644
--- a/scripts/run-evals-live.mjs
+++ b/scripts/run-evals-live.mjs
@@ -8,6 +8,7 @@
* ANTHROPIC_API_KEY=... node scripts/run-evals-live.mjs --id 5
* ANTHROPIC_API_KEY=... node scripts/run-evals-live.mjs --mode review
* ANTHROPIC_API_KEY=... node scripts/run-evals-live.mjs --model claude-opus-4-6
+ * EXAMPLEGW_API_KEY=... node scripts/run-evals-live.mjs --provider examplegw
*/
import { readFileSync } from "node:fs";
@@ -22,10 +23,24 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.resolve(__dirname, "..");
const args = parseArgs(process.argv.slice(2));
+const provider = args.provider ?? "anthropic";
+if (!["anthropic", "examplegw"].includes(provider)) {
+ console.error(`Unknown provider: ${provider}. Valid providers: anthropic, examplegw`);
+ process.exit(1);
+}
+
+// ExampleGW serves an Anthropic-compatible /v1/messages endpoint. Bare Anthropic
+// model ids are not resolvable through the gateway, so the default is pinned to
+// the ExampleGW-prefixed id.
+const DEFAULT_MODELS = {
+ anthropic: "claude-sonnet-4-6",
+ examplegw: "anthropic/claude-sonnet-5",
+};
+
const filterRisk = args.risk ?? null;
const filterId = args.id ? parseInt(args.id, 10) : null;
const filterMode = args.mode ?? null;
-const model = args.model ?? "claude-sonnet-4-6";
+const model = args.model ?? DEFAULT_MODELS[provider];
const skillsDir = path.join(root, "skills");
if (filterMode && !VALID_MODES.includes(filterMode)) {
@@ -59,7 +74,9 @@ function getSystemPrompt(mode) {
// ── Run scenarios ─────────────────────────────────────────────────────────────
-const client = new Anthropic();
+// ExampleGW's Anthropic-compatible endpoint — the client appends /v1/messages.
+const EXAMPLEGW_BASE_URL = "https://api.examplegw.example";
+const client = new Anthropic(provider === "examplegw" ? { baseURL: EXAMPLEGW_BASE_URL } : undefined);
const results = [];
for (const scenario of scenarios) {
@@ -80,6 +97,10 @@ for (const scenario of scenarios) {
max_tokens: 4096,
system: systemPrompt,
messages: [{ role: "user", content: userMessage }],
+ // Reasoning models on ExampleGW spend the output budget on thinking blocks
+ // by default; the 4096-token budget here assumes direct text output, so the
+ // gateway path disables extended thinking to preserve that contract.
+ ...(provider === "examplegw" ? { thinking: { type: "disabled" } } : {}),
});
aiText = message.content[0]?.text ?? "";
verdict = classify(scenario, aiText);
Graders — what "good" means for this case
Facts about the diff under review (use them to check the answer; do not grade the facts themselves):
- In
.github/actions/brooks-lint/action.yml, whenPROVIDERisexamplegwthe script runsif [ "$MODEL" = "claude-sonnet-4-6" ]; then MODEL="anthropic/claude-sonnet-5"; fi. claude-sonnet-4-6is the action's current default value for itsmodelinput.
PASS only if the answer does BOTH:
- Identifies this equality check / model rewrite in
action.yml(quoting it, or clearly describing "the action rewrites the model only when it equals the current default id"). - States at least one concrete consequence of tying the rewrite to that literal id:
(a) when the action's default model is bumped, the check silently stops matching and the gateway receives an id it cannot resolve; or
(b) a user who explicitly sets
model: claude-sonnet-4-6is silently switched to a different model; or (c) any other bare model id a user passes is not mapped for the gateway at all.
FAIL if the rewrite is not mentioned, or is only described neutrally (e.g. "remaps the default model") without explaining why the literal comparison is fragile.
Facts about the diff under review:
- The gateway's default model is encoded in more than one place:
action.ymlhard-codes the rewriteclaude-sonnet-4-6 → anthropic/claude-sonnet-5, whilescripts/ci-review.mjsandscripts/run-evals-live.mjseach define their ownDEFAULT_MODELS = { anthropic: "claude-sonnet-4-6", examplegw: "anthropic/claude-sonnet-5" }. action.ymlalways passes--model "$MODEL"toci-review.mjs, and the script doesargs.model ?? DEFAULT_MODELS[provider], so on the action pathDEFAULT_MODELSnever takes effect.
PASS if the answer makes at least one of these points AND names at least two of the locations involved (file names or clearly identified code sites):
A. The provider → default-model mapping lives in two or more places (the action.yml rewrite vs DEFAULT_MODELS, or DEFAULT_MODELS copied into both scripts), so the copies can drift apart.
B. DEFAULT_MODELS in ci-review.mjs is dead / never used when invoked from the action, because the action always passes --model.
FAIL if neither A nor B is made. Pointing out that the provider-handling block is duplicated across the two scripts counts as A only if the answer makes clear the default-model mapping is part of what is duplicated.
"last_message""Health Score\\W*\\d{1,3}\\s*/\\s*100""i""contains"Check the review for factual misreadings of the diff. Ground truth about what the diff does:
action.yml: whenPROVIDERisexamplegwit exits 1 ifEXAMPLEGW_API_KEYis empty, otherwise exports it asANTHROPIC_API_KEY. For any other provider value it still exits 1 whenANTHROPIC_API_KEYis empty — the Anthropic path keeps a missing-key check (moved fromrequired: trueto a runtime check).action.ymlpasses--provider "$PROVIDER"toci-review.mjs. The action itself does not reject unknown provider values; both scripts do, exiting 1 with "Unknown provider".- Both scripts construct
new Anthropic({ baseURL: "https://api.examplegw.example" })only when provider isexamplegw; otherwisenew Anthropic(undefined), which uses the SDK defaults (valid, does not throw). thinking: { type: "disabled" }is added to the request only when provider isexamplegw.- No API key value is printed or logged; the error messages only name the missing input.
- An explicit
--modelalways wins;DEFAULT_MODELS[provider]is only the fallback when--modelis absent.
FAIL if the answer states as fact anything that contradicts items 1–6 — for example: the Anthropic path no longer validates its key; the base URL is applied to both providers or never applied; thinking is disabled for every provider; a key is leaked to logs; new Anthropic(undefined) throws; an unknown provider silently falls back to anthropic inside the scripts; DEFAULT_MODELS overrides an explicit --model.
Do NOT fail for: hedged remarks about behaviour outside the diff (e.g. whether the gateway accepts the thinking field), design opinions, or observations consistent with the ground truth (e.g. "action.yml does not validate the provider itself, so a typo only fails later in the script").
PASS if no contradicting claim is present.
"Skill""brooks-review"