Repository navigation
Conversation
f8dff3e to
21bb83b
Compare
…mory tools Failure-Class: none Sanitize raw unexpected exception disclosure across get_action_items_tool, create_action_item_tool, update_action_item_tool, and search_memories_tool.
21bb83b to
efbed4a
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @Mateidslx — sanitizing raw exception details out of agent-facing tool output is a worthwhile hardening change, and the production-side edits here look right. The blocking problems are in the new tests and one undocumented behavior change.
backend/utils/retrieval/tools/action_item_tools.py — Good: the three except blocks now return clean strings ('Error retrieving action items', 'Error creating action item', 'Error updating action item') while still logging the full error via logger.error/traceback, so debuggability is preserved.
backend/utils/retrieval/tools/memory_tools.py — The search_memories_tool sanitization matches the pattern above. One concern: this PR also prepends memory_id: to the agent-visible evidence suffixes in get_memories_tool (~line 326) and search_memories_tool (~line 493). That's a real behavior change to the evidence format the agent sees, it isn't mentioned in the PR description, and it has no test coverage. Please either move it to its own PR with tests, or keep it here but document it in the description and add a test for the suffix format.
backend/tests/unit/test_action_item_and_memory_tools_sanitization.py — All four tests currently fail in CI (Backend unit shard 2/4), for three separate reasons in the test code itself:
- The first three tests call
action_item_tools.get_action_items_tool(...)etc. directly, but these are langchain@tool-decoratedStructuredToolobjects, so CI hitsTypeError: 'StructuredTool' object is not callable. Call the underlying function via.func, as tests/unit/test_calendar_tools_sanitization.py does (e.g.get_calendar_events_tool.func(...)). - The update test patches
action_items_db.update_action_item_description, which doesn't exist — the tool callsaction_items_db.update_action_item(action_item_tools.py:635). The search test patchesutils.retrieval.tools.memory_tools.memory_service, which also doesn't exist —MemoryService(db_client=firestore_db)is instantiated locally (memory_tools.py:443). Patchutils.memory.memory_service.MemoryServiceinstead. - The assertion strings don't match the implementation: the tests expect 'Error: Failed to retrieve action items.' / 'Error: Failed to create action item.' / 'Error: Failed to update action item.' / 'Error searching memories: Failed to search memories.', but the tools (in this PR) return 'Error retrieving action items', 'Error creating action item', 'Error updating action item', and 'Error searching memories'. Align the assertions with the actual strings.
Once the tests are fixed and green, this should be a clean, low-risk hardening change — happy to re-review.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
… with exact sanitized returns
|
Updated! Reverted the |
Dismissed: all three concerns from this review are resolved on head 4374d4f — tests now invoke tools via .func, mock targets corrected (action_items_db.update_action_item, MemoryService.search), assertions aligned, and the memory_id evidence-suffix change was reverted in 895601c. New tests pass in CI.
|
Thanks @Mateidslx — all three blocking points from the earlier review are resolved on this head, and the new tests now pass in CI (Backend unit shard 3/4): test_action_item_and_memory_tools_sanitization.py — Tools are invoked via memory_tools.py — The undocumented action_item_tools.py — The three except blocks return clean strings while Note on CI: the red 'Backend unit suite' is not from this PR. This is a worthwhile hardening change — internal exception details (DB errors, connection strings) no longer reach agent-visible tool output. Leaving for human maintainer review before merge. by AI on behalf of David — if you need David's attention urgently, please @Git-on-my-level and escalate with |
|
Thanks @Mateidslx — verified this end to end at the current head, and it's a solid, security-positive change. What I checked per file:
Two optional follow-ups, non-blocking: the date-format Note on CI: the "Backend unit suite" failure is the fork-PR gate (annotations say a maintainer needs to add Leaving the merge call to a human maintainer; adding Feedback generated by AI on behalf of the maintainers by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Closing per the maintainer's bounty-policy ruling (2026-10-01). The maintainer reviewed this batch of exception-sanitization PRs: the underlying issues are real but minor, and the ask (per-PR bounties on a templated sweep) doesn't fit how bounties are awarded here. The genuinely valuable fix in this family — Firebase ID token verification error reflection on the OAuth token endpoint (#16029) — has been cherry-picked and re-landed with full credit at #20168. The remainder of the sweep is being closed rather than paid or merged piecemeal. If you believe a specific PR in this set addresses a serious issue (user-visible crash, data exposure beyond error-detail hygiene, security impact beyond internal message leakage), comment on it and a maintainer will take a direct look — that path stays open. Thanks for the contributions; the oauth fix was good work. by AI on behalf of David — if you need David's attention urgently, please @Git-on-my-level and escalate with |
|
Hey @Mateidslx 👋 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
Sanitizes raw unexpected exception details across action item and memory retrieval tools:
get_action_items_toolcreate_action_item_toolupdate_action_item_toolsearch_memories_toolChanges
{str(e)}error returns with safe, clean error strings while logging error types internally for debugging.