-
-
Notifications
You must be signed in to change notification settings - Fork 994
Closed
Labels
area/backendThis is backend onlyThis is backend only
Description
Summary
Severity: 🟡 MEDIUM
File: apps/backend/runners/github/learning.py:630-645
Category: Incomplete Implementation - Stub Function
Problem
The _check_pending_outcomes_status() function is a stub that always returns 0, preventing the learning system from actually tracking PR outcomes.
Current Code
def _check_pending_outcomes_status(repo: str, gh_provider) -> int:
"""
Check status of pending outcomes by querying GitHub.
Args:
repo: Repository to check
gh_provider: GitHubProvider instance
Returns:
Number of outcomes updated
"""
# This would be called periodically to update pending outcomes
# Implementation depends on gh_provider being async
# Leaving as stub for now
return 0 # ❌ HARDCODED - never updates any outcomesImpact
- ❌ Learning system cannot track when feedback loops complete
- ❌ Pending PR outcomes never get validated
- ❌ Cannot measure which automated suggestions were accepted/rejected
- ❌ Learning feedback loop is broken
Required Implementation
async def _check_pending_outcomes_status(repo: str, gh_provider) -> int:
"""
Check status of pending outcomes by querying GitHub.
Queries GitHub API to check if PRs with pending outcomes have been:
- Merged (outcome: accepted)
- Closed (outcome: rejected)
- Commented on (outcome: needs_revision)
Updates outcome records in memory/database.
"""
updated_count = 0
pending_outcomes = get_pending_outcomes(repo)
for outcome in pending_outcomes:
pr_number = outcome.pr_number
# Query GitHub PR status
pr = await gh_provider.get_pull_request(repo, pr_number)
if pr.merged:
update_outcome_status(outcome.id, "accepted", pr.merged_at)
updated_count += 1
elif pr.closed:
update_outcome_status(outcome.id, "rejected", pr.closed_at)
updated_count += 1
elif has_review_comments(pr):
update_outcome_status(outcome.id, "needs_revision")
updated_count += 1
return updated_countAcceptance Criteria
- Replace
return 0with actual implementation - Make function async (requires refactoring call sites)
- Query GitHub API for PR status
- Update outcome records in storage
- Handle rate limiting and errors
- Add logging for outcome updates
- Write unit tests with mock GitHub provider
Dependencies
- Requires
gh_providerto support async operations - Needs database/storage for outcome records
- Requires GitHub API access
Priority
MEDIUM - Feature incompleteness, but learning system has other tracking mechanisms
References
- Mock Elimination Audit: Backend MEDIUM finding Auto claude/add followup on done task #1
- Learning system documentation
Metadata
Metadata
Assignees
Labels
area/backendThis is backend onlyThis is backend only