Skip to content

[Bounty Proposal] fix(staged_tasks): filter completed entities in creation dedup and default relevance_score for index sorting ($50 proposed) #21875

Closed as not planned

Description

@hardik4love-lang

Summary

backend/database/staged_tasks.py contains two subtle lifecycle and query defects that prevent users from creating new staged tasks when a historic task shared the same normalized description, and silently drop newly created staged tasks from get_staged_tasks queries in Firestore:

  1. Stale Completed Staged Task Dedup Deadlock (create_staged_task):
    • create_staged_task loops over col.stream() and deduplicates by normalized description without checking doc.get('completed').
    • When a user previously completed, promoted, or dismissed a staged task with that description, create_staged_task returns the stale completed document instead of creating a fresh candidate.
    • The returned document has completed=True, making it invisible to get_staged_tasks(uid) (which filters where('completed', '==', False)) and permanently blocking subsequent promotions via promote_staged_task (if staged.get('completed'): return None).
  2. Missing relevance_score Dropping Staged Tasks from Firestore Queries:
    • create_staged_task only sets relevance_score if explicitly passed in kwargs.
    • In Firestore, queries with order_by('relevance_score') silently omit any document that lacks the sorted field.
    • Consequently, staged tasks created without an explicit relevance_score are never returned by get_staged_tasks or selected by get_top_staged_task_for_promotion.

Solution

  1. In create_staged_task, filter out completed staged tasks during the deduplication loop (if data.get('completed'): continue) so deduplication only matches against active candidates.
  2. Default relevance_score to 0 when omitted, ensuring every stored staged task is immediately sortable and indexable by Firestore query planners.
  3. Added comprehensive unit tests in backend/tests/unit/test_staged_tasks_dedup.py covering both behaviors (18/18 tests pass).

Proposed Bounty

** proposed**

Activity

  1. moved this from Someday to In progress in omi TODO / bountieson Oct 16, 2026
  2. ayqy commented on Oct 17, 2026

    @ayqy

    @josancamon19 I see #21876 is open for this issue. Is there still a separate paid assignment for the complete #21875 fix, or is the work already covered?

    I read the current staged_tasks.py: creation can reuse completed matches, and rows without relevance_score are excluded from ordered reads. I would preserve active-task dedup, cover fresh creation and both list/top-promotion queries, and include the full regression coverage.

    If the work is available, could you confirm the target revision and full acceptance, approved fixed amount/currency (the title says $50 proposed), and a payout route for a mainland-China individual, including fees and timing? Then I can agree the complete scope and delivery time before starting.

  3. undivisible commented on Oct 22, 2026

    @undivisible
    Collaborator

    Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏

  4. moved this from In progress to In review in omi TODO / bountieson Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions