Skip to content

Commit 088978b

Browse files
Merge pull request #843 from microsoft/copilot/sub-pr-842
fix: resolve memory_store unbound error and RAI condition logic in user_clarification endpoint
2 parents 29625e0 + c50a139 commit 088978b

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/backend/v4/api/router.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,9 @@ async def user_clarification(
620620

621621
# Attach session_id to span if plan_id is available and capture for events
622622
session_id = None
623+
memory_store = await DatabaseFactory.get_database(user_id=user_id)
623624
if human_feedback.plan_id:
624625
try:
625-
memory_store = await DatabaseFactory.get_database(user_id=user_id)
626626
plan = await memory_store.get_plan_by_plan_id(plan_id=human_feedback.plan_id)
627627
if plan and plan.session_id:
628628
session_id = plan.session_id
@@ -633,9 +633,6 @@ async def user_clarification(
633633
pass # Don't fail request if span attribute fails
634634

635635
try:
636-
if not human_feedback.plan_id:
637-
memory_store = await DatabaseFactory.get_database(user_id=user_id)
638-
# else: memory_store already initialized above
639636
user_current_team = await memory_store.get_current_team(user_id=user_id)
640637
team_id = None
641638
if user_current_team:
@@ -654,7 +651,7 @@ async def user_clarification(
654651
# Set the approval in the orchestration config
655652
if user_id and human_feedback.request_id:
656653
# validate rai
657-
if human_feedback.answer is not None or human_feedback.answer != "":
654+
if human_feedback.answer is not None and str(human_feedback.answer).strip() != "":
658655
if not await rai_success(human_feedback.answer, team, memory_store):
659656
event_props = {
660657
"status": "Plan Clarification ",

0 commit comments

Comments
 (0)