P2-04: Dead code in ensemble.py — majority_decision computed but never used #14

Closed
opened 2026-06-16 13:57:01 +00:00 by Artur · 0 comments
Owner

Severity: P2 (Medium)
File: decider/ensemble.py lines 83-88

Problem

majority_decision is computed at line 83-86 but never referenced afterward. decision is recomputed identically at lines 90-95:

majority_decision = (
    "auto_approve" if weighted_score >= 0.65
    else ("ask_user" if weighted_score >= 0.35 else "abort")
)
agreeing = sum(1 for v in valid_votes if v["decision"] == majority_decision)
agreement = agreeing / len(valid_votes) if valid_votes else 0

if weighted_score >= 0.65:
    decision = "auto_approve"
...

Duplicated threshold logic is a maintenance hazard. Change either threshold and the other silently diverges.

Fix

Remove the duplicated if/elif/else block and reuse majority_decision as decision.

**Severity**: P2 (Medium) **File**: `decider/ensemble.py` lines 83-88 ## Problem `majority_decision` is computed at line 83-86 but never referenced afterward. `decision` is recomputed identically at lines 90-95: ```python majority_decision = ( "auto_approve" if weighted_score >= 0.65 else ("ask_user" if weighted_score >= 0.35 else "abort") ) agreeing = sum(1 for v in valid_votes if v["decision"] == majority_decision) agreement = agreeing / len(valid_votes) if valid_votes else 0 if weighted_score >= 0.65: decision = "auto_approve" ... ``` Duplicated threshold logic is a maintenance hazard. Change either threshold and the other silently diverges. ## Fix Remove the duplicated `if/elif/else` block and reuse `majority_decision` as `decision`.
Artur closed this issue 2026-06-16 14:24:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
glow-all/decider#14
No description provided.