Repository navigation
Conversation
…e, and numeric coercion
|
Solid, well-scoped hardening — the production changes are correct and the new tests are genuinely hermetic; leaving for a maintainer to merge. Findings on dd1558b: backend/utils/retrieval/tools/file_tools.py
backend/tests/unit/test_file_tools_resilience.py
Security: improves input validation on an agent-facing tool; no new data exposure or dependency surface. Performance: pure local validation, negligible. Blast radius: single tool (search_files_tool). USER IMPACT: none — internal change; malformed agent tool calls now degrade gracefully (full-file search / clear error) instead of failing. Nothing blocking from my side. Optional nice-to-have: a case for set-typed file_ids and for file_ids containing non-string members (int coerced via str(fid).strip()) to lock in the coercion contract. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Hey @ghazy2001 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Failure-Class: none
Summary
Hardens
backend/utils/retrieval/tools/file_tools.py(search_files_tool) against model hallucinated parameters, config structure variations, and numeric coercion faults:Defensive Question Validation:
questionis a non-empty, non-whitespace string, preventing empty/invalid queries from being sent to downstream file-chat processors.Config Resilience & Top-Level / UID Fallbacks:
uidandchat_session_idfrom nestedconfigurableas well as top-levelconfig, supporting bothuser_idanduidkeys.None.get()pattern with safe dict lookups, avoiding unhandledAttributeError.uidandchat_session_idare resolved before querying session data.file_idsNormalization & Type Safety:file_ids="file_123") into a single-element list, avoiding Python string character iteration bugs.TypeError.Numeric Coercion & Bounds for Video Windows:
_parse_seconds()helper to parse numeric string arguments (e.g.start_seconds="10.5") to float while filtering out non-numeric inputs,NaN, andInf.>= 0.0and ensures valid(start, end)spans.Hermetic Test Suite:
backend/tests/unit/test_file_tools_resilience.pywith 11 comprehensive unit tests (11/11 passing hermetically).test_file_tools_sanitization.py(4/4 passing).Bounty Proposal ($50 USD)
[email protected]).