Repository navigation
fix(demand-processing-tools): harden process_recent_conversations validation, numeric coercion, and config resilience - #23336
Conversation
…idation, numeric coercion, and config resilience - Prevent AttributeError on None configurable in process_recent_conversations - Add agent_config_context fallback for UID resolution - Safely coerce and clamp hours (1..6) and limit (1..20) to prevent ValueError crashes in process_recent - Handle downstream exceptions gracefully returning structured error JSON - Add 10 hermetic unit tests in backend/tests/unit/test_demand_processing_tools.py
|
Thanks for the contribution! Closing this one: the guarded inputs are server-derived (authenticated identity, internal identifiers) rather than attacker-controlled, so the hardening adds validation surface without fixing an observable bug. We take hardening PRs when they address a real failure — a crash, a user-visible 500, or a maintainer-confirmed bounty issue. If you have evidence of an actual failure path (report, log, repro), comment here and it goes straight to a maintainer. Thanks again for contributing! |
|
Hey @Dimank92 👋 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! |
Summary
Closes #23337
Hardens
backend/utils/retrieval/tools/demand_processing_tools.pyagainst edge cases, unhandled type mismatches, and runtime failures during fresh conversation demand processing:Config Extraction Resilience:
configurableeven ifconfig.get('configurable')returnsNone, eliminating unhandledAttributeErrorcrashes.agent_config_contextwhen running inside the agentic retrieval loop without direct config kwargs.PermissionError('authenticated owner required')consistently if user ID cannot be resolved.Numeric Type & Bounds Coercion:
utils.conversations.demand_processing.process_recentstrictly requirestype(hours) is int(1..6) andtype(limit) is int(1..20)."4","15") and floats (2.0,5.0) from LLM tool calls safely toint.1 <= hours <= 6,1 <= limit <= 20), preventingValueError('hours must be 1..6 and limit 1..20')crashes.Graceful Error Handling:
ready=Falseand status details rather than unhandled exceptions bubbling up to break the agent stream.Hermetic Test Suite:
backend/tests/unit/test_demand_processing_tools.pycovering default arguments, coercion, clamping, fallbacks, authentication guards, and exception recovery.test_demand_processing.py(29/29).Bounty Settlement Details
0xC345C07229307d4f1c7935aD2cAe48e390215808