@@ -30,6 +30,7 @@ async def _create_browser_state(
30
30
url : str | None = None ,
31
31
task_id : str | None = None ,
32
32
workflow_run_id : str | None = None ,
33
+ organization_id : str | None = None ,
33
34
) -> BrowserState :
34
35
pw = await async_playwright ().start ()
35
36
(
@@ -42,6 +43,7 @@ async def _create_browser_state(
42
43
url = url ,
43
44
task_id = task_id ,
44
45
workflow_run_id = workflow_run_id ,
46
+ organization_id = organization_id ,
45
47
)
46
48
return BrowserState (
47
49
pw = pw ,
@@ -64,11 +66,18 @@ async def get_or_create_for_task(self, task: Task) -> BrowserState:
64
66
return self .pages [task .task_id ]
65
67
66
68
LOG .info ("Creating browser state for task" , task_id = task .task_id )
67
- browser_state = await self ._create_browser_state (task .proxy_location , task .url , task .task_id )
69
+ browser_state = await self ._create_browser_state (
70
+ proxy_location = task .proxy_location ,
71
+ url = task .url ,
72
+ task_id = task .task_id ,
73
+ organization_id = task .organization_id ,
74
+ )
68
75
69
76
# The URL here is only used when creating a new page, and not when using an existing page.
70
77
# This will make sure browser_state.page is not None.
71
- await browser_state .get_or_create_page (url = task .url , proxy_location = task .proxy_location , task_id = task .task_id )
78
+ await browser_state .get_or_create_page (
79
+ url = task .url , proxy_location = task .proxy_location , task_id = task .task_id , organization_id = task .organization_id
80
+ )
72
81
73
82
self .pages [task .task_id ] = browser_state
74
83
if task .workflow_run_id :
@@ -83,13 +92,19 @@ async def get_or_create_for_workflow_run(self, workflow_run: WorkflowRun, url: s
83
92
workflow_run_id = workflow_run .workflow_run_id ,
84
93
)
85
94
browser_state = await self ._create_browser_state (
86
- workflow_run .proxy_location , url = url , workflow_run_id = workflow_run .workflow_run_id
95
+ workflow_run .proxy_location ,
96
+ url = url ,
97
+ workflow_run_id = workflow_run .workflow_run_id ,
98
+ organization_id = workflow_run .organization_id ,
87
99
)
88
100
89
101
# The URL here is only used when creating a new page, and not when using an existing page.
90
102
# This will make sure browser_state.page is not None.
91
103
await browser_state .get_or_create_page (
92
- url = url , proxy_location = workflow_run .proxy_location , workflow_run_id = workflow_run .workflow_run_id
104
+ url = url ,
105
+ proxy_location = workflow_run .proxy_location ,
106
+ workflow_run_id = workflow_run .workflow_run_id ,
107
+ organization_id = workflow_run .organization_id ,
93
108
)
94
109
95
110
self .pages [workflow_run .workflow_run_id ] = browser_state
0 commit comments