Skip to content

fix: resolve memory_store unbound error and RAI condition logic in user_clarification endpoint#843

Merged
Abdul-Microsoft merged 2 commits intopsl-logging-improvementsfrom
copilot/sub-pr-842
Mar 10, 2026
Merged

fix: resolve memory_store unbound error and RAI condition logic in user_clarification endpoint#843
Abdul-Microsoft merged 2 commits intopsl-logging-improvementsfrom
copilot/sub-pr-842

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

Two bugs in the user_clarification endpoint introduced during telemetry improvements.

memory_store UnboundLocalError

When plan_id was provided but the session_id lookup threw (caught by except: pass), memory_store was never assigned — causing an UnboundLocalError on the subsequent get_current_team() call. Fixed by initializing memory_store unconditionally before the plan lookup block.

RAI check condition always evaluates to True

# Before — always True: when answer is None, (None != "") is True; when answer == "", ("" is not None) is True
if human_feedback.answer is not None or human_feedback.answer != "":

# After — only runs RAI check for non-empty answers
if human_feedback.answer is not None and str(human_feedback.answer).strip() != "":

This caused the content safety check to run even when no answer was provided.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…gic in user_clarification endpoint

Co-authored-by: Abdul-Microsoft <192570837+Abdul-Microsoft@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve Application Insights logging and telemetry handling fix: resolve memory_store unbound error and RAI condition logic in user_clarification endpoint Mar 10, 2026
@Abdul-Microsoft Abdul-Microsoft marked this pull request as ready for review March 10, 2026 06:55
@Abdul-Microsoft Abdul-Microsoft merged commit 088978b into psl-logging-improvements Mar 10, 2026
5 checks passed
@Abdul-Microsoft Abdul-Microsoft deleted the copilot/sub-pr-842 branch March 10, 2026 07:00
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