feat: Allow large file uploads (up to 100 MB) for code interpreter agents with LLM prompt truncation#1
Open
Copilot wants to merge 3 commits intorelease/v3.0from
Open
Conversation
Co-authored-by: kleincode <10796927+kleincode@users.noreply.github.com>
Copilot stopped work on behalf of
kleincode due to an error
March 10, 2026 14:38
Co-authored-by: kleincode <10796927+kleincode@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update file upload limits for code interpreter access
feat: Allow large file uploads (up to 100 MB) for code interpreter agents with LLM prompt truncation
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, all uploaded files were subject to a token limit (~100k tokens) and rejected if exceeded. This adds a two-tier file handling strategy based on whether the target agent has code interpreter access.
Behavior changes
Agents with code interpreter (
PythonTool):CODE_INTERPRETER_MAX_FILE_SIZE_BYTES)CODE_INTERPRETER_FILE_TOKEN_THRESHOLD), only the first and last 1,000 tokens (configurable viaCODE_INTERPRETER_FILE_TOKEN_CONTEXT_SIZE) are injected into the LLM prompt, with a note that the full file is available to the code interpreterAgents without code interpreter: unchanged — token limit rejection still applies.
Implementation
projects_file_utils.py):categorize_uploaded_files()receiveshas_code_interpreterflag, bypasses token-count rejection, enforces 100 MB size cap insteadchat_utils.py):convert_chat_history()receiveshas_code_interpreter+ tokenizer; calls_truncate_file_text_for_code_interpreter()for oversized files, replacing the middle with an omission noticedb/persona.py):persona_has_code_interpreter_tool()checks if a persona hasPythonToolattached; called at upload time usingpersona_idpassed from the frontendprocess_message.py): detectsPythonToolin the constructed tool list, passeshas_code_interpreter=Trueand a tokenizer toconvert_chat_history()app_configs.py:CODE_INTERPRETER_FILE_TOKEN_THRESHOLD,CODE_INTERPRETER_FILE_TOKEN_CONTEXT_SIZE,CODE_INTERPRETER_MAX_FILE_SIZE_BYTESuploadFiles()/beginUpload()now accept and forwardpersonaIdso the backend can gate the size limit per agentHow Has This Been Tested?
_truncate_file_text_for_code_interpreter()(short/exact/large files, first+last token coverage)categorize_uploaded_files()covering: size cap rejection for CI agents, token limit bypass for CI agents, token limit enforcement for non-CI agents, skip-threshold global overrideAdditional Options
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
disposable.github.io/home/REDACTED/work/onyx/onyx/.venv/bin/pytest pytest tests/unit/ --ignore=tests/unit/model_server -x(dns block)huggingface.co/home/REDACTED/work/onyx/onyx/.venv/bin/pytest pytest tests/unit/onyx/server/features/test_projects_file_utils.py -xvs(dns block)If you need me to access, download, or install something from one of these locations, you can either:
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.