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
co-authored by Dustin Deus
parent 9b8282ad3d
commit aa8fc4234d
3 changed files with 26 additions and 2 deletions
+8
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)