anomalyco / anomalyco/opencode

[BUG]: agent-level `request.body` and `request.settings` are populated from config and never reach the provider

Open
#49,550 1 comment 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Sep 17, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

An agent carries a request field (packages/schema/src/agent.ts:27, request: Provider.Request),
where Provider.Request is { settings, headers, body } (packages/schema/src/provider.ts:55-59).
Config populates it, and that population is covered by a test. Nothing on the request path ever
reads it, so per-agent generation settings are silently ignored.

Writer, packages/core/src/config/plugin/agent.ts:112-113:

Object.assign(agent.request.headers, item.request.headers ?? {})
Object.assign(agent.request.body, item.request.body ?? {})

Covered by test, packages/core/test/config/agent.test.ts:129:

expect(agent.request).toEqual({ settings: {}, headers: {}, body: { temperature: 0.5 } })

Never read. packages/core/src/session/model-request.ts receives the agent as Agent.Info
(:74) and reads exactly one field off it — input.agent.system (:84-85) — plus input.agent
as scope identity (:206). Generation options have a single source: the draft is seeded empty at
:217 (options: {}) and filled only by whatever a session context/generate hook writes,
then split at :229-231. Nothing seeds it from the agent.

The same key works one level up. packages/core/src/model-resolver.ts:154 merges
model.body with variant.body, and :253 merges credential metadata, so a temperature set on
a model or variant reaches the wire. The identical key on an agent does not, and there is no
warning either way.

Observed: an agent configured with temperature: 0.1 and maxOutputTokens: 32768 produced a
provider request carrying neither. Confirmed on the wire by the Magic Context plugin's test
harness against a mock provider; the same absence is visible in the source path above.

Expected: either agent-level request participates in request preparation the way model- and
variant-level overlays do, or — if it is deliberately inert on v2 — the field should be removed
from the agent schema so config that sets it fails loudly instead of doing nothing.

I have not filed a PR because the intended precedence between agent, model and variant overlays is
a design decision rather than an obvious fix, and I would rather have that answered first.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.