guide
guide6 min read

Airflow 2 to 3 migration: how to avoid silent XCom breakage

A step-by-step checklist for moving DAGs to Airflow 3 without losing task outputs

The safest Airflow 2 to 3 migration audits every XCom read and write first, then runs Airflow 2 and Airflow 3 side by side until the outputs match. The official Upgrading to Airflow 3 guide lists the breaking changes. The parallel-run advice comes from an Airflow Summit 2026 session, which reported that XCom changes in Airflow 3 can silently break Airflow 2 workflows.

Key Takeaways

  • •An Airflow 3 upgrade can break a DAG without failing it: a task may succeed while it passes different data, or no data, downstream.
  • •The Airflow 3 Task SDK changes how tasks reach Airflow internals. Any DAG code that touches the metadata database or internal models directly needs a rewrite.
  • •Inventory every XCom push and pull before you upgrade, including custom XCom backends and templated ti.xcom_pull calls.
  • •Run Airflow 2 and Airflow 3 in parallel and diff task outputs, not just task states, before you cut over.
  • •Lint first, migrate second, compare third: static checks catch the loud breaks, and the parallel run catches the quiet ones.

Airflow 2 to 3 migration: what breaks and why XCom is the quiet one

Most Airflow 3 breaking changes are loud. A removed operator or a renamed argument fails at DAG parse time, and you fix it. XCom problems are different. A task can finish green while the value it pushed has a different shape, or a downstream xcom_pull returns None where it used to return data. The scheduler reports success, and the bad data surfaces days later in a dashboard.

In our reading of the upgrade guide, the underlying cause is architectural. Airflow 3 introduces the Task SDK, and tasks now talk to the platform through an API server instead of opening sessions against the metadata database. XCom reads and writes sit on that boundary. Code that relied on direct database access, custom serialization or implicit return-value behavior is where we would look first. Check the specifics against the guide for your target version.

The table below shows the kinds of Airflow 2 patterns that need attention. It is a starting list, not a complete one.

Airflow 2 patternWhat to do in Airflow 3Failure mode
Task code opening a metadata DB sessionUse the Task SDK or REST API insteadLoud: import or connection error
execution_date in templates and contextSwitch to logical_dateQuiet if wrapped in a default or try/except
schedule_interval and timetable argumentsUse the schedule argumentLoud at parse time
SubDagOperatorReplace with TaskGroupLoud at parse time
Custom XCom backend or direct XCom queriesRe-test serialization and retrieval end to endQuiet: success state, wrong or missing value
Imports from airflow.models in DAG filesMove to airflow.sdk imports where the guide says soMixed

Step 1: Freeze a baseline on Airflow 2

Before changing anything, record what "correct" looks like. Upgrade your Airflow 2 deployment to the latest 2.x release first, as the upgrade guide recommends, and let it run a few cycles. Then capture three things for every DAG you plan to move.

  • •The task graph: task IDs, dependencies, schedules and retries.
  • •The XCom values each task pushes, with their keys and types, for a recent set of runs.
  • •The row counts or checksums of the tables each DAG writes.

This baseline is what you compare against in Step 5. Without it, a parallel run only tells you that both versions are green.

Step 2: Inventory every XCom push and pull

Grep the DAG repository for the usual entry points. Search for xcom_push, xcom_pull, ti.xcom, XCom.get, return_value, and Jinja templates containing xcom_pull. Then add the less obvious cases.

  • •Tasks that return a value and rely on the default return_value key.
  • •Operators with do_xcom_push toggled on or off.
  • •Custom XCom backend classes and the config that registers them.
  • •Any code that queries the XCom table directly.
  • •Dynamic task mapping that consumes upstream XCom output.

Write the inventory as a table: DAG, task, key, producer type, consumer, and whether a value crosses a serialization boundary. The consumers matter most, because a consumer is where a changed value turns into a wrong result.

Step 3: Lint the DAGs for known breaking changes

Static checks are the cheapest pass. The Ruff linter ships Airflow-specific rules for Airflow 3 incompatibilities, documented in the Ruff rule reference. Some of those rules may sit behind preview mode, so check the docs for the flags your version needs. Run them across the whole DAG folder and triage the output into three groups: mechanical renames, removed features, and anything near XCom.

