File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414from sqlalchemy .orm import Session
1515
1616from ..models import Conversation , ConversationFile , Run
17+ from .access import get_owned
1718from .conversations import files_of
18- from .errors import Conflict , NotFound
19+ from .errors import Conflict
1920from .manager import Controller
2021
2122# Told to the agent, not to the user: the sandbox cwd is the only place
@@ -67,10 +68,14 @@ def start(
6768
6869def of_conversation (db : Session , conversation : Conversation , run_id : str ) -> Run :
6970 """A run belonging to this conversation, or NotFound."""
70- run = db .get (Run , run_id )
71- if run is None or run .conversation_id != conversation .id :
72- raise NotFound ("run not found" )
73- return run
71+ return get_owned (
72+ db ,
73+ Run ,
74+ run_id ,
75+ owner_field = "conversation_id" ,
76+ owner_value = conversation .id ,
77+ detail = "run not found" ,
78+ )
7479
7580
7681def cancel (controller : Controller , run_id : str ) -> bool :
You can’t perform that action at this time.
0 commit comments