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
- Client / SDK / CLI Setup: Packaging, proto-overlay, or import regressions in
sdks/python/xmc/,sdks/python/xdash/,api/protos/, ordeploy/cli/install_xmanager.py. - E2E Verifiers & Shared Dirty-Environment Scoping: Stale selectors, DOM text assumptions, or truncated first-page assumptions in
tools/nightly_tests/verification/ortools/nightly_tests/examples_verification/violating Shared Dirty-Environment E2E & Pagination Testing andtools/nightly_tests/README.md. - Backend / UI / Manifest Defect: Regressions in
cmd/,internal/,pkg/,deploy/helm/,deploy/ctk_v2/,deploy/addons/, ordeploy/clickhouse/.
Layer B — Nightly Cluster (xmc-nightly) Rollout Skew or State Drift
- Client/Server Rollout Skew:
nightly-build.ymldeploysxmc-nightlyat 01:00 UTC whilenightly-examples-e2e.ymlruns at 04:00 UTC (or on demand); inspectrollout_skew.undeployed_commitsandrollout_skew.cluster_deployed_filesfrom Stage 1 to see whether the failing example depends on undeployed server changes merged afterrollout_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_runanddeploy-gke-diagnostics.
[!CAUTION] STRICT SHARED CLUSTER SAFETY INVARIANTS (
xmc-nightly):
- Never Mutate
xmc-nightlyDirectly: NEVER manually modify, apply manifests to, delete resources in, or upgradexmc-nightlyunless explicitly instructed by the user.- Isolate
KUBECONFIGDuring Read-Only Triage: Never overwrite default~/.kube/config; passexport KUBECONFIG="${ARTIFACT_DIR:-/tmp}/kubeconfig_nightly"for any read-only cluster inspection.
Stage 3 — Create an Isolated Worktree & Implement the Fix
-
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 -
Implement & Verify a Minimal, Single-Responsibility Fix: Follow XMC Feature Development and language rules under
.agents/rules/languages/:- Fix the root cause without bundling unrelated refactors or cleanups.
- Add or update unit tests per Strict Testing Coverage. Never delete or weaken existing tests or assertions to make a nightly run pass.
- Verifier fixes: Keep
examples_verification/<name>_test.pyentrypoints thin and place any cluster- or browser-independent parsing, normalization, or decision logic intools/nightly_tests/verification/with a paired*_test.pyunit test per Nightly E2E Verifier Entrypoints andtools/nightly_tests/README.md. - Stage explicit modified paths (never blind
git add -A) and run./.githooks/pre-commitand affected Bazel tests until 100% green per XMC Create PR — Pre-Commit Hooks & Commit Creation and XMC Feature Development — Test Execution via Affected Tests Tool.
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
mainworkflow run/job URL and state the root-cause classification from Stage 2. - Include
Fixes #<issue_number>when an opennightly-failureGitHub Issue exists. - Push
fix/nightly-${SLUG}tooriginand 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
-
Select Verification Workflow Scope:
- Client / SDK / Example / Verifier / Workflow Changes:
nightly-examples-e2e.ymlbuilds example images and runs the branch's SDKs and verifiers directly againstxmc-nightly. Pass--input "examples_filter=<ids>"using the non-empty comma-separatedfailed_jobs[].example_idvalues from Stage 1 (validated pre-flight bydispatch_and_watch.py), or omit--inputto run the full matrix whenexample_idis empty (non-matrix jobs such asexamples-import-checkorbuild-example-images) or when shared SDK/installer/workflow files changed. - Cluster-Deployed Backend / UI / Helm / Addon Changes:
nightly-examples-e2e.ymltests against the server/UI currently deployed onxmc-nightly. Proving a server/UI change onxmc-nightlyrequires dispatchingnightly-build.ymlfirst (neverdeploy-gke.ymldirectly, whoseworkflow_dispatchdefaults omitxmc-nightlyaddons). Becausenightly-build.ymlmutates sharedxmc-nightlyand pushes anightly-*tag, obtain explicit user confirmation first, then run (and verifyconclusion == "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}"
- Client / SDK / Example / Verifier / Workflow Changes:
-
Dispatch & Watch
nightly-examples-e2e.ymlon the Pushed PR Branch: Ensureorigin/${BRANCH_NAME}is pushed first (Stage 4).tools/release/dispatch_and_watch.pyfetchesorigin/${BRANCH_NAME}and resolvesFETCH_HEADautomatically when--target-shais omitted (per Workflow Orchestration & Remote Automation Invariants), correlates the newly createdworkflow_dispatchrun, 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" -
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 branchnightly-examples-e2e.ymlrun pass onorigin/${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.jsonbookmark artifacts (UserFacing: true) for the Draft PR and verification run, and report back while keeping the PR in Draft state.
04 同仓库更多 Skills
XMC Upgrade Environment
Upgrades an existing XManager on Cloud (XMC) environment on GKE to the latest current branch state using the deployment configuration YAML.
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.
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.
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.
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.
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.