investigate-airflow-failure
Diagnose a failed Airflow task running on Cloud Composer by pulling task logs from GCS, identifying the first real error in the traceback, and inspecting the…
от Recidiviz★ 48 звёзд на GitHub
Установить investigate-airflow-failure в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Skill: Investigate Airflow Failure
Overview
Diagnose a specific failed Airflow task instance running on the Recidiviz Cloud Composer environment. This is diagnose-only: surface the root cause and relevant context. Do not propose code fixes, open PRs, retry the task, or take any action on the Composer environment without the user explicitly asking.
Inputs
You need four things to diagnose a failure:
dag_id— the Airflow DAG id. Always includes a project prefix:recidiviz-123_*means prod,recidiviz-staging_*means staging.task_id— the Airflow task id (thetask_idparameter of the Operator)run_start— the datetime the failing DAG run started, UTCdeployed_tag— the version tag that was deployed in the alerting project when the task ran. If not provided, compute it per Step 1.5.
If the first three are missing, ASK the user — do not guess.
When invoked from investigate-pd-incident, dag_id / task_id / run_start
come from the parsed incident title, and deployed_tag comes from the router's
Step 4.
Constants
- Composer environment name:
orchestration-v2 - Composer region:
us-central1 - Prod GCP project:
recidiviz-123 - Staging GCP project:
recidiviz-staging
Source: recidiviz/tools/deploy/terraform/cloud-composer.tf. Only one Composer
env exists per project.
Step 1: Derive the project
Take the first token of dag_id up to the first _ as the project id:
recidiviz-123_hourly_monitoring_dag→ projectrecidiviz-123(prod)recidiviz-staging_calculation_dag→ projectrecidiviz-staging(staging)
If the prefix doesn't match either, ask the user which project to look in.
Step 1.5: Resolve the deployed version (if not provided)
All downstream source-reading and git log queries must be scoped to the code
that was actually running in the alerting project — not origin/main. If the
caller didn't pass deployed_tag, resolve it now per
recidiviz/tools/deploy/CLAUDE.md:
./recidiviz/tools/deploy/print_deployed_version.sh <project_id>
The TF-state code version from that output is authoritative — use it
as deployed_tag. The script also prints a Cloud Run previous row
derived from revision history on case-triage-web; use that tag as
prev_deployed_tag for "what changed" diffs later. Note that
prev_deployed_tag on prod is often not the tag immediately preceding
deployed_tag on the release branch — RC patch tags frequently skip over
being deployed to prod, so Cloud Run's previous-revision tag is the only
reliable source for "what was running before the current version."
- For staging alerts, the script also prints the latest tag on
origin/main; if that disagrees with the TF-state version, a deploy is probably in flight — surface that to the user. - For prod alerts, there is no reliable branch-tip signal today, so TF-state + Cloud Run current (which should agree) are your reads on what's live, and Cloud Run previous is your read on what was live before it.
For data-content failures (not code tracebacks — e.g., stale or wrong BQ view
results), also check the script's "Latest view-update version": if it's
behind the code version by more than ~3 hours, the update_managed_calculation_views
task may be failing, which can be the actual alert cause.
Step 2: Find the exact failed run_id
A DAG run's run_id looks like manual__<ISO8601 timestamp>+00:00, and the
timestamp is not always exactly equal to the run_start from the PD title
(there can be seconds of drift). Find the precise run_id from the Cloud
Logging scheduler record:
gcloud logging read '
resource.type="cloud_composer_environment"
resource.labels.environment_name="orchestration-v2"
"<TASK_ID>"
textPayload:"state=failed"
timestamp>="<RUN_START - 30m>"
timestamp<="<RUN_START + 4h>"
' --project=<PROJECT_ID> --limit=5 \
--format='value(timestamp,textPayload)'
The text payload looks like:
TaskInstance Finished: dag_id=<dag>, task_id=<task>, run_id=manual__2026-04-20T16:01:59+00:00, ..., state=failed, ..., try_number=1, max_tries=0, ...
Extract run_id and try_number from the match closest to run_start. If
there are multiple failed instances of the same task within the window, ask the
user which one to investigate.
Step 3: Look up the Composer GCS bucket
gcloud composer environments describe orchestration-v2 \
--location=us-central1 --project=<PROJECT_ID> \
--format='value(config.dagGcsPrefix)'
Returns something like gs://us-central1-orchestration-v-78d60713-bucket/dags.
The logs live in the same bucket, parallel prefix: swap /dags for
/logs. Cache the bucket name after the first lookup in a session.
Step 4: Fetch the failing task log
Log path format (note the literal : and + in run_id= — do not
URL-encode):
gs://<bucket>/logs/dag_id=<DAG_ID>/run_id=<RUN_ID>/task_id=<TASK_ID>/attempt=<TRY_NUMBER>.log
gcloud storage cat 'gs:/
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл investigate-airflow-failure?
Diagnose a failed Airflow task running on Cloud Composer by pulling task logs from GCS, identifying the first real error in the traceback, and inspecting the task's source and recent git history. Use when the user wants to investigate an Airflow task failure (e.g. "why did X task fail", "investigate the failing generate_airflow_dag_run_history task", "dig into the airflow failure in prod"). Can be invoked directly or as a specialist from the investigate-pd-incident skill.
Как установить скилл investigate-airflow-failure?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл investigate-airflow-failure запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
agent-skill-stack
GitHubFind, evaluate, and assemble the smallest compatible set of AI Agent Skills for an end-to-end natural-language goal. Use when a user wants Skills for a…
build-evidence-map
GitHubBuild an auditable evidence map for a contested technical choice, research synthesis, proposal review, or consequential decision. Use when Copilot must…
pinecone-rag
GitHubBuild production RAG pipelines and persistent agent memory using Pinecone as the vector database backend. ALWAYS USE THIS SKILL when the user mentions…
qdrant-monitoring-debugging
GitHubDiagnoses Qdrant production issues using metrics and observability tools. Use when someone reports 'optimizer stuck', 'indexing too slow', 'memory too high'…