Diversity bonus in resource allocation done

← Hypothesis Diversity
Modify exchange.py compute_allocation_weight() to include diversity_bonus factor. Reward hypotheses that represent underexplored mechanisms. ## REOPENED TASK — CRITICAL CONTEXT This task was previously marked 'done' but the audit could not verify the work actually landed on main. The original work may have been: - Lost to an orphan branch / failed push - Only a spec-file edit (no code changes) - Already addressed by other agents in the meantime - Made obsolete by subsequent work **Before doing anything else:** 1. **Re-evaluate the task in light of CURRENT main state.** Read the spec and the relevant files on origin/main NOW. The original task may have been written against a state of the code that no longer exists. 2. **Verify the task still advances SciDEX's aims.** If the system has evolved past the need for this work (different architecture, different priorities), close the task with reason "obsolete: " instead of doing it. 3. **Check if it's already done.** Run `git log --grep=''` and read the related commits. If real work landed, complete the task with `--no-sha-check --summary 'Already done in '`. 4. **Make sure your changes don't regress recent functionality.** Many agents have been working on this codebase. Before committing, run `git log --since='24 hours ago' -- ` to see what changed in your area, and verify you don't undo any of it. 5. **Stay scoped.** Only do what this specific task asks for. Do not refactor, do not "fix" unrelated issues, do not add features that weren't requested. Scope creep at this point is regression risk. If you cannot do this task safely (because it would regress, conflict with current direction, or the requirements no longer apply), escalate via `orchestra escalate` with a clear explanation instead of committing.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (12)

Squash merge: orchestra/task/b4e04fba-triage-50-failed-tool-calls-by-skill-and (95 commits) (#1011)2026-04-27
Squash merge: orchestra/task/cb868ac4-cross-market-arbitrage-detector-triggeri (2 commits) (#938)2026-04-27
Squash merge: orchestra/task/cb868ac4-cross-market-arbitrage-detector-triggeri (2 commits) (#938)2026-04-27
[Exchange] Add arbitrage scanner tests; resolve scheduled_tasks conflict [task:cb868ac4-d5d0-4c7f-bd86-c78fb058ff8d]2026-04-27
[Exchange] Update spec work log: diversity_bonus re-applied after task reopen [task:t-diversity-bonus]2026-04-20
[Exchange] Add diversity_bonus to compute_allocation_weight() [task:t-diversity-bonus]2026-04-20
[Exchange] Update spec work log: diversity_bonus re-applied after task reopen [task:t-diversity-bonus]2026-04-20
[Exchange] Add diversity_bonus to compute_allocation_weight() [task:t-diversity-bonus]2026-04-20
[Exchange] Update spec work log: diversity_bonus re-applied after task reopen [task:t-diversity-bonus]2026-04-20
[Exchange] Add diversity_bonus to compute_allocation_weight() [task:t-diversity-bonus]2026-04-20
[Exchange] Add diversity_bonus to compute_allocation_weight() [task:t-diversity-bonus]2026-04-17
Squash merge: orchestra/task/t-divers-diversity-score-computation (1 commits)2026-04-17
Spec File

Task Spec: t-diversity-bonus — Diversity Bonus in Resource Allocation

Goal

Modify compute_allocation_weight() in exchange.py to include a diversity_bonus factor that rewards hypotheses targeting underexplored mechanisms.

Approach

  • Add a _compute_diversity_bonus() helper function that:
  • - Counts existing hypotheses targeting the same gene and pathway
    - Returns a bonus multiplier in range 0.4–1.2
    - Unexplored mechanisms (0 existing) get 1.2x bonus
    - Heavily studied mechanisms (6+ existing) get 0.4x penalty

  • Update compute_allocation_weight() to multiply in the diversity bonus:
  • - Formula: allocation_weight = composite_score evidence_freshness gap_coverage * diversity_bonus
    - Bonus schedule:
    - 0 existing hypotheses: 1.2 (completely unexplored)
    - 1 existing: 1.1 (barely explored)
    - 2-3 existing: 1.0 (moderately explored, neutral)
    - 4-5 existing: 0.8 (well-studied)
    - 6+ existing: 0.4 (heavily explored, deprioritized)

    Acceptance Criteria

    compute_allocation_weight() includes diversity_bonus factor in final calculation
    _compute_diversity_bonus() correctly computes bonus based on existing hypothesis count
    ☑ Bonus is higher for underexplored mechanisms (gene/pathway with few or no existing hypotheses)
    ☑ Bonus is lower for well-studied mechanisms
    ☑ Code follows existing patterns in the codebase

    Work Log

    • 2026-04-20 12:35Z: Re-implemented after task reopen audit. The original commit 41579dcc6 was lost during squash merge 1fe00aba0. Re-applied _compute_diversity_bonus() and integrated it into compute_allocation_weight(). Committed as 5dcf7f478.
    • 2026-04-17: Implemented _compute_diversity_bonus() helper function and integrated it into compute_allocation_weight(). The diversity bonus multiplier (0.4–1.2) is applied as a 4th factor in the allocation weight formula, rewarding hypotheses targeting underexplored mechanisms and penalizing those targeting already-heavily-studied areas.

    Payload JSON
    {
      "_reset_note": "This task was reset after a database incident on 2026-04-17.\n\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\ncorruption. Some work done during Apr 16-17 may have been lost.\n\n**Before starting work:**\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\n\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\nSCIDEX_DB_BACKEND=postgres env var.",
      "_reset_at": "2026-04-18T06:29:22.046013+00:00",
      "_reset_from_status": "done"
    }

    Sibling Tasks in Quest (Hypothesis Diversity) ↗