Repository navigation
fix(chat): conversation uploads stop reading at the size cap and respect a per-user quota (#20217) - #20668
Conversation
… the orphan one (#20234)
…nup-proposals # Conflicts: # repo_tests/no_tracked_key_material_test.py
…used removals capped (#20234)
…ls (#20234) # Conflicts: # repo_tests/autobot_has_no_pro_edition_19982_test.py
…ls (#20234) # Conflicts: # repo_tests/credential_field_name_only_17336_test.py # repo_tests/enum_hand_copy_guard_test.py # repo_tests/slm_node_id_one_home_19322_test.py
…duplicate proposals (#20234)
…ls' into issue-20234-file-cleanup-proposals
…8n baselines name its keys (#20234)
…uth failure, hiding only on 401/403 (#20234)
…ect a per-user quota (#20217)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Code review on PR #20668 (head 99a8d00): changes needed. Read against the diff and
Not checked: the #20195 decision comment for the third criterion (don't tick it without quoting that comment), upstream body-size middleware, whether dedupe by hash skips the check, and how many backend workers run. |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
Auto-sync: merging
|
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 7d9d28808 |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | c1c8d1592 |
fix(chat): attachments need the strict session posture, stay out of checkpoints, and gate every tool call (#20195) | #20195 |
| main | 19e3294fc |
fix(chat): an owning writer may delete, and attachments count against the model window (#20195) | #20195 |
| main | 72f457651 |
fix(chat): owners list, download, preview and delete their own conversation files (#20195) | #20195 |
| this branch | 79b2760eb |
fix(chat): upload quota enforced in the store path with stable error codes and a pending-removal split (#20217) | #20217 |
| this branch | 99a8d00b5 |
fix(chat): conversation uploads stop reading at the size cap and respect a per-user quota (#20217) | #20217 |
scripts/python_file_size_known_large.py
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 4a9cc5958 |
Merge main into the merge train (#20667) | #20667 |
| main | a35798d47 |
Merge #20401 @ 7d9d288 into the merge train | #20401 |
| main | d9e618ade |
Merge remote-tracking branch 'origin/main' into issue-20628-slm-admin-only | none |
| main | 7d9d28808 |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | 0d126afa8 |
Merge remote-tracking branch 'origin/main' into issue-20195-attachments-reach-answer | none |
| main | 67302bbda |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | e8ba5cf63 |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | 5aa9c9d72 |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | 47e8e75e5 |
fix(chat): attachment approvals reach the graph, the floor sticks to the chat, admin setting can lift it (#20195) | #20195 |
| main | 2f5cf21c2 |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | 2bbd16812 |
fix(chat): strict attachment check on resume, bounds by content, bounded one-read extraction (#20195) | #20195 |
| main | 0496e5c48 |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | c1c8d1592 |
fix(chat): attachments need the strict session posture, stay out of checkpoints, and gate every tool call (#20195) | #20195 |
| main | 8a1cd6074 |
chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) | #20195 |
| main | cf26562f0 |
fix(chat): attached files reach the answer as bounded untrusted data (#20195) | #20195 |
| main | 1 more commit(s) not listed | ||
| this branch | 4d26a27ba |
fix(chat): coded 413 on create/generate size cap, translated create refusal, dedupe keeps bytes (#20217) | #20217 |
| this branch | 9f6e3f8fa |
Merge remote-tracking branch 'origin/issue-20233-chat-file-defects' into issue-20233-chat-file-defects | none |
| this branch | 79b2760eb |
fix(chat): upload quota enforced in the store path with stable error codes and a pending-removal split (#20217) | #20217 |
| this branch | 7cebb14d6 |
Merge main into issue-20233-chat-file-defects (auto-sync) [skip ci] | none |
| this branch | 99a8d00b5 |
fix(chat): conversation uploads stop reading at the size cap and respect a per-user quota (#20217) | #20217 |
|
Code review on PR #20668 (head 4fad5e7): approve. Covers the merge of #20540 only, read at the resolved tree; tests not re-run. The upload path keeps a single read and uses |
Closes #20217
Lands after #20540. It reads the same
file_cleanup_queuepredicate: a deleted file counts only while its queue row is unprocessed. Without #20540, nothing processes those rows, so deleted bytes keep counting. Conflicts are expected inconversation_file_manager.py,conversation_file_route_api.py,en.jsonand the i18n ratchet.Thinking Path
await file.read()buffered the whole body before the size check, so an oversize upload still cost its full size in memory./files/createand agent-create. Every way in ends atadd_file, so that's where the quota belongs.What Changed
api/conversation_file_upload.py:_read_withinreads 1 MiB chunks and refuses once past the limit.New
conversation_file_quota.py:USER_QUOTA_BYTESfromAUTOBOT_CONVERSATION_FILE_USER_QUOTA_BYTES(default 1 GiB),insert_within_quota,resize_within_quota,usageandquota_refusal._insert_file_recordin the manager calls it.A 413 carries
detail = {code, message, figures}:conversation_file_too_largeorconversation_file_quota_exceeded, withlive_bytes,pending_removal_bytes,limit_bytesandremaining_bytes.conversationFileUpload.tsmaps those codes to i18n keys. When deleted bytes still count, the text says removal is awaiting human review. There is no purge of any kind.idx_conversation_files_uploaded_byon(uploaded_by, is_deleted), through the schema file and migration 001's expected set. These tables live in their own SQLite database, not alembic.Three English-only keys with baselines raised; size ceilings lowered.
_validate_file_sizeraises the same coded refusal, so/files/createand/generateanswer 413 withconversation_file_too_large.useConversationFiles.tsmaps it through the shared keys, andextractApiErrorMessagereturnsdetail.messagefor an object.copy_filere-raises a refusal, and a failed deduplicated add no longer removes the existing file's bytes.Open decision
Agent-created files are charged to the agent's name, so all users share one agent bucket and one user's agent can lock out everyone else's. That is the current behaviour here, and the maintainer decision is #20678.
uploaded_by IS NULLis one shared bucket under the same quota.Behaviour to review
copy_filestores no new bytes, so it has no quota.Verification
test_concurrent_writers_cannot_overshoot_the_quota: 8 manager instances on one real database file, a 25-byte quota, 10-byte files. Exactly 2 stored, 6 refused, no refused bytes on disk.conversation_file_quota_store_20217_test.py, upload limits, owner upload, real manager and review tests, and two ratchets: 114 passed.check_env_var_registry_test.py: 25 passed.conversationFileUpload.spec.ts: 18 passed, withreka-uistubbed.vue-tsc, ESLint,ChatInputtests, a manual chat UI check, and any full suite.Model Used
Claude Opus 5.5
Refs #20233