Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🗂️ fix: Route read_file Through the Stateful Code Session (#14259)
Danny Avila1ca7e78f4906
diff --git a/packages/api/src/agents/__tests__/run-codeTools.test.ts b/packages/api/src/agents/__tests__/run-codeTools.test.tsindex 8fa6783aa4..4df39192ef 100644--- a/packages/api/src/agents/__tests__/run-codeTools.test.ts+++ b/packages/api/src/agents/__tests__/run-codeTools.test.ts@@ -104,10 +104,10 @@ describe('createRun code-tool eager/session wiring', () => {);});- it('declares create_file/edit_file as code-session participants', async () => {+ it('declares create_file/edit_file/read_file as code-session participants', async () => {const runConfig = await captureRunConfig();expect(runConfig.codeSessionToolNames).toEqual(- expect.arrayContaining(['create_file', 'edit_file']),+ expect.arrayContaining(['create_file', 'edit_file', 'read_file']),);});});diff --git a/packages/api/src/agents/run.ts b/packages/api/src/agents/run.tsindex d3264ee5d6..e55cc4845d 100644--- a/packages/api/src/agents/run.ts+++ b/packages/api/src/agents/run.ts@@ -1495,13 +1495,17 @@ export async function createRun({...agents.flatMap((agent) => agent.backgroundToolNames ?? []),],},- // Let host file-authoring tools share the code-execution sandbox session so- // a file created with create_file/edit_file is visible to later+ // Let host file tools share the code-execution sandbox session so a file+ // created with create_file/edit_file is visible to later// execute_code/bash_tool calls (and vice versa). The SDK folds these tools'// returned exec session/files into the shared code session and injects the- // existing session into their requests. Requires @librechat/agents with- // codeSessionToolNames support (agents#283); older versions ignore it.- codeSessionToolNames: [CREATE_FILE_TOOL_NAME, EDIT_FILE_TOOL_NAME],+ // existing session into their requests. Membership here also stamps the+ // stateful `runtimeSessionHint` and excludes the tool from eager execution+ // — read_file needs both, or its sandbox `cat` runs hintless on the Code+ // API's per-user default runtime session and cannot see files bash_tool+ // just wrote in the conversation's session. Requires @librechat/agents+ // with codeSessionToolNames support (agents#283); older versions ignore it.+ codeSessionToolNames: [CREATE_FILE_TOOL_NAME, EDIT_FILE_TOOL_NAME, Constants.READ_FILE],// Derive the Langfuse trace id deterministically from runId so message// feedback can be scored against the trace without a lookup (see the// feedback route in api/server/routes/messages.js). No-op unless Langfuse