AGENT SKILL

XMC Fix Nightly

Investigates broken Nightly Examples E2E runs on main, performs root-cause triage across code regressions vs nightly cluster drift, implements minimal fixes in an isolated git worktree, opens a Draft PR, and proves the fix by triggering the nightly workflow on the PR branch.

License 许可
Apache-2.0
所属仓库
google/xmc
最近更新
2026-11-14
Stars
★ 8
Forks
0

01 前言 Front Matter

name
XMC Fix Nightly
description
Investigates broken Nightly Examples E2E runs on main, performs root-cause triage across code regressions vs nightly cluster drift, implements minimal fixes in an isolated git worktree, opens a Draft PR, and proves the fix by triggering the nightly workflow on the PR branch.

03 SKILL.md 正文

XMC Fix Nightly Playbook

Scope: .github/workflows/nightly-examples-e2e.yml is the workflow this skill fixes and verifies on a PR branch. nightly-build.yml runs and their deploy-gke-diagnostics artifacts are read-only triage inputs (Layer B), and dispatching nightly-build.yml requires explicit user confirmation (Stage 5). nightly-visual-snapshot.yml is out of scope because it publishes the public GitHub Pages gallery.


Stage 1 — Discover & Triage Broken Nightly Examples E2E Run on main

Run tools/nightly_tests/triage_nightly_run.py (see tools/nightly_tests/README.md) to fetch origin/main, inspect recent nightly runs and open nightly-failure issues, download failed job logs and non-expired failure artifacts into ${ARTIFACT_DIR:-/tmp}/nightly_triage_<run_id>, parse failed_jobs[].result (the result-<id>/<id>.json object, including id, status, launch_status, verify_status, and xid) and bounded failed_jobs[].error_excerpt ##[error] context lines, collect SHA-pinned recent_commits, and compute rollout skew in one turn:

PYTHONPATH=. python3 tools/nightly_tests/triage_nightly_run.py

Pass --run-id <run_id> to triage a specific historical run. Stop Gate: Stop and report to the user (along with any stale open_issues) if status_summary is not "failing" ("healthy", "superseded", "in_progress", or "no_completed_runs"), unless the user explicitly requested triaging a "superseded" --run-id. Always review warnings (such as non-superseding workflow_dispatch green runs, equal-SHA Layer B/flake hints, recent-commit fallbacks, or missing build history) before trusting recent_commits or rollout_skew in Stage 2. When failed_jobs[].result and failed_jobs[].error_excerpt are insufficient to pinpoint the failure, delegate inspection of full job_<id>.log files or deploy-gke-diagnostics bundles to a subagent per Subagent Delegation Guidelines.


Stage 2 — Root-Cause Triage & Investigation

Inspect the JSON summary from Stage 1—failed_jobs (result, error_excerpt, failed_steps), recent_commits (pinned to target_run.headSha, with squash-merged (#<pr>) subjects), downloaded_artifacts, and rollout_skew—to classify the failure layer:

Layer A — Code, SDK, Example, Verifier, or Backend/UI Regression on main

Layer B — Nightly Cluster (xmc-nightly) Rollout Skew or State Drift

  • Client/Server Rollout Skew: nightly-build.yml deploys xmc-nightly at 01:00 UTC while nightly-examples-e2e.yml runs at 04:00 UTC (or on demand); inspect rollout_skew.undeployed_commits and rollout_skew.cluster_deployed_files from Stage 1 to see whether the failing example depends on undeployed server changes merged after rollout_skew.last_green_build_run.
  • Addon / Deployment Drift: Missing pods, failed Helm hooks, or unapplied Gateway/ClickHouse/MultiKueue state surfaced by rollout_skew.active_build_run and deploy-gke-diagnostics.

[!CAUTION] STRICT SHARED CLUSTER SAFETY INVARIANTS (xmc-nightly):

  1. Never Mutate xmc-nightly Directly: NEVER manually modify, apply manifests to, delete resources in, or upgrade xmc-nightly unless explicitly instructed by the user.
  2. Isolate KUBECONFIG During Read-Only Triage: Never overwrite default ~/.kube/config; pass export KUBECONFIG="${ARTIFACT_DIR:-/tmp}/kubeconfig_nightly" for any read-only cluster inspection.

Stage 3 — Create an Isolated Worktree & Implement the Fix

  1. Create an Isolated Git Worktree from origin/main:

    SLUG="<kebab-case-slug>"
    WORKTREE_DIR="/tmp/xmc-fix-nightly-${SLUG}"
    BRANCH_NAME="fix/nightly-${SLUG}"
    
    git fetch origin main
    git worktree add "${WORKTREE_DIR}" -b "${BRANCH_NAME}" origin/main
    
  2. Implement & Verify a Minimal, Single-Responsibility Fix: Follow XMC Feature Development and language rules under .agents/rules/languages/:


Stage 4 — Open a Draft PR

Delegate commit creation, diff sizing check, confirmation gate, and Draft PR creation to XMC Create PR — Pull Request Creation & PR Body Population, adding these nightly-specific details to pr_body.md:

  • Link the failing main workflow run/job URL and state the root-cause classification from Stage 2.
  • Include Fixes #<issue_number> when an open nightly-failure GitHub Issue exists.
  • Push fix/nightly-${SLUG} to origin and keep the PR strictly in Draft state (XMC Create PR — Draft PR to Open Conversion Policy).

Stage 5 — Trigger Nightly Examples E2E on the PR Branch to Prove the Fix

  1. Select Verification Workflow Scope:

    • Client / SDK / Example / Verifier / Workflow Changes: nightly-examples-e2e.yml builds example images and runs the branch's SDKs and verifiers directly against xmc-nightly. Pass --input "examples_filter=<ids>" using the non-empty comma-separated failed_jobs[].example_id values from Stage 1 (validated pre-flight by dispatch_and_watch.py), or omit --input to run the full matrix when example_id is empty (non-matrix jobs such as examples-import-check or build-example-images) or when shared SDK/installer/workflow files changed.
    • Cluster-Deployed Backend / UI / Helm / Addon Changes: nightly-examples-e2e.yml tests against the server/UI currently deployed on xmc-nightly. Proving a server/UI change on xmc-nightly requires dispatching nightly-build.yml first (never deploy-gke.yml directly, whose workflow_dispatch defaults omit xmc-nightly addons). Because nightly-build.yml mutates shared xmc-nightly and pushes a nightly-* tag, obtain explicit user confirmation first, then run (and verify conclusion == "success") before step 2 below:
      SLUG="${SLUG:-<kebab-case-slug>}"
      BRANCH_NAME="${BRANCH_NAME:-fix/nightly-${SLUG}}"
      
      PYTHONPATH=. python3 tools/release/dispatch_and_watch.py --workflow nightly-build.yml --ref "${BRANCH_NAME}"
      
  2. Dispatch & Watch nightly-examples-e2e.yml on the Pushed PR Branch: Ensure origin/${BRANCH_NAME} is pushed first (Stage 4). tools/release/dispatch_and_watch.py fetches origin/${BRANCH_NAME} and resolves FETCH_HEAD automatically when --target-sha is omitted (per Workflow Orchestration & Remote Automation Invariants), correlates the newly created workflow_dispatch run, and watches it to completion (conclusion == "success"):

    SLUG="${SLUG:-<kebab-case-slug>}"
    BRANCH_NAME="${BRANCH_NAME:-fix/nightly-${SLUG}}"
    EXAMPLES_FILTER="<matrix_example_id_or_empty>"
    
    PYTHONPATH=. python3 tools/release/dispatch_and_watch.py \
      --workflow nightly-examples-e2e.yml \
      --ref "${BRANCH_NAME}" \
      --input "examples_filter=${EXAMPLES_FILTER}" \
      --state-file "${ARTIFACT_DIR:-/tmp}/nightly_verify_state.json"
    
  3. Synchronize Draft PR Description & Report Proof: Once PR CI (./tools/pr_review/wait_for_ci.py <pr_number> per XMC Create PR — CI Wait Buffer Period) and the branch nightly-examples-e2e.yml run pass on origin/${BRANCH_NAME}, update the Draft PR description via ./tools/pr_review/update_pr_description.py (XMC Create PR — PR Description Updates via Helper Tool) with the passing verification run URL, create .url.json bookmark artifacts (UserFacing: true) for the Draft PR and verification run, and report back while keeping the PR in Draft state.

04 同仓库更多 Skills

google
google/xmc

XMC Upgrade Environment

Upgrades an existing XManager on Cloud (XMC) environment on GKE to the latest current branch state using the deployment configuration YAML.

★ 8
google
google/xmc

XMC Trajectory Comparison

Validates proposed skill or rule changes by executing concurrent A/B benchmark subagents on clean baseline vs candidate worktrees, comparing trajectories, and tearing down test resources.

★ 8
google
google/xmc

XMC Review PR

Interactive multi-agent PR review workflow enforcing code rules, open direction discussions, explicit confirmation gates, inline comment deduplication, and follow-up re-review verification.

★ 8
google
google/xmc

XMC Release

Orchestrates an end-to-end XMC release workflow — deploying the latest main to nightly, running and verifying e2e tests, capturing visual snapshot galleries, generating and iterating on structured release notes with the user, and publishing the release. Use when preparing, orchestrating, or publishing a formal XMC release from main.

★ 8
google
google/xmc

XMC PR Split Verification

Analyzes pull request diffs exceeding size thresholds (400 prod / 1000 total / 1000 docs) to enforce Single Responsibility Principle (SRP), evaluate vertical slice splitting feasibility, eliminate dead code, and plan gh-stack PR stacks.

★ 8
google
google/xmc

XMC Iterative Reflection

Audits active session trajectory, thought history, and PR review comments to identify friction points, rule gaps, missing helper tools, and token inefficiencies. Use when requested by the user, after major implementations, or following PR review comment resolutions.

★ 8