test(celery): make test_amqp_task fail fast and drop rpc result backend #22180
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 305 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.342
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #22180"
general
weight: 0.35
gnufede
Description
test_amqp_task(tests/contrib/celery/test_tagging.py) is the flaky test behind frequent celery CI session failures. It is the only test combining a RabbitMQ broker with therpc://result backend, and it fails slowly by construction:rpc://backend declares its reply queue withretry=Trueand a 20-retry policy, and its result consumer reconnects on errors. A flaky broker connection stacks tens of seconds of internal retries insideadd.delay()andt.get().t.get(timeout=30), the trace-poll loop (10s), and the worker-threadjoin(shutdown_timeout=30)when the thread is wedged.stuck_or_timeout_failureup to 2 more times, so one bad run costs minutes and can push a session into the 20m job timeout across retries.Changes:
rpc://to the Redis backend already used by the sibling tests. Every tag the test asserts (celery.routing_key,out.host,network.destination.port == 5672, worker hostname) is derived from the broker side, so coverage is unchanged while the AMQP result-consumer retry/reconnect surface disappears.t.get(timeout=30)->10:start_workeryields only after the consumer is ready and the solo pool executes in-process;test_redis_taskuses 2s.shutdown_timeout=30->15: the join in celery'sstart_workerblocks for the fullshutdown_timeoutwhen the worker thread is wedged, so keep it low to fail fast instead of burning CI time on a stuck run.Testing
scripts/lint fmtandscripts/lint checkspass on the edited file.scripts/run-tests --venv d16ffca3679d(Python 3.10, celery 5.7.0): fulltests/contrib/celerysuite — 58 passed, 1 skipped in 240s, includingtest_amqp_task(passing run: ~10s, dominated by RabbitMQ worker startup).Risks
Low. The change is test-only. The one behavioral narrowing: the pure-AMQP result path (
rpc://) is no longer exercised in this test — nothing asserted depends on it, and no other test in the suite usesrpc://.Additional Notes
Release note: not needed — test-only change (
changelog/no-changeloglabel).