Skip to content

Commit f109a1c

Browse files
jlguerreiroclaude
andcommitted
feat: propagate session ID to tool subprocesses
Set OPENCODE_SESSION_ID and OPENCODE_TOOL_PART_ID environment variables on bash tool child processes so external tooling can correlate subprocess activity with the originating session. Closes anomalyco#15739 Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 0a3a321 commit f109a1c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎packages/opencode/src/tool/bash.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export const BashTool = Tool.define("bash", async () => {
175175
env: {
176176
...process.env,
177177
...shellEnv.env,
178+
OPENCODE_SESSION_ID: ctx.sessionID,
179+
...(ctx.callID && { OPENCODE_TOOL_PART_ID: ctx.callID }),
178180
},
179181
stdio: ["ignore", "pipe", "pipe"],
180182
detached: process.platform !== "win32",

0 commit comments

Comments
 (0)