Fix/malformed UUID in taskiq triggers worker - #6300
Conversation
…hs in dispatch_schedule
|
@oforiwaasam is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesTrigger schedule UUID guards
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change safely skips malformed trigger identifiers instead of raising, with targeted tests covering the affected paths; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
Summary
dispatch_schedule(the scheduled-trigger worker task) calledUUID(project_id)andUUID(str(queued_schedule_id))with no error handling. A malformed identifier in either field raised an uncaughtValueError, crashing the task outright instead of skipping gracefully. This was inconsistent with every other guard clause in the function, which log and return on bad input rather than raising.This PR fixes that by wrapping both UUID conversions in a
try/except ValueErrorthat logs a warning and returns, matching the existing skip-on-bad-input pattern already used elsewhere in dispatch_schedule (e.g. the missing-identifier and deleted/inactive-schedule checks).Testing
Verified locally
Ran the targeted test file directly before and after:
uv run --no-sync python run-tests.py oss/tests/pytest/unit/triggers/test_triggers_worker_lifecycle.py: 5 tests passed before, 8 passed after (3 new tests added, all green, no regressions in the existing 5). See screenshots below:Test Results BEFORE changes
Test results logs
Generated test report
Test Results AFTER changes
Generated test report
Added or updated tests
Added three tests to
oss/tests/pytest/unit/triggers/test_triggers_worker_lifecycle.py:test_schedule_task_skips_when_no_schedule_or_schedule_id_provided— neither schedule_id nor schedule given; asserts the DAO is never queried.test_schedule_task_skips_malformed_project_id— valid schedule_id, malformed project_id; asserts the task returns before the DAO lookup instead of raising.test_schedule_task_skips_malformed_schedule_id— valid project_id, malformed schedule_id; asserts the task returns before the DAO lookup instead of raising.Linting/Formatting Validation
QA follow-up
N/A; backend worker fix with unit coverage for all affected branches; no user-facing flow to validate manually.
Demo
N/A
Checklist
Contributor Resources
Issue
Closes #5935