From 69c40d6c98549a3fd8cce540a7d0458df5ecb2c8 Mon Sep 17 00:00:00 2001 From: Naveen Chatlapalli Date: Thu, 29 Jan 2026 01:19:52 -0600 Subject: [PATCH] fix(agents): pass contextFiles to createAgentSession for openai-completions API Previously, `contextFiles` was resolved from workspace bootstrap files (SOUL.md, USER.md, IDENTITY.md) and embedded into the system prompt via `buildEmbeddedSystemPrompt`, but an empty array `[]` was passed to `createAgentSession`. Some providers using the openai-completions API may use the `contextFiles` parameter directly instead of relying solely on the system prompt override. This fix ensures bootstrap files are passed both: 1. Embedded in the system prompt (existing behavior) 2. Via the `contextFiles` parameter to `createAgentSession` This addresses the issue where models using openai-completions API (like Ollama) were not receiving workspace bootstrap file content. Fixes #3775 Co-Authored-By: Claude Opus 4.5 --- src/agents/pi-embedded-runner/compact.ts | 2 +- src/agents/pi-embedded-runner/run/attempt.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agents/pi-embedded-runner/compact.ts b/src/agents/pi-embedded-runner/compact.ts index 2dc4c5325..8545fba01 100644 --- a/src/agents/pi-embedded-runner/compact.ts +++ b/src/agents/pi-embedded-runner/compact.ts @@ -397,7 +397,7 @@ export async function compactEmbeddedPiSessionDirect( sessionManager, settingsManager, skills: [], - contextFiles: [], + contextFiles, additionalExtensionPaths, })); diff --git a/src/agents/pi-embedded-runner/run/attempt.ts b/src/agents/pi-embedded-runner/run/attempt.ts index e83c3ae4a..eb43cd282 100644 --- a/src/agents/pi-embedded-runner/run/attempt.ts +++ b/src/agents/pi-embedded-runner/run/attempt.ts @@ -460,7 +460,7 @@ export async function runEmbeddedAttempt( sessionManager, settingsManager, skills: [], - contextFiles: [], + contextFiles, additionalExtensionPaths, })); if (!session) {