@@ -1339,9 +1339,9 @@ async def fake_build_context(*args, **kwargs):
13391339 ordered_messages = sorted (run .messages , key = lambda item : item .output_index )
13401340 assert run .model == "gpt-4o-mini"
13411341 assert run .tools_available == thread .tools_available
1342- # Lecture-video formatting is injected fresh into run.instructions at
1343- # OpenAI request time and is not stored on the thread .
1344- assert not thread .instructions
1342+ # Thread instructions keep the stored assistant snapshot; run instructions
1343+ # add lecture-video formatting at runtime .
1344+ assert thread .instructions == "You are a lecture assistant."
13451345 assert run .instructions is not None
13461346 assert run .instructions .startswith ("You are a lecture assistant." )
13471347 assert "The current date and time is" not in run .instructions
@@ -1417,7 +1417,7 @@ async def fake_build_context(*args, **kwargs):
14171417 ]
14181418)
14191419@pytest .mark .asyncio
1420- async def test_lecture_video_thread_instructions_unset_at_create_time (
1420+ async def test_lecture_video_thread_instructions_store_snapshot_at_create_time (
14211421 api , db , institution , valid_user_token
14221422):
14231423 async with db .async_session () as session :
@@ -1440,9 +1440,7 @@ async def test_lecture_video_thread_instructions_unset_at_create_time(
14401440 thread = await models .Thread .get_by_id (session , response .json ()["thread" ]["id" ])
14411441
14421442 assert thread is not None
1443- # Lecture-video formatting is injected at OpenAI request time, not baked
1444- # into thread.instructions at create time.
1445- assert not thread .instructions
1443+ assert thread .instructions == "You are a lecture assistant."
14461444
14471445
14481446@with_user (123 )
@@ -1455,7 +1453,7 @@ async def test_lecture_video_thread_instructions_unset_at_create_time(
14551453 ]
14561454)
14571455@pytest .mark .asyncio
1458- async def test_lecture_video_thread_instructions_unset_at_create_time_without_latex (
1456+ async def test_lecture_video_thread_instructions_store_snapshot_at_create_time_without_latex (
14591457 api , db , institution , valid_user_token
14601458):
14611459 async with db .async_session () as session :
@@ -1475,7 +1473,7 @@ async def test_lecture_video_thread_instructions_unset_at_create_time_without_la
14751473 thread = await models .Thread .get_by_id (session , response .json ()["thread" ]["id" ])
14761474
14771475 assert thread is not None
1478- assert not thread .instructions
1476+ assert thread .instructions == "You are a lecture assistant."
14791477
14801478
14811479@with_user (123 )
0 commit comments