uranusjr commented on code in PR #76015:
URL: https://github.com/apache/airflow/pull/76015#discussion_r4439137217


##########
providers/common/ai/src/airflow/providers/common/ai/durable/openai_agents.py:
##########
@@ -236,17 +250,11 @@ def remember(ctx: Any, error: Exception) -> Any:
     async def on_invoke_tool(ctx: ToolContext[Any], arguments: str) -> Any:
         if _is_inside_a_call(durable_run):
             return await invoke(ctx, arguments)
-        try:
-            parsed = json.loads(arguments) if arguments else {}
-        except json.JSONDecodeError:
-            parsed = arguments
-        fingerprint = fingerprint_tool_call(
-            tool.name,
-            # As recorded model answers are masked, so a replayed call's 
arguments can be too.
-            mask_secrets(parsed if isinstance(parsed, dict) else {"arguments": 
parsed}),
-            ctx.tool_call_id,
+        step = _RESERVED_TOOL_STEPS.get(durable_run, {}).pop(ctx.tool_call_id, 
None) or durable_run.claim(
+            f"tool:{tool.name}",
+            kind="tool",
+            fingerprint=_build_tool_fingerprint(tool.name, arguments, 
ctx.tool_call_id),
         )

Review Comment:
   If a provider emits duplicate or empty `call_id`s in one response (some 
non-OpenAI adapters do), the second reservation overwrites the first. This 
should probably check the popped step's `name` and `fingerprint



-- 
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