Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,20 +536,31 @@ comment (and in the terminal) with the fix, and `ecr doctor` fails on them:
frontmatter below an HTML comment, a byte-order mark or blank lines (all its keys
are ignored), and a comment that breaks `alwaysRun`, `model` or `temperature`.

`effort` sets how much reasoning the model spends on that agent's passes. Only
models that run through the Claude Code CLI (`anthropic/…`) read it; for any other
model the review prints a note and ignores it. Leave it out to use the CLI default.
The model must also support effort: the CLI sends no level to a model without
effort support (Claude Haiku 4.5 is one), and ecr does not check this. A model can
also take only some of the levels.
`effort` sets how much reasoning the model spends on that agent's passes. ecr
passes it for these models, and for any other model the review prints a note and
ignores it. Leave it out to use the provider's default.

| Model | How the level is sent |
| --- | --- |
| `anthropic/…` (Claude Code CLI) | `--effort <level>` |
| `openai/…`, or an alias with `upstream: "openai"` (OpenCode) | `reasoningEffort`, sent as the Responses API `reasoning.effort` |
| `google/…`, `google-vertex/…` (OpenCode) | `thinkingConfig.thinkingLevel`, in place of the model's default (OpenCode sends `high` for Gemini 4 Neon); only `low`, `medium` or `high` (for `xhigh` and `max` ecr sends no level, and the run note says so) |
| `xai/…` (Grok, OpenCode) | `reasoningEffort`, sent as Chat Completions `reasoning_effort` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Native xAI wire format mismatch

With XAI_API_KEY, OpenCode’s native xai loader uses /responses and sends reasoning.effort. The mock result covers Chat Completions, not the native loader’s request format.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.


ecr passes the level as written and does not check which levels a model takes. A
model without effort support can drop it (the Claude Code CLI sends no level to
Claude Haiku 4.5), and a provider can reject a level its model does not take, which
fails that agent's passes with the provider's error.
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved
A higher level costs more and takes longer, so set it on the agent that needs depth
(a correctness reviewer that must trace callers), not on every agent. A value that
is not a level is listed under **Review setup**, and the agent runs at the default.
`effort` in `coordinator.md` or `shared.md` is also listed there: only reviewer
files take it.
An agent file in `agents/` named after a built-in pass (`verifier.md`,
`cross-cutting.md`, `adjudicator.md`, `stack-verifier.md` or `coordinator.md`) gets
no effort; the review note says to rename it.
no effort; the review note says to rename it. The same holds, on OpenCode-routed
models, for a file named after one of OpenCode's own agents (`build.md`,
`compaction.md`, `explore.md`, `general.md`, `plan.md`, `summary.md`, `title.md`).

`paths` limits an agent to the changes it covers. It takes a list of repo-relative
globs in the routing dialect: `*` stays within a directory, `**` crosses
Expand Down
63 changes: 52 additions & 11 deletions llp/0006-config-schema-loading-routing.explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ reviewers raised in the class "needs a logic trace" (eval run `full-v2-tune`, 20
is private and not in this repo; no person checked the analysis). Depth is a per-agent need, and it costs time and money, so it is a
per-agent key and not a run-level flag.

