fix(core): add session correlation header (#36842)

Co-authored-by: Dustin Deus <deusdustin@gmail.com>
This commit is contained in:
opencode-agent[bot] 2026-07-14 14:59:22 +02:00 committed by GitHub
commit aa8fc4234d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 2 deletions

View file

@ -51,6 +51,7 @@ import { AgentNotFoundError, StepFailedError } from "../error"
import { toSessionError } from "../to-session-error"
import { SessionRunnerRetry } from "./retry"
import { PluginSupervisor } from "../../plugin/supervisor"
import { Flag } from "../../flag/flag"
type StepTokens = {
readonly input: number
@ -197,6 +198,13 @@ const layer = Layer.effect(
const promptCacheKey = /^ses_[0-9a-f]{64}$/.test(session.id) ? session.id.slice(4) : session.id
const request = LLM.request({
model,
http: {
headers: {
"x-opencode-project": session.projectID,
"x-opencode-session": session.id,
"x-opencode-client": Flag.OPENCODE_CLIENT,
},
},
providerOptions: { openai: { promptCacheKey } },
system: [agentInfo.system ? agentInfo.system : SessionRunnerSystemPrompt.provider(model), history.initial]
.filter((part): part is string => part !== undefined && part.length > 0)