Fix the mechanical renames in one commit so the diff stays reviewable. Treat removed features such as SubDAGs as separate tickets, since each one changes the graph shape. A linter will not understand your data contracts, so the XCom items still need a human or an agent to read the consumer code.

Step 4: Stand up Airflow 3 next to Airflow 2

Do not upgrade in place. Deploy a separate Airflow 3 environment with its own metadata database, pointed at the same code branch and, where you can manage it, at isolated copies of the output targets. Run airflow db migrate against a restored copy of the Airflow 2 database only if you need history. For most teams a clean database is simpler, because the baseline from Step 1 already holds what you need to compare.

Two settings deserve a deliberate decision. Airflow 3 changed some scheduling defaults, including catchup behavior, so set them explicitly in both environments. A parallel run is meaningless if one side silently backfills and the other does not. The upgrade guide lists the changed defaults for your version.

Step 5: Run both versions in parallel and diff the outputs

This is the step the Airflow Summit 2026 session recommended, and we agree with it. Trigger the same logical dates on both environments and compare results at three levels.

  • •State: did every task reach the same terminal state?
  • •XCom: for each key in the Step 2 inventory, is the pushed value equal in value and type?
  • •Data: do the output tables match on row counts and checksums?

The XCom comparison is the one people skip, and it is the one that catches the silent failures. A value that went from a dict to a string, or from a list to None, will not change a task's state. It will change what the next task does. Keep the parallel run going for at least one full cycle of your slowest schedule, so weekly and monthly DAGs are exercised too.

Step 6: Cut over one DAG group at a time

Move DAGs in batches ordered by blast radius: internal reports first, revenue and customer-facing pipelines last. Pause the DAG on Airflow 2, unpause it on Airflow 3, and keep the Airflow 2 copy runnable for a rollback window. Watch row counts and freshness for the first runs after each batch, and only then start the next one.

Keep a short rollback rule written down before you start, such as "any XCom diff on a tier-one DAG pauses the batch." It is easier to hold a rule you wrote calmly than to invent one during an incident.

Where an agent fits in an Airflow 3 migration

Steps 2, 3 and 5 are mostly reading code and diffing outputs, which is work an AI coding agent does well from the terminal. Our Migration Agent analyzes legacy pipeline code and proposes the rewritten targets, and our Pipeline Agent builds and maintains DAGs across orchestrators. Both run as MCP servers, so you can invoke them from Claude Code or Cursor in the repository where the DAGs already live. You can read more about the protocol in the MCP specification.

The Schema Agent handles the data side. When a migrated task changes the shape of what it writes, it detects the column-level drift and maps which downstream consumers are affected. The Orchestration Agent coordinates the three, so a question like "what's the blast radius if I change this task's output?" gets one answer instead of three partial ones. The open-source edition is read-only by default, which suits an audit: it can inventory XCom usage and compare outputs without writing to your Airflow environments.

We would not hand the cutover itself to an agent without review. In our opinion the audit is the right place to start, and the autonomy dial for write actions is something you raise per domain as you build trust.

Frequently Asked Questions

Why do XCom changes break Airflow 2 workflows silently? Because the failure is in the data, not the task. In Airflow 3, tasks reach XCom through the Task SDK and API server rather than the metadata database. If a value is serialized or retrieved differently, the producer still succeeds and the consumer receives something different. The scheduler has no reason to mark either task as failed.

Do I need to upgrade to the latest Airflow 2.x before moving to Airflow 3? We recommend it, and the upgrade guide describes the supported path. Starting from the latest 2.x release removes a class of problems unrelated to the 3.0 changes and gives you deprecation warnings to act on.

Can I upgrade Airflow in place instead of running two environments? You can, but we advise against it for production DAGs. An in-place upgrade leaves you no side-by-side output to compare, and rolling back a metadata database migration is harder than pausing a DAG. A parallel environment costs more compute for a few weeks and removes most of the risk.

How long should the parallel run last? At least one full cycle of your slowest schedule. If a DAG runs monthly, a one-week parallel run never exercises it. This is our rule of thumb, not an official recommendation.

Can an AI coding agent do the migration for us? It can do the reading work: inventory XCom usage, apply lint fixes, and diff outputs between environments. The Data Workers agents run from Claude Code or Cursor for this. We suggest keeping a human approval on writes to production DAGs and output tables.