amoghrajesh commented on code in PR #76864:
URL: https://github.com/apache/airflow/pull/76864#discussion_r4548662544
##########
providers/common/ai/src/airflow/providers/common/ai/durable/capability.py:
##########
@@ -99,8 +101,39 @@
# types have changed since, so replaying it would fail on every retry.
_UNLOADABLE = "the recorded result no longer loads, so it was written by
another version"
-_NO_CONFIG: RoleBasedOperationConfig[None] = RoleBasedOperationConfig(
- model=None, event=None, capability=None, tool=None
+# How an operation's step is run: looked up in the journal and recorded, or
always run live.
+_StepMode: TypeAlias = Literal["journal", "live"]
+
+
+def _is_tool_journaled(tool_def: ToolDefinition) -> bool:
+ """Whether calls of a tool are journaled; ``metadata={"airflow": False}``
runs them live on every attempt."""
+ setting = (tool_def.metadata or {}).get(TOOL_CONFIG_KEY)
+ if setting is None:
+ return True
+ if isinstance(setting, bool):
+ return setting
+ raise UserError(
Review Comment:
A bad value such as `airflow="false"` raises `UserError` only when the tool
is first called. So each retry runs the model up to that call and fails the
same way, and the docs admit "as do its retries". Check the metadata once when
the tools are listed, and raise a subclass of `AirflowFailException`, so the
task fails once without retrying.
--
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]