Skip to content

Commit e89527c

Browse files
authored
feat: Send x-session-affinity and x-parent-session-id headers (#20744)
1 parent aa2239d commit e89527c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/opencode/src/session/llm.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export namespace LLM {
2525
export type StreamInput = {
2626
user: MessageV2.User
2727
sessionID: string
28+
parentSessionID?: string
2829
model: Provider.Model
2930
agent: Agent.Info
3031
permission?: Permission.Ruleset
@@ -301,6 +302,8 @@ export namespace LLM {
301302
"x-opencode-client": Flag.OPENCODE_CLIENT,
302303
}
303304
: {
305+
"x-session-affinity": input.sessionID,
306+
...(input.parentSessionID ? { "x-parent-session-id": input.parentSessionID } : {}),
304307
"User-Agent": `opencode/${Installation.VERSION}`,
305308
}),
306309
...input.model.headers,

packages/opencode/src/session/prompt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
15121512
agent,
15131513
permission: session.permission,
15141514
sessionID,
1515+
parentSessionID: session.parentID,
15151516
system,
15161517
messages: [...modelMsgs, ...(isLastStep ? [{ role: "assistant" as const, content: MAX_STEPS }] : [])],
15171518
tools,

0 commit comments

Comments
 (0)