Sglang prod incident triage

From BBuf/AI-Infra-Auto-Driven-SKILLS · View interactive version

Sglang prod incident triage is an AI agent skill from the GitHub repository BBuf/AI-Infra-Auto-Driven-SKILLS. Replay-first debug flow for SGLang serving problems. Use when a live or recent server shows health-check failures, latency or throughput regressions, queue growth, timeouts, distributed stalls, crash dumps, wrong outputs after deploys, or PD/EP/HiCache issues, and the job is to turn the problem into

How to use this skill

Skill file

SGLang Serving Debug

Use the maintained source contracts

when applying historical evidence to a current branch. The review/history

corpora retain their own capture dates; they do not certify today's dispatch

or numerical defaults. For kernel replacements, verify that the real model

executes the candidate before treating end-to-end tests as coverage.

Overview

Use this skill to turn a live serving problem into a debug path you can replay.

Use one loop:

Do not start with profiling.

Version-sensitive live-server signals:

that forget to close sessions can look like unexplained KV growth

older Rust builds differ. Confirm the ingress binary and source revision

before interpreting a 401 or 404 (see the endpoint reference).

This skill should work with more focused skills instead of re-implementing them:

compute-side path

Three examples are included:

Output Contract

Return:

When To Use It

Workflow

1. Collect a baseline bundle

Confirm the ingress and build first. Current Rust route assembly includes

load, metrics (when enabled), HiCache and profile controls but no /ready

route (it is only exempt from auth), so /ready returns 404 there; Python

route parity is not universal. A 404 can mean an older build, an unmounted

optional route or an ingress difference. Record status and response body,

then consult the actual route module. Health/readiness are different checks.

If a live server is reachable, collect a read-only bundle before anything more

intrusive:

python3 scripts/incident_artifact_tool.py collect-bundle \
  --base-url http://127.0.0.1:30000 \
  --outdir /tmp/incident_bundle

python3 scripts/incident_artifact_tool.py summarize-bundle \
  /tmp/incident_bundle

If the server is protected:

python3 scripts/incident_artifact_tool.py collect-bundle \
  --base-url http://127.0.0.1:30000 \
  --token "$SGLANG_BEARER_TOKEN" \
  --outdir /tmp/incident_bundle

The bundle script collects:

If stale or corrupt HiCache contents are the working diagnosis, capture the

bundle and relevant request dumps before calling

POST /hicache/storage-backend/clear. That endpoint clears the attached

backend's contents without detaching it; treat it as destructive and use it

only when losing the cached contents is acceptable. Attach, detach, and clear

details are in

references/endpoints-and-signals.md.

Use the summary for a quick read on:

If the summary says the bundle was captured while the server was idle, recollect

it during traffic or move quickly to dump plus replay.

If no live server is reachable, start from the best dump or log already available:

2. Save the failing request

Read references/decision-tree.md only if the

problem class is still unclear:

Then preserve the request payload that actually triggers the problem:

Do not jump straight from a live symptom to low-level debugging without first

saving something you can replay.

3. Replay on a clean target

Read references/endpoints-and-signals.md

when you need help reading the baseline bundle or the replay target.

Read references/replay-trace-profile.md

when you need the replay, trace, profile, or bisect paths.

Standard order:

  1. collect baseline bundle
  2. capture request dump or crash dump
  3. restart a clean debug target if needed
  4. replay the same issue
  5. collect replay-time logs and dumps

4. Only go deeper after replay

Replay

Use replay when:

If a crash dump exists, summarize it first:

python3 scripts/incident_artifact_tool.py summarize-dump \
  --input-file /path/to/crash_dump.pkl

Then replay:

python3 /path/to/sglang/scripts/playground/replay_request_dump.py \
  --input-file /path/to/crash_dump.pkl \
  --host 127.0.0.1 \
  --port 30000 \
  --parallel 128

If safe_pickle_load blocks a locally captured trusted dump, use:

python3 scripts/replay_trusted_request_dump.py \
  --input-file /path/to/request_dump.pkl \
  --host 127.0.0.1 \
  --port 30000 \
  --parallel 1

If replay indicates a CUDA crash path, restart the same build with coredumps

enabled before reproducing again:

SGLANG_CUDA_COREDUMP=1 \
SGLANG_CUDA_COREDUMP_DIR=/tmp/sglang_cuda_coredumps \
python -m sglang.launch_server \
  --model-path ... \
  --crash-dump-folder /tmp/sglang_crash_dump \
  ...

Then inspect the generated coredump:

cuda-gdb "$(which python3)" \
  -ex "target cudacore /tmp/sglang_cuda_coredumps/cuda_coredump_<host>.<pid>.<ts>"

For a replay-first crash example, read

references/case-studies.md.

OTel trace

Use tracing when:

If tracing was enabled at startup, you can change the level without restart:

curl "http://127.0.0.1:30000/set_trace_level?level=1"
curl "http://127.0.0.1:30000/set_trace_level?level=2"
Torch profile

Use profiling when:

At that point, switch to llm-torch-profiler-analysis. Do not duplicate

its profiling workflow here.

For a low-noise latency example, read

references/case-studies.md.

Distributed hang

If this looks like a collective stall, save the failing request, replay it on a

clean target, collect the replay-time bundle and stacks, then switch to

debug-distributed-hang.

For an example of that flow, read

references/case-studies.md.

Regression between two commits

If one commit is known-good and another is known-bad, build a deterministic

harness before doing deeper manual debugging:

  1. choose a stable reproducer: request replay, benchmark command, or correctness check
  2. make the harness return 0 on good behavior and non-zero on bad behavior
  3. run git bisect start <bad> <good>
  4. run git bisect run <harness>
  5. return here only after a candidate commit is isolated

Prefer replay-backed bisect when the regression depends on request shape or

long-running serving state.

5. Switch tools when the boundary is clear

Switch tools once the fault class is clear:

Do not switch tools before collecting the first bundle unless the user already has

decisive logs or dumps.

References

Load only what the current step needs:

Scripts

If a live bundle was collected, include its path.

If replay, trace, or profiling was chosen, say why bundle plus dump were not enough.

Current upstream debug controls — 2026-10-05

SGLang-repo companion skills now live under .agents/skills/ (#40515):

debug-cuda-crash, debug-distributed-hang, generate-profile, and

sglang-bisect-ci-regression. Verify the repository copy before invoking it.

--crash-dump-folder X configures CUDA coredumps when their environment keys

are unset, with CUDA_COREDUMP_FILE=X/%h/core.cuda.%t.%p and

CUDA_COREDUMP_PIPE=/tmp/corepipe.cuda.%h.%p. Before a crash, py-spy and

user-triggered CUDA dumps are enabled by default, with a 60 s coredump wait.

SGLANG_CUDA_COREDUMP=1 uses its separate cuda_coredump_%h.%p.%t naming;

by import-order code reading its already-set path wins. This precedence was

not GPU-tested. A configured pipe can also capture a wedged kernel.

Source: crash dump hook,

Rust ingress.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.