Skip to content

Agent request body and headers do not reach V2 model requests #55009

Closed as duplicate

Description

@lazyayuan

Description

V2 accepts agent-level request.body and request.headers, but the Session model-request builder does not use them. A subagent can declare temperature in its Markdown frontmatter and load successfully while the provider request omits that value.

The Agents documentation currently notes this limitation. Related: #49550, which also covers request.settings. This report is limited to body/header overlays; it does not cover settings such as transport or timeouts.

OpenCode version

V2 dev at 15b24ae (package version 2.0.27).

Steps to reproduce

  1. Create .opencode/agents/reviewer.md:
---
description: Reviews changes
mode: subagent
request:
  body:
    temperature: 0.2
  headers:
    x-agent-probe: reviewer
---
Review the current changes.
  1. Use an OpenAI-compatible model that supports temperature and dispatch the reviewer subagent.
  2. Inspect the provider request. The agent's temperature and custom header are not applied.

A local regression at SessionModelRequest.prepare reproduces the omission without a live model: the configured temperature is absent before the context hook. Config loading populates the agent record, but callers pass only the agent ID to the request builder.

Expected: apply the selected agent's body/header overlays to its model requests, retaining plugin overrides and runtime-owned session headers.

Plugins

None required by the regression.

Operating System

macOS; the omission is in the platform-independent request builder.

Activity

  1. opencode-agent commented on Oct 13, 2026

    @opencode-agent
    Contributor

    Thanks for the precise report and the regression pointer! I think this is a duplicate of #49550. It covers the same gap: the agent's request overlay (settings, headers and body) is loaded from config, but SessionModelRequest.prepare never reads it, so agent-level temperature (and headers from the same request object) never reach the provider. That issue asks for agent overlays to be applied on top of the model and variant overlays, so a fix there should cover request.headers as well as request.body. Adding the headers case and your regression location to #49550 would help.

    Possible duplicates and related issues, ordered from most to least likely:

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #49550. We haven't heard back in the day since the duplicate notice. That issue covers the same problem: the agent's request overlay is loaded from config, but the model-request builder never applies it. Since headers is part of the same request object, a fix there should cover your request.headers case as well as request.body (e.g. temperature). Please follow #49550 for progress, and feel free to add the headers case and your SessionModelRequest.prepare regression there. If your problem turns out to be different, reply here and we can reopen. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions