Repository navigation
Edge: Return 400 instead of 500 on invalid worker version - #72925
Merged
jscheffl merged 6 commits intoNov 6, 2026
Merged
Conversation
1fanwang
requested review from
dheerajturaga,
jscheffl and
shubhamraj-git
as code owners
September 11, 2026 07:03
1fanwang
force-pushed
the
1fannnw/edge-worker-invalid-version-400
branch
from
September 11, 2026 17:47
877e978 to
86e4875
Compare
Member
|
Thanks for the fix. Could you please address these items?
Drafted-by: Codex (GPT-5); reviewed by @dheerajturaga before posting |
This was referenced Sep 25, 2026
This was referenced Sep 25, 2026
When minimum acceptable worker versions were configured, an edge worker submitting an unparseable version string caused packaging.version.Version to raise InvalidVersion. Because this exception was unhandled, it escaped as an HTTP 500 Internal Server Error. Catch InvalidVersion in _version() and return a clean 400 Bad Request error matching the route error specification. Signed-off-by: 1fanwang <[email protected]>
A malformed server minimum must not be reported as bad worker input. Cover both registration and heartbeat through authenticated HTTP requests. Signed-off-by: 1fanwang <[email protected]>
The test body is a heterogeneous dict literal, so mypy infers its value type as object and rejects the nested assignment into body["sysinfo"]. Building sysinfo first keeps its dict[str, str | int | float | datetime] type while the body still references the same object, so the mutation reaches the request payload exactly as before. Signed-off-by: 1fanwang <[email protected]>
1fanwang
force-pushed
the
1fannnw/edge-worker-invalid-version-400
branch
from
September 25, 2026 21:00
86e4875 to
5982d8d
Compare
This was referenced Sep 26, 2026
The worker sysinfo payload accepts numbers as well as strings, so a worker can report its version as 3 or 3.5. packaging releases before 26.3 raise TypeError instead of InvalidVersion for such values, which still escaped as HTTP 500 whenever a minimum acceptable worker version was configured. Signed-off-by: 1fanwang <[email protected]>
Signed-off-by: 1fanwang <[email protected]>
jscheffl
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An Edge worker reports its Airflow and Edge provider versions when it registers. With a minimum acceptable worker version configured, the API server parses those versions, and a bad value from the worker returned HTTP 500 instead of a client error. Two inputs hit this: a string that is not a valid version, and a version sent as a number, which the request schema accepts.
The API now answers both with HTTP 400 and a message naming the bad value, as the route already documents. A bad minimum version in the server config still returns 500, because that is a server misconfiguration rather than bad worker input.
Testing Done
Registered workers through the real worker route with a minimum core version of 0.0.0, sending three bad core versions. Each run covers packaging 25.0 and the locked 26.3, because a numeric version fails differently on them: 26.2 and older raise TypeError, 26.3 raises InvalidVersion.
Before, with worker.py from apache/main:
git show apache/main:providers/edge3/src/airflow/providers/edge3/worker_api/routes/worker.py > providers/edge3/src/airflow/providers/edge3/worker_api/routes/worker.py uv run --project providers/edge3 --with packaging==25.0 python repro_worker_version.py uv run --project providers/edge3 python repro_worker_version.pyAfter, on this branch:
Reproducer source: repro_worker_version.py
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot CLI (GPT-6 Astra) following the guidelines