Repository navigation
Description
Under which category would you file this issue?
Airflow Core
Apache Airflow version
3.3.2
What happened and how to reproduce it?
A client can't update just the slots of a pool. PATCH /api/v2/pools/{pool_name}?update_mask=slots with {"slots": 8} returns 422 because the pool name and include_deferred are still required, even though the mask leaves them out. A bulk update with the same mask fails the same way. The same request works on default_pool.
As a result, every client has to send include_deferred on each update. airflowctl pools update --pool etl --slots 16 sends its flag default, false, which turns deferred slots off on a pool that had them on.
To reproduce, run the script below against a local API server (SQLite, simple auth manager). It takes the airflow of a venv with apache-airflow==3.3.2 from PyPI and an airflowctl built from main at 28cab90:
$ bash pool-patch-e2e.sh /tmp/gt-af332/bin/airflow /tmp/gt-ctl-main/bin/airflowctl
$ airflow version # the server
3.3.2
$ curl -X POST http://127.0.0.1:61485/api/v2/pools -d '{"name": "etl", "slots": 4, "include_deferred": true}'
{"name":"etl","slots":4,"description":null,"include_deferred":true,"occupied_slots":0,"running_slots":0,"queued_slots":0,"scheduled_slots":0,"open_slots":4,"deferred_slots":0,"team_name":null}
HTTP 201
$ curl -X PATCH 'http://127.0.0.1:61485/api/v2/pools/etl?update_mask=slots' -d '{"slots": 8}'
{"detail":[{"type":"missing","loc":["pool"],"msg":"Field required","input":{"slots":8},"url":"https://errors.pydantic.dev/2.13/v/missing"},{"type":"missing","loc":["include_deferred"],"msg":"Field required","input":{"slots":8},"url":"https://errors.pydantic.dev/2.13/v/missing"}]}
HTTP 422
$ curl -X PATCH 'http://127.0.0.1:61485/api/v2/pools/default_pool?update_mask=slots' -d '{"slots": 150}'
{"name":"default_pool","slots":150,"description":"Default pool","include_deferred":false,"occupied_slots":0,"running_slots":0,"queued_slots":0,"scheduled_slots":0,"open_slots":150,"deferred_slots":0,"team_name":null}
HTTP 200
$ curl -X PATCH http://127.0.0.1:61485/api/v2/pools -d '{"actions": [{"action": "update", "entities": [{"name": "etl", "slots": 8}], "update_mask": ["slots"]}]}'
{"detail":[{"type":"missing","loc":["include_deferred"],"msg":"Field required","input":{"slots":8,"pool":"etl"},"url":"https://errors.pydantic.dev/2.13/v/missing"}]}
HTTP 422
$ curl http://127.0.0.1:61485/api/v2/pools/etl
{"name":"etl","slots":4,"description":null,"include_deferred":true,"occupied_slots":0,"running_slots":0,"queued_slots":0,"scheduled_slots":0,"open_slots":4,"deferred_slots":0,"team_name":null}
HTTP 200
$ airflowctl pools update --pool etl --slots 16 # airflowctl has to send include_deferred
[{"name": "etl", "slots": "16", "description": null, "include_deferred": "False", "occupied_slots": "0", "running_slots": "0", "queued_slots": "0", "scheduled_slots": "0", "open_slots": "16", "deferred_slots": "0", "team_name": null}]
$ curl http://127.0.0.1:61485/api/v2/pools/etl
{"name":"etl","slots":16,"description":null,"include_deferred":false,"occupied_slots":0,"running_slots":0,"queued_slots":0,"scheduled_slots":0,"open_slots":16,"deferred_slots":0,"team_name":null}
HTTP 200
Reproducer source: pool-patch-e2e.sh
#!/usr/bin/env bash
# PATCH /api/v2/pools/{pool_name} with partial bodies against a real Airflow API server (SQLite, simple auth manager).
# Usage: pool-patch-e2e.sh <airflow executable for the server> [airflowctl executable]
set -u
AIRFLOW=${1:?usage: pool-patch-e2e.sh <airflow> [airflowctl]}
CTL=${2:-}
PORT=$(python3 -c 'import socket; s = socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1])')
URL="http://127.0.0.1:$PORT"
SERVER_HOME="$(mktemp -d)"
CLIENT_HOME="$(mktemp -d)"
SERVER_ENV=(
AIRFLOW_HOME="$SERVER_HOME"
AIRFLOW__CORE__LOAD_EXAMPLES=False
AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_USERS=admin:admin
)
say() { printf '\n$ %s\n' "$1"; }
env "${SERVER_ENV[@]}" "$AIRFLOW" db migrate > "$SERVER_HOME/setup.log" 2>&1 || { cat "$SERVER_HOME/setup.log"; exit 1; }
env "${SERVER_ENV[@]}" "$AIRFLOW" api-server --port "$PORT" --workers 1 > "$SERVER_HOME/api-server.log" 2>&1 &
SERVER_PID=$!
trap 'kill "$SERVER_PID" 2>/dev/null; wait "$SERVER_PID" 2>/dev/null; rm -rf "$SERVER_HOME" "$CLIENT_HOME"' EXIT
PASSWORDS="$SERVER_HOME/simple_auth_manager_passwords.json.generated"
for _ in $(seq 90); do
curl -sf "$URL/api/v2/monitor/health" > /dev/null && [ -s "$PASSWORDS" ] && break
sleep 1
done
PASSWORD=$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1]))["admin"])' "$PASSWORDS")
TOKEN=$(curl -s -X POST "$URL/auth/token" -H 'Content-Type: application/json' \
-d "{\"username\": \"admin\", \"password\": \"$PASSWORD\"}" | python3 -c 'import json, sys; print(json.load(sys.stdin)["access_token"])')
api() { curl -s -w '\nHTTP %{http_code}\n' -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' "$@"; }
say 'airflow version # the server'
env "${SERVER_ENV[@]}" "$AIRFLOW" version 2> /dev/null
say "curl -X POST $URL/api/v2/pools -d '{\"name\": \"etl\", \"slots\": 4, \"include_deferred\": true}'"
api -X POST "$URL/api/v2/pools" -d '{"name": "etl", "slots": 4, "include_deferred": true}'
say "curl -X PATCH '$URL/api/v2/pools/etl?update_mask=slots' -d '{\"slots\": 8}'"
api -X PATCH "$URL/api/v2/pools/etl?update_mask=slots" -d '{"slots": 8}'
say "curl -X PATCH '$URL/api/v2/pools/default_pool?update_mask=slots' -d '{\"slots\": 150}'"
api -X PATCH "$URL/api/v2/pools/default_pool?update_mask=slots" -d '{"slots": 150}'
BULK='{"actions": [{"action": "update", "entities": [{"name": "etl", "slots": 8}], "update_mask": ["slots"]}]}'
say "curl -X PATCH $URL/api/v2/pools -d '$BULK'"
api -X PATCH "$URL/api/v2/pools" -d "$BULK"
say "curl $URL/api/v2/pools/etl"
api "$URL/api/v2/pools/etl"
if [ -n "$CTL" ]; then
export AIRFLOW_HOME="$CLIENT_HOME" AIRFLOW_CLI_TOKEN="$TOKEN"
"$CTL" auth login --api-url "$URL" --skip-keyring > /dev/null
say 'airflowctl pools update --pool etl --slots 16 # airflowctl has to send include_deferred'
"$CTL" pools update --pool etl --slots 16
say "curl $URL/api/v2/pools/etl"
api "$URL/api/v2/pools/etl"
fiWhat you think should happen instead?
With update_mask, a PATCH should only need the fields named in the mask and should leave the others as they are, for every pool and in bulk updates. default_pool already works that way, because its branch in update_orm_from_pydantic validates only the masked fields. Other pools are validated against BasePool, which requires pool, slots and include_deferred:
- The validation:
airflow/airflow-core/src/airflow/api_fastapi/core_api/services/public/pools.py
Lines 77 to 89 in 18fe1c6
fields_to_update = patch_body.model_fields_set try: # Dump with both input + output aliases handled body_dict = patch_body.model_dump( include=fields_to_update, by_alias=True, # ensures we get the API-facing alias keys ) # Normalize keys for BasePool (expects "pool") if "name" in body_dict and "pool" not in body_dict: body_dict["pool"] = body_dict.pop("name") BasePool.model_validate(body_dict) BasePool:class BasePool(BaseModel): """Base serializer for Pool.""" pool: str = Field(serialization_alias="name") slots: PoolSlots description: str | None = Field(default=None) include_deferred: bool PoolPatchBody, where every field is optional:class PoolPatchBody(StrictBaseModel): """Pool serializer for patch bodies.""" name: str | None = Field(default=None, alias="pool") slots: PoolSlots | None = None description: str | None = None include_deferred: bool | None = None
Once the server accepts that, airflowctl can send update_mask with the fields a user passes and leave include_deferred out unless --include-deferred or --no-include-deferred is given.
Operating System
macOS 26.6.2
Deployment
Virtualenv installation
Apache Airflow Provider(s)
No response
Versions of Apache Airflow Providers
No response
Official Helm Chart version
Not Applicable
Kubernetes Version
Not Applicable
Helm Chart configuration
Not Applicable
Docker Image customizations
Not Applicable
Anything else?
The pool API code is the same on main at 18fe1c6. The existing tests cover a full body, a name-only body without a mask (422), masks on default_pool and a bulk mask with a complete entity, but not a partial body with a mask on another pool.
#71220 meets the same requirement from the other side: for its cluster-wide setting it fills in the configured include_deferred so that BasePool validation passes. A fix here would touch those same lines.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
1fanwang commentedon Sep 27, 2026
I have a fix for this, with tests, in 1fanwang#32. I'm at the open-PR limit here right now, so I'll open it against apache/airflow as soon as one of my other PRs is merged or closed.
garvit-arora commentedon Sep 29, 2026
Hi, I'd like to work on this issue. Plan: align non-
default_poolPATCH validation with the masked-field path (merge existing pool values for unmasked fields beforeBasePoolvalidation), add API tests for partialupdate_mask=slotsbodies, and verify bulk update behaves the same. I'll open a PR shortly.1fanwang commentedon Sep 29, 2026
hi we have a pr opened 3 days ago 1fanwang#32
garvit-arora commentedon Sep 29, 2026
Closing my duplicate PR #73921 in favor of @1fanwang's existing work in 1fanwang#32 — it has the same fix plus e2e coverage. @1fanwang, please open yours upstream when you have a PR slot; I can help review or test.