You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "guan404ming (via GitHub)" <gi...@apache.org> on 2026/07/18 09:21:49 UTC
[PR] Fix HITL review showing altered agent output to reviewers [airflow]
guan404ming opened a new pull request, #70070:
URL: https://github.com/apache/airflow/pull/70070
## Why
The human review panel could display something different from what the agent actually produced: JSON-looking text was shown as a Python dict and "true" became True, so reviewers approved content that didn't match the task's real output.
## How
- Return XCom values as stored instead of re-parsing them in the HITL review plugin
- Store plugin-written review data natively, matching how workers write XComs
- Seed test XComs through the real worker write path so the mismatch is covered
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Fable 5)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix HITL review showing altered agent output to reviewers [airflow]
Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on code in PR #70070:
URL: https://github.com/apache/airflow/pull/70070#discussion_r3626940024
##########
providers/common/ai/tests/unit/common/ai/plugins/test_hitl_review.py:
##########
@@ -383,14 +382,14 @@ def test_read_xcom_by_prefix_agent_output_formats(self, session, dag_maker, outp
dag_maker.create_dagrun(run_id="r", run_type=DagRunType.MANUAL, logical_date=logical_date)
dag_maker.sync_dagbag_to_db()
- XComModel.set(
+ _write_xcom(
Review Comment:
Thanks, added a raw XComModel.value assertion. Verified it fails on the pre-fix code, where the stored value is the JSON-encoded string.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix HITL review showing altered agent output to reviewers [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #70070:
URL: https://github.com/apache/airflow/pull/70070#discussion_r3624712610
##########
providers/common/ai/tests/unit/common/ai/plugins/test_hitl_review.py:
##########
@@ -383,14 +382,14 @@ def test_read_xcom_by_prefix_agent_output_formats(self, session, dag_maker, outp
dag_maker.create_dagrun(run_id="r", run_type=DagRunType.MANUAL, logical_date=logical_date)
dag_maker.sync_dagbag_to_db()
- XComModel.set(
+ _write_xcom(
Review Comment:
Both `_write_xcom` and `_read_xcom` are under test here, so this pins them as a symmetric pair rather than against the actual worker write path -- a symmetric reintroduction of double-encoding in both helpers would still pass. It does catch a read-only regression (seeding natively + the old `deserialize_value` read fails on the JSON-string cases), but asserting the raw stored `XComModel.value` in one case (that it's a native str/dict, not a JSON-encoded string) would independently pin the on-disk format workers produce.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix HITL review showing altered agent output to reviewers [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #70070:
URL: https://github.com/apache/airflow/pull/70070#discussion_r3624661238
##########
providers/common/ai/src/airflow/providers/common/ai/plugins/hitl_review.py:
##########
@@ -121,25 +121,38 @@ def _read_xcom_by_prefix(
for key, value in session.execute(query).all():
suffix = key[len(prefix) :]
if suffix.isdigit():
- # deserialize_value expects an object with a .value attribute;
- # wrap the raw column value so we can reuse the standard deserialization path.
- row = SimpleNamespace(value=value)
- result[int(suffix)] = XComModel.deserialize_value(row)
+ result[int(suffix)] = value
return result
def _write_xcom(
session: Session, *, dag_id: str, run_id: str, task_id: str, map_index: int = -1, key: str, value
):
"""Write data to db."""
- XComModel.set(
- key=key,
- value=value,
- dag_id=dag_id,
- task_id=task_id,
- run_id=run_id,
- map_index=map_index,
- session=session,
+ # Stores value natively to match worker-written XComs; use XComModel.set(serialize=False) once min Airflow >= 3.2.
+ dag_run_id = session.scalar(select(DagRun.id).where(DagRun.dag_id == dag_id, DagRun.run_id == run_id))
+ if dag_run_id is None:
+ raise HTTPException(404, f"DAG run not found on DAG {dag_id!r} with ID {run_id!r}")
+ session.execute(
Review Comment:
We should also wait for @gopidesupavan to review the PR too
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix HITL review showing altered agent output to reviewers [airflow]
Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on PR #70070:
URL: https://github.com/apache/airflow/pull/70070#issuecomment-5042177942
Thanks!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix HITL review showing altered agent output to reviewers [airflow]
Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming merged PR #70070:
URL: https://github.com/apache/airflow/pull/70070
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org