- **Only the claude-code engine reads it.** `startClaudeCode` copies the declared levels into
- **The claude-code engine passes it as a flag.** `startClaudeCode` copies the declared levels into
`ClaudeCodeHandle.efforts`, and `runClaudePrompt` passes `--effort <level>` for that agent's
passes [observed] (`buildClaudeArgs` `effort`; tests in `src/__tests__/claude-code.test.ts`). The
fixed roles (cross-cutting, verifier, adjudicator, stack verifier, coordinator) have no entry and
Expand All @@ -239,8 +239,43 @@ per-agent key and not a run-level flag.
session archive's `NON_REVIEWER_AGENTS`, so the two cannot drift. The levels live in a
`Map`, so an id such as `constructor` cannot read an inherited `Object.prototype` value
(both found in review of the first version, PR #118).
- **An OpenCode-routed agent ignores it, with a note.** `agentEffortNote` names those agents once
per run, the same way `claudeTemperatureNote` reports a temperature the CLI cannot take.
- **OpenCode passes it for OpenAI, Google and xAI models.** OpenCode hands unknown agent-config keys to
the provider as model options. `buildOpencodeConfig` adds one per reviewer with `effort`, chosen
by `opencodeEffortStyle` from the adapter ecr gives the model's provider: native `openai` and an
alias with `upstream: "openai"` (built on `@ai-sdk/openai`) get `reasoningEffort`; native
`google` and `google-vertex` get `thinkingConfig.thinkingLevel`; native `xai` (Grok, on
`@ai-sdk/xai`) gets `reasoningEffort`. Any other alias, including
`upstream: "google"` (built on `@ai-sdk/openai-compatible`), gets nothing: a Google key on that
adapter reached a mock endpoint as a top-level `thinkingConfig` on `/chat/completions` (found in
review of PR #119). Observed with the pinned OpenCode 1.19.5 against a local mock
endpoint (2026-11-26) [observed]: with no key, an `openai/gpt-6.2-astra` request carried no
`reasoning` field; `reasoningEffort: "xhigh"` and `"max"` arrived as `reasoning.effort`; a
`google/gemini-4-neon` request carried `thinkingConfig: {includeThoughts: true, thinkingLevel:
"high"}` with no key, and `thinkingLevel: "low"` replaced the `high`; an `xai/grok-4.7` request to
`/chat/completions` carried no level field with no key, and `reasoningEffort` `"low"`, `"high"` and
`"xhigh"` arrived as `reasoning_effort` (asked for in review of PR #118; which levels xAI's API
accepts is not verified). Only reviewer entries get
the key: the fixed roles are written after the reviewer loop, so a reviewer that shares a fixed
role's id cannot give that pass its level. The pinned Google adapter takes `thinkingLevel`
`minimal`, `low`, `medium` and `high`; with `xhigh` or `max` the pass failed inside OpenCode
(an invalid-provider-options error) with no request sent, on `google/…` and `google-vertex/…`
[observed]. OpenCode's model catalog lists more variants for some Gemini models; the limit comes
from the bundled Google SDK's option schema, so re-check it when the OpenCode pins move. So
`GOOGLE_THINKING_LEVELS` is `low`, `medium`, `high`: for the other two ecr sends no
key, the model runs at its default in OpenCode (`high` for Gemini 4 Neon; a `google/gemini-2.5-flash`
request carried no `thinkingLevel`, per review of PR #119), and the run note names the agent, its level
and the levels that work. Not observed: the ChatGPT/Codex sign-in path and a
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved
real provider's response to each level. ecr passes the level as written; a provider that does
not take it fails that agent's passes with its own error.
- **No level on OpenCode's own agent ids.** OpenCode 1.19.5 defines `build`, `compaction`,
`explore`, `general`, `plan`, `summary` and `title` (`app.agents()`, `native: true`, 2026-11-26) [observed]; a
reviewer config with one of these ids replaces that agent, and `compaction`, `summary` and `title`
also run for other sessions. A reviewer level there reached another reviewer's session
compaction (found in review of PR #119), so `buildOpencodeConfig` gives these ids no level
(`OPENCODE_BUILTIN_AGENTS`), and the run note tells the author to rename the file.
- **Any other OpenCode-routed agent ignores it, with a note.** `agentEffortNote` names agents whose
OpenCode provider takes no level (Meta, OpenAI-compatible and others) once per run, the same way
`claudeTemperatureNote` reports a temperature the CLI cannot take.
`selectReviewers`, which `runReview` calls, builds it from the selected reviewer list, after the
`paths` filter and the router, so an agent either of them left out is never named. A later step
(a blocking pre-check, the budget) can still skip a named agent, so the note states a fact about
Expand All @@ -251,12 +286,18 @@ per-agent key and not a run-level flag.
#118 against a local mock endpoint, not re-run here). The engine does not check model support.
- **Only reviewer files take it.** `effort` in `coordinator.md` or `shared.md` frontmatter has no
effect, so the loader adds a setup warning that says to remove it, instead of ignoring it.
- **The claude-code no-tools fallback runs at `min(level, medium)`.** A timed-out pass is retried
with no tools under a short cap (`maxToolCalls: 0`). A deep level there would likely time out
again (found in a multi-model review of PR #118, not measured in a live run), and sending no
level would use the CLI's default, which can be higher than the agent's own `low`. So
`fallbackEffort` caps the level at `medium` and never raises it, and `runClaudePrompt` passes
that for the fallback. Only the claude-code engine applies this cap.
- **The claude-code no-tools fallback runs at `min(level, medium)`; OpenCode keeps the level.** A
timed-out pass is retried with no tools under a short cap (`maxToolCalls: 0`). A deep level there
would likely time out again (found in a multi-model review of PR #118, not measured in a live
run), and sending no level would use the CLI's default, which can be higher than the agent's own
`low`. So `fallbackEffort` caps the level at `medium` and never raises it, and `runClaudePrompt`
passes that for the fallback. Only the claude-code engine applies this cap. On OpenCode the
fallback, and the finalize and corrective prompts, run at the agent's own level: OpenCode reads
the level from the agent config, and ecr cannot know which lower levels a model takes (GPT-5 pro
takes only `high`, per the provider's docs cited in review of PR #119), so it never sends a level
the author did not write. An earlier version of PR #119 gave each such reviewer a
`<id>__fallback-effort` copy at `min(level, medium)`; review showed it could send a rejected
level, so it was removed.
- **An invalid level never stops a review.** `parseAgentEffort` returns a setup warning with the
fix and no `effort`, so the agent runs at the default. The warning does not repeat the value: a
backtick in it would close the code span in the review comment, and setup notes are not
Expand All @@ -270,8 +311,8 @@ per-agent key and not a run-level flag.
warnings behave the same way, so a fix belongs to all per-agent warnings at once. An unmatched
quote (`effort: "max`) loads as `max`, because the shared frontmatter reader strips each quote on
its own for every key.
- **`REVIEWER_MODEL` does not clear it.** The override can move an agent to a model that runs
through OpenCode; the note then reports the ignored level.
- **`REVIEWER_MODEL` does not clear it.** The override can move an agent to another provider; the
level then goes to that provider, or the note reports it as ignored.

## Budgets and Chunking Defaults

Expand Down
140 changes: 128 additions & 12 deletions src/__tests__/claude-code.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,11 +874,16 @@ test("buildAgentEfforts: no entry for a reviewer that shares a fixed role's id",
agents: [
{ id: "correctness", effort: "high" },
...fixedRoles.map((id) => ({ id, effort: "max" })),
// An OpenCode built-in id keeps its level on the claude-code engine.
{ id: "compaction", effort: "high" },
{ id: "constructor" },
],
} as unknown as LoadedConfig;
const efforts = buildAgentEfforts(config);
expect([...efforts]).toEqual([["correctness", "high"]]);
expect([...efforts]).toEqual([
["correctness", "high"],
["compaction", "high"],
]);
expect(efforts.get("constructor")).toBeUndefined();
});

Expand All @@ -888,8 +893,10 @@ test("agentEffortNote: names the agents whose effort an OpenCode-routed model ig
{ id: "b", effort: "low" },
{ id: "c" },
] as unknown as LoadedAgent[];
expect(agentEffortNote(agents, { a: "claude-code", b: "claude-code", c: "opencode" })).toBeNull();
const note = agentEffortNote(agents, { a: "claude-code", b: "opencode", c: "opencode" });
expect(
agentEffortNote(agents, { a: "claude-code", b: "claude-code", c: "opencode" }, []),
).toBeNull();
const note = agentEffortNote(agents, { a: "claude-code", b: "opencode", c: "opencode" }, []);
expect(note).toContain("has no effect for b:");
expect(note).not.toContain("for a");
});
Expand All @@ -900,35 +907,144 @@ test("agentEffortNote: an agent that does not run in this review is not named",
// although the engine map still has entries for both ids.
const selected = [{ id: "alpha", effort: "high" }] as unknown as LoadedAgent[];
expect(
agentEffortNote(selected, { alpha: "claude-code", ios: "opencode", verifier: "claude-code" }),
agentEffortNote(
selected,
{ alpha: "claude-code", ios: "opencode", verifier: "claude-code" },
[],
),
).toBeNull();
});

test("agentEffortNote: OpenAI, Google and xAI models take a level through OpenCode; others do not", () => {
const agents = [
{ id: "astra", effort: "high", model: "openai/gpt-6.2-astra" },
{ id: "pro", effort: "high", model: "openai-api/gpt-5.5-pro" },
{ id: "neon", effort: "high", model: "google/gemini-4-neon" },
{ id: "vertex", effort: "high", model: "google-vertex/gemini-4-neon" },
{ id: "grok", effort: "high", model: "xai/grok-4.7" },
{ id: "muse", effort: "high", model: "meta/muse-spark-1.3" },
] as unknown as LoadedAgent[];
const engineOf = {
astra: "opencode",
pro: "opencode",
neon: "opencode",
vertex: "opencode",
grok: "opencode",
muse: "opencode",
} as const;
const auth = [
{ provider: "openai-api", mode: "api-key", tokenEnv: "OPENAI_API_KEY", upstream: "openai" },
] as unknown as AuthConfigEntry[];
const named = (note: string | null) => note?.match(/has no effect for ([^:]+):/)?.[1];
const note = agentEffortNote(agents, engineOf, auth);
expect(note).toContain(
"the model of each runs through OpenCode on a provider ecr passes no level to (ecr passes one only for `anthropic/…`",
);
expect(named(note)).toBe("muse");
// Without the alias's auth entry, `openai-api` is not known to be OpenAI.
expect(named(agentEffortNote(agents, engineOf, []))).toBe("pro, muse");
});

test("agentEffortNote: a Google level the pinned adapter rejects is named with the levels it takes", () => {
const agents = [
{ id: "neon", effort: "xhigh", model: "google/gemini-4-neon" },
{ id: "vertex", effort: "max", model: "google-vertex/gemini-4-neon" },
{ id: "ok", effort: "medium", model: "google/gemini-4-neon" },
] as unknown as LoadedAgent[];
const note = agentEffortNote(
agents,
{ neon: "opencode", vertex: "opencode", ok: "opencode" },
[],
);
expect(note).toContain("has no effect for neon (xhigh), vertex (max): OpenCode's Google adapter");
expect(note).toContain("takes only low, medium, high");
expect(note).toContain("Fix: use one of those levels");
expect(note).not.toContain("ok (");
});

test("agentEffortNote: a Google-upstream alias takes no level and is named", () => {
const agents = [
{ id: "gem", effort: "high", model: "gemini-api/gemini-4-neon" },
] as unknown as LoadedAgent[];
const auth = [
{ provider: "gemini-api", mode: "api-key", tokenEnv: "GEMINI_KEY_2", upstream: "google" },
] as unknown as AuthConfigEntry[];
expect(agentEffortNote(agents, { gem: "opencode" }, auth)).toContain(
"has no effect for gem: the model of each runs through OpenCode on a provider ecr passes no level to",
);
});

test("agentEffortNote: a fixed-role reviewer on Google xhigh is also told the levels Google takes", () => {
const agents = [
{ id: "verifier", effort: "xhigh", model: "google/gemini-4-neon" },
] as unknown as LoadedAgent[];
const note = agentEffortNote(agents, { verifier: "claude-code" }, []);
expect(note).toContain("Fix: rename the agent file, and give verifier one of low, medium, high");
});

test("agentEffortNote: an OpenCode reviewer named after an OpenCode built-in agent is told to rename", () => {
const agents = [
{ id: "compaction", effort: "xhigh", model: "openai/gpt-6.2-astra" },
] as unknown as LoadedAgent[];
const note = agentEffortNote(agents, { compaction: "opencode" }, []);
expect(note).toContain("has no effect for compaction: the id is also an OpenCode built-in agent");
expect(note).toContain("Fix: rename the agent file");
expect(note).not.toContain("runs through OpenCode on a provider");
// On the claude-code engine the level does apply, so there is no note.
expect(agentEffortNote(agents, { compaction: "claude-code" }, [])).toBeNull();
});

test("agentEffortNote: an OpenCode built-in id on Google max is also told the levels Google takes", () => {
const agents = [
{ id: "compaction", effort: "max", model: "google/gemini-4-neon" },
{ id: "title", effort: "high", model: "meta/muse-spark-1.3" },
] as unknown as LoadedAgent[];
const note = agentEffortNote(agents, { compaction: "opencode", title: "opencode" }, []);
expect(note).toContain(
"has no effect for compaction, title: the id is also an OpenCode built-in agent",
);
expect(note).toContain("and run title on a model that takes a level");
expect(note).toContain("and give compaction one of low, medium, high");
// One note only: the built-in id is not also listed as a plain OpenCode or Google case.
expect(note?.split("has no effect").length).toBe(2);
});

test("agentEffortNote: a fixed-role reviewer on OpenAI is told only to rename", () => {
const agents = [
{ id: "verifier", effort: "max", model: "openai/gpt-6.2-astra" },
] as unknown as LoadedAgent[];
const note = agentEffortNote(agents, { verifier: "claude-code" }, []);
expect(note).toContain("Fix: rename the agent file");
expect(note?.endsWith("Fix: rename the agent file")).toBe(true);
});

test("agentEffortNote: reports both reasons in one note", () => {
const agents = [
{ id: "ios", effort: "high" },
{ id: "verifier", effort: "max" },
] as unknown as LoadedAgent[];
const note = agentEffortNote(agents, { ios: "opencode", verifier: "claude-code" });
expect(note).toContain("has no effect for ios: only the claude-code engine reads it");
const note = agentEffortNote(agents, { ios: "opencode", verifier: "claude-code" }, []);
expect(note).toContain("has no effect for ios: the model of each runs through OpenCode");
expect(note).toContain("; `effort` has no effect for verifier: the id is also a built-in pass");
});

test("agentEffortNote: a fixed-role reviewer on an OpenCode model is told to change the model too", () => {
test("agentEffortNote: a fixed-role reviewer on a model that takes no level is told to change the model too", () => {
const agents = [
{ id: "verifier", effort: "max", model: "openai/gpt-6-astra" },
{ id: "verifier", effort: "max", model: "meta/muse-spark-1.3" },
{ id: "coordinator", effort: "high", model: "anthropic/claude-opus-5-5" },
] as unknown as LoadedAgent[];
// The engine map describes the built-in passes (claude here), not the reviewer files.
const note = agentEffortNote(agents, { verifier: "claude-code", coordinator: "claude-code" });
expect(note).toContain("Fix: rename the agent file, and run verifier on an `anthropic/…` model");
const note = agentEffortNote(agents, { verifier: "claude-code", coordinator: "claude-code" }, []);
expect(note).toContain(
"Fix: rename the agent file, and run verifier on a model that takes a level",
);
expect(note).toContain("`REVIEWER_MODEL` when that is set");
expect(note).not.toContain("give verifier, coordinator");
expect(note).not.toContain("run verifier, coordinator");
});

test("agentEffortNote: a reviewer that shares a fixed role's id is told to rename", () => {
const agents = [{ id: "verifier", effort: "max" }] as unknown as LoadedAgent[];
const note = agentEffortNote(agents, { verifier: "opencode" });
const note = agentEffortNote(agents, { verifier: "opencode" }, []);
expect(note).toContain("has no effect for verifier: the id is also a built-in pass");
expect(note).toContain("Fix: rename the agent file");
expect(note).not.toContain("runs through OpenCode");
Expand Down
Loading