Skip to content

Propagate existing attempt IDs into Q&A retrieval path (issue/short_id fallback, no attempt creation)#124

Draft
ArnabChatterjee20k with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-qa-retrieval-logging-issue
Draft

Propagate existing attempt IDs into Q&A retrieval path (issue/short_id fallback, no attempt creation)#124
ArnabChatterjee20k with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-qa-retrieval-logging-issue

Conversation

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Q&A runs were bypassing retrieval usage persistence because attempt_id could be None on the question path; as a result, retrieval_usage rows were skipped and log_retrieval_recorded() never emitted. This change ensures Q&A uses an existing attempt ID when available (issue-id first, short-id fallback) without synthesizing new attempts.

  • Attempt ID resolution centralized before Q&A routing

    • Compute effective_attempt_id once per processor run:
      1. input.attempt_id
      2. tracker.get_attempt(source, issue_id)
      3. tracker.get_attempt_by_short_id(source, short_id)
    • Pass effective_attempt_id to answer_question_issue(...) and reuse consistently in retrieval-recording paths.
  • Tracker API extension for short-id recovery

    • Added read-only lookup on FixAttemptTracker for (source, short_id) to recover pre-existing attempts when issue-id lookup misses.
    • Implemented backend query support so Discord-style IDs (e.g. DISCORD-15265329) resolve to the original attempt.
  • No synthetic attempts

    • Preserved behavior when no existing attempt truly exists: no auto-creation in processor fallback logic.
  • Targeted observability

    • Added debug logs for:
      • missing inbound attempt_id
      • recovered attempt_id source (issue_id vs short_id)
      • unresolved attempt after all fallbacks
    • This makes missing/recovered attempt propagation explicit during Q&A debugging.
let effective_attempt_id = input.attempt_id
    .or_else(|| self.tracker.get_attempt(&input.source_name, &input.issue.id).ok().flatten().map(|a| a.id))
    .or_else(|| self.tracker.get_attempt_by_short_id(&input.source_name, &input.issue.short_id).ok().flatten().map(|a| a.id));

if matches!(input.intent, Some(Intent::Question)) {
    return self.answer_question_issue(
        &input.issue,
        &input.resolution,
        &input.source_name,
        effective_attempt_id,
    ).await;
}

Copilot AI changed the title [WIP] Fix Q&A retrieval usage persistence and logging Propagate existing attempt IDs into Q&A retrieval path (issue/short_id fallback, no attempt creation) Jul 14, 2026
Copilot AI requested a review from ArnabChatterjee20k July 14, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants