fix(agent): preserve upload Markdown provenance - #4691
Open
PeaceMaker-best wants to merge 8 commits into
Open
Conversation
|
|
PeaceMaker-best
marked this pull request as ready for review
August 5, 2026 05:28
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.
Why
Web upload responses already identify the converted Markdown companion through
markdown_file, including collision-renamed files such asa_1.md. That provenance was dropped before Agent execution, soUploadsMiddlewareguessed<stem>.md. With same-stem uploads, the Agent could receive another document's outline; an explicit no-conversion result could also accidentally fall back to an unrelated Markdown file.The explicit companion path was also validated separately from the later read. A writable sandbox process could replace the file between those operations and make unrelated content enter
<current_uploads>.What changed
markdown_fileprovenance in current-turn web-upload message metadata and use one shared frontend mapper for optimistic and submitted messages.<stem>.mdfallback, explicitnulldisables fallback, and a valid string selects only the named companion.O_NOFOLLOWon POSIX and pinned, verified native handles on Windows.<current_uploads>block and document the compatibility contract.Surface area
frontend/backend/appdocker/or sandboxed executionskills/Screenshots / Recording
Not applicable; this changes upload metadata propagation and Agent grounding, with no visual UI change.
Bug fix verification
frontend/tests/unit/core/uploads/message-files.test.tsandbackend/tests/test_uploads_middleware_core_logic.py.Validation
git diff --checkpassed.origin/mainhad the exact same 132 failing node IDs (intersection 132, branch-only 0).AI assistance
Tool(s) used: Codex
How you used it: Codex helped investigate the bug, draft the approved design, implement the change with RED/GREEN tests, run full validation, and perform independent task-level and final security reviews. This Draft PR intentionally leaves the human responsibility confirmation unchecked until the author personally reviews every line.