kaxil commented on code in PR #70651:
URL: https://github.com/apache/airflow/pull/70651#discussion_r3707028269
##########
providers/common/ai/src/airflow/providers/common/ai/operators/llm_branch.py:
##########
@@ -95,4 +108,54 @@ def execute(self, context: Context) -> str | Iterable[str]
| None:
else:
branches = str(output)
+ if self.require_approval:
+ choices = sorted(self.downstream_task_ids)
+ chosen = branches if isinstance(branches, str) else
json.dumps(branches)
+ body = (
+ f"```\nPrompt: {self.prompt}\n\nChosen branch(es):
{chosen}\n```\n\n"
+ f"Valid branches: {', '.join(f'`{c}`' for c in choices)}"
Review Comment:
`prompt` is a template field, so this body routinely carries rendered
external data inside the fence, while the `Valid branches:` list sits outside
it. A prompt containing a closing fence ends the block early and can print its
own `Valid branches:` line, forging the list the reviewer is meant to trust.
The enum dropdown and the `downstream_task_ids` check still constrain what can
actually be submitted, so this misleads rather than mis-routes, but the mixin's
default body keeps everything fenced (`approval.py:132`), and moving the list
above the fence would keep it that way.
--
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]