@@ -261,13 +261,13 @@ async def _execute_medhack(
261261 from ..slack_client import post_message
262262
263263 if requested_case_id is not None :
264- new_case = client .start_specific_case (requested_case_id , today )
264+ new_case = await client .start_specific_case (requested_case_id , today , admin_slack_id = user_id )
265265 if not new_case :
266266 available = client .get_all_case_ids ()
267267 return f"Case #{ requested_case_id } not found. Available case IDs: { available } "
268268 else :
269269 # "next patient" — pick the next unplayed case
270- new_case = client .start_new_case (today )
270+ new_case = await client .start_new_case (today , admin_slack_id = user_id )
271271 if not new_case :
272272 return "All cases have been played! No new cases available."
273273
@@ -339,25 +339,25 @@ async def _execute_medhack(
339339 cancel_patterns = ["no" , "nah" , "nope" , "cancel" , "never mind" , "keep going" ,
340340 "not yet" , "wait" , "hold on" , "keep digging" ]
341341
342- current_case = client .get_current_case (today )
342+ current_case = await client .get_current_case (today )
343343
344344 # --- Check for pending guess confirmation/cancellation ---
345- pending_guess = client .get_pending_guess (user_id ) if current_case else None
345+ pending_guess = ( await client .get_pending_guess (user_id ) ) if current_case else None
346346 if pending_guess and current_case and not current_case .get ("solved" ):
347347 is_confirm = any (p in text_lower for p in confirm_patterns )
348348 is_cancel = any (p in text_lower for p in cancel_patterns )
349349
350350 if is_confirm :
351351 # Lock in the pending guess
352- client .clear_pending_guess (user_id )
353- result = client .check_guess (user_id , pending_guess , today )
352+ await client .clear_pending_guess (user_id )
353+ result = await client .check_guess (user_id , pending_guess , today )
354354 return await self ._handle_guess_result (
355355 result , user_id , skill , text , client , today ,
356356 thread_history , channel_id , pending_guess
357357 )
358358
359359 elif is_cancel :
360- client .clear_pending_guess (user_id )
360+ await client .clear_pending_guess (user_id )
361361 return (
362362 f"<@{ user_id } > No worries — guess cancelled. "
363363 f"Keep investigating and lock in your diagnosis when you're ready. "
@@ -367,11 +367,11 @@ async def _execute_medhack(
367367 # If they said something else while having a pending guess,
368368 # remind them (but also let the LLM respond to their question)
369369 # Clear the pending guess so it doesn't block future interactions
370- client .clear_pending_guess (user_id )
370+ await client .clear_pending_guess (user_id )
371371
372372 # --- "Lock it in" with no pending guess ---
373373 if is_lock_in and not pending_guess and current_case and not current_case .get ("solved" ):
374- if client .is_user_locked_out (user_id , today ):
374+ if await client .is_user_locked_out (user_id , today ):
375375 return (
376376 f"<@{ user_id } > Sorry mate, you've already used your guess for today's case. "
377377 "Come back tomorrow for a new one!"
@@ -419,7 +419,7 @@ async def _execute_medhack(
419419 )
420420
421421 # --- Locked out ---
422- if current_case and client .is_user_locked_out (user_id , today ):
422+ if current_case and await client .is_user_locked_out (user_id , today ):
423423 return (
424424 f"<@{ user_id } > Sorry mate, you've already used your guess for today's case "
425425 "so you can no longer interact with it. Come back tomorrow for a new one!"
@@ -431,15 +431,15 @@ async def _execute_medhack(
431431
432432 if classification .get ("is_guess" ) and classification .get ("diagnosis" ):
433433 guess_text = classification ["diagnosis" ]
434- client .set_pending_guess (user_id , guess_text )
434+ await client .set_pending_guess (user_id , guess_text )
435435 return (
436436 f"<@{ user_id } > You want to lock in *{ guess_text } * as your final diagnosis?\n \n "
437437 f"_Remember: you only get *one guess* per case. "
438438 f"Reply *yes* to confirm or *no* to keep investigating._"
439439 )
440440
441441 # Not a guess — respond as PQM narrator
442- case_data = client .get_case_for_llm (today )
442+ case_data = await client .get_case_for_llm (today )
443443 llm_response = await self ._medhack_llm_response (skill , text , case_data , thread_history )
444444 return f"<@{ user_id } > { llm_response } "
445445
@@ -611,7 +611,7 @@ async def _handle_guess_result(
611611
612612 else :
613613 # Wrong guess
614- case_data = client .get_case_for_llm (today )
614+ case_data = await client .get_case_for_llm (today )
615615 llm_response = await self ._medhack_llm_response (
616616 skill , text , case_data , thread_history ,
617617 extra_instruction = "The user just locked in an INCORRECT diagnosis guess. "
0 commit comments