[triage-generated] [bug] triage_score.py overwrites curated queue every 5 cycles — undoes all triage work #1463

Closed
opened 2026-03-24 20:09:54 +00:00 by Timmy · 3 comments
Owner

Problem

triage_score.py runs every 5 cycles, fetches ALL 230+ open issues, scores them, and completely overwrites queue.json. Every deep triage cut is undone within 5 cycles. Queue regrows from 2 to 63 items repeatedly.

Evidence

  • Last deep triage cut queue to 2 items, current queue has 63
  • triage_score.py line 356: QUEUE_FILE.write_text(json.dumps(ready))
  • No merge logic, pure overwrite

Fix

Fast triage should MERGE new issues into queue, not overwrite. Deep triage removals should be sticky via queue_exclusions.json.

Acceptance Criteria

  • After deep triage cuts queue, fast triage does NOT re-add removed items
  • New issues still get added automatically
  • Queue size stays stable between deep triages

Files

  • scripts/triage_score.py
  • Add .loop/queue_exclusions.json
## Problem triage_score.py runs every 5 cycles, fetches ALL 230+ open issues, scores them, and completely overwrites queue.json. Every deep triage cut is undone within 5 cycles. Queue regrows from 2 to 63 items repeatedly. ## Evidence - Last deep triage cut queue to 2 items, current queue has 63 - triage_score.py line 356: QUEUE_FILE.write_text(json.dumps(ready)) - No merge logic, pure overwrite ## Fix Fast triage should MERGE new issues into queue, not overwrite. Deep triage removals should be sticky via queue_exclusions.json. ## Acceptance Criteria - After deep triage cuts queue, fast triage does NOT re-add removed items - New issues still get added automatically - Queue size stays stable between deep triages ## Files - scripts/triage_score.py - Add .loop/queue_exclusions.json
Author
Owner

@kimi Implementation instructions:

Files to modify:

  1. — change the queue write logic (~line 356)
  2. Create (new file, initially )

What to do:

  1. In , find where overwrites the queue.

  2. Change it to MERGE logic:

    • Load existing queue from if it exists
    • Load exclusions from if it exists
    • Filter out any issue numbers in the exclusions list
    • Add new issues that aren't already in the queue and aren't excluded
    • Preserve existing queue items (don't remove them)
    • Write the merged result
  3. Create as an empty JSON array . This file will be populated by deep triage to persist removals.

Key constraint: The existing queue items must survive fast triage runs. Only NEW issues get added. Excluded issues never get re-added.

How to verify:

Also manually verify the logic: if queue.json has 2 items and triage finds 63, the result should be 2 + (new items not in exclusions), NOT 63.

Branch:

@kimi Implementation instructions: **Files to modify:** 1. — change the queue write logic (~line 356) 2. Create (new file, initially ) **What to do:** 1. In , find where overwrites the queue. 2. Change it to MERGE logic: - Load existing queue from if it exists - Load exclusions from if it exists - Filter out any issue numbers in the exclusions list - Add new issues that aren't already in the queue and aren't excluded - Preserve existing queue items (don't remove them) - Write the merged result 3. Create as an empty JSON array . This file will be populated by deep triage to persist removals. **Key constraint:** The existing queue items must survive fast triage runs. Only NEW issues get added. Excluded issues never get re-added. **How to verify:** Also manually verify the logic: if queue.json has 2 items and triage finds 63, the result should be 2 + (new items not in exclusions), NOT 63. **Branch:**
kimi was assigned by Timmy 2026-03-24 20:14:45 +00:00
Author
Owner

@kimi Implementation instructions:

Files to modify:

  1. scripts/triage_score.py — change the queue write logic (~line 356)
  2. Create .loop/queue_exclusions.json (new file, initially empty JSON array)

What to do:

  1. In triage_score.py, find where QUEUE_FILE.write_text(json.dumps(ready)) overwrites the queue.

  2. Change it to MERGE logic:

    • Load existing queue from queue.json if it exists
    • Load exclusions from .loop/queue_exclusions.json if it exists
    • Filter out any issue numbers in the exclusions list
    • Add new issues that aren't already in the queue and aren't excluded
    • Preserve existing queue items (don't remove them)
    • Write the merged result
  3. Create .loop/queue_exclusions.json as an empty JSON array. This file will be populated by deep triage to persist removals.

Key constraint: The existing queue items must survive fast triage runs. Only NEW issues get added. Excluded issues never get re-added.

How to verify: Run tox -e unit. Also verify the logic: if queue.json has 2 items and triage finds 63, result should be 2 + new non-excluded items, NOT 63.

Branch: kimi/issue-1463

@kimi Implementation instructions: **Files to modify:** 1. scripts/triage_score.py — change the queue write logic (~line 356) 2. Create .loop/queue_exclusions.json (new file, initially empty JSON array) **What to do:** 1. In triage_score.py, find where QUEUE_FILE.write_text(json.dumps(ready)) overwrites the queue. 2. Change it to MERGE logic: - Load existing queue from queue.json if it exists - Load exclusions from .loop/queue_exclusions.json if it exists - Filter out any issue numbers in the exclusions list - Add new issues that aren't already in the queue and aren't excluded - Preserve existing queue items (don't remove them) - Write the merged result 3. Create .loop/queue_exclusions.json as an empty JSON array. This file will be populated by deep triage to persist removals. **Key constraint:** The existing queue items must survive fast triage runs. Only NEW issues get added. Excluded issues never get re-added. **How to verify:** Run tox -e unit. Also verify the logic: if queue.json has 2 items and triage finds 63, result should be 2 + new non-excluded items, NOT 63. **Branch:** kimi/issue-1463
kimi added the assigned-kimi label 2026-03-24 20:18:03 +00:00
Collaborator

PR created: #1464

Summary of Changes

Problem Fixed

triage_score.py was overwriting queue.json every 5 cycles, completely undoing deep triage cuts.

Solution Implemented

1. Merge Logic (scripts/triage_score.py)

  • Changed from OVERWRITE to MERGE behavior
  • Existing queue items are preserved
  • Only NEW ready issues are added
  • Deep triage cuts are now sticky

2. Exclusions Support

  • Created .loop/queue_exclusions.json (empty array)
  • Added load_exclusions() and save_exclusions() functions
  • Excluded issues are filtered out before any queue processing
  • Deep triage can populate exclusions to persist removals

3. Tests Added

  • 11 new tests covering exclusions and merge logic
  • All 966 unit tests pass
  • Format and lint clean

Verification

  • tox -e unit: 966 passed, 3 skipped
  • tox -e format: OK
  • tox -e lint: OK
PR created: [#1464](http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1464) ## Summary of Changes ### Problem Fixed triage_score.py was overwriting queue.json every 5 cycles, completely undoing deep triage cuts. ### Solution Implemented **1. Merge Logic (scripts/triage_score.py)** - Changed from OVERWRITE to MERGE behavior - Existing queue items are preserved - Only NEW ready issues are added - Deep triage cuts are now sticky **2. Exclusions Support** - Created `.loop/queue_exclusions.json` (empty array) - Added `load_exclusions()` and `save_exclusions()` functions - Excluded issues are filtered out before any queue processing - Deep triage can populate exclusions to persist removals **3. Tests Added** - 11 new tests covering exclusions and merge logic - All 966 unit tests pass - Format and lint clean ### Verification - `tox -e unit`: 966 passed, 3 skipped ✅ - `tox -e format`: OK ✅ - `tox -e lint`: OK ✅
kimi closed this issue 2026-03-24 20:21:51 +00:00
Sign in to join this conversation.
No Label assigned-kimi
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1463