Lee-W commented on code in PR #76015:
URL: https://github.com/apache/airflow/pull/76015#discussion_r4441529120


##########
providers/common/ai/src/airflow/providers/common/ai/durable/openai_agents.py:
##########
@@ -103,6 +105,13 @@
 # Arguments that keep the conversation on OpenAI's servers, which a replayed 
model call never reaches.
 _SERVER_SIDE_STATE = ("previous_response_id", "conversation_id", 
"auto_previous_response_id")
 
+# Tool steps a model response claimed, by tool call id, until the tool takes 
its own. The tools of
+# one response start in model order but reach their wrapper after guardrails 
and hooks of varying
+# duration, so claiming there would number them by completion order.
+_RESERVED_TOOL_STEPS: weakref.WeakKeyDictionary[DurableRun, dict[str, 
JournalStep]] = (

Review Comment:
   * `_RESERVED_TOOL_STEPS` is now a plain dict that `run_durably` pops in its 
`finally`, and the gc test is gone.
   * I kept the module-level dict rather than threading one through the model 
provider and the tool wrappers — the `finally` covers the unused-reservation 
case too.
   * `test_a_finished_run_does_not_keep_its_reserved_tool_steps` now uses a 
`needs_approval=True` tool so the reservation is never taken.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to