Agent Skillssgl-project/sglang › scripted-runtime-notes

scripted-runtime-notes

GitHub

提供 SGLang 脚本化运行时测试中 API 添加规范,明确何时封装、何时直接读取内部状态,并强调驱动引擎真实循环而非调用私有方法的原则。

.claude/skills/scripted-runtime-notes/SKILL.md sgl-project/sglang

Trigger Scenarios

编写 SGLang 脚本化运行时测试 决定测试中是否新增 harness API 处理运行时调度器交互逻辑

Install

npx skills add sgl-project/sglang --skill scripted-runtime-notes -g -y
More Options

Non-standard path

npx skills add https://github.com/sgl-project/sglang/tree/main/.claude/skills/scripted-runtime-notes -g -y

Use without installing

npx skills use sgl-project/sglang@scripted-runtime-notes

指定 Agent (Claude Code)

npx skills add sgl-project/sglang --skill scripted-runtime-notes -a claude-code -g -y

安装 repo 全部 skill

npx skills add sgl-project/sglang --all -g -y

预览 repo 内 skill

npx skills add sgl-project/sglang --list

SKILL.md

Frontmatter
{
    "name": "scripted-runtime-notes",
    "description": "Requirements for the SGLang scripted runtime, chiefly when to add (vs not add) a harness API. Use for anything related to the scripted runtime."
}

Scripted Runtime — Notes

Notes for anything related to the SGLang scripted runtime.

When to Add an API

Tests read r.req.* and t._scheduler.* directly — there is no encapsulation boundary. A thin wrapper buys zero isolation; it only grows the surface.

Add an API only if it does real work:

  1. Control primitive — drives the engine through a real path (start_req, pause_generation, abort, evict_radix, exhaust_kv). Reuse the real path; never hand-mutate state.
  2. Hook-backed — value cannot be read from a snapshot; accumulate via scheduler_hook.on_run_batch or the recv proxy (chunks_done). Read-only; never monkey-patch; never add *_count to srt/.
  3. Multi-structure derivation, widely reused — scans chunked_req + waiting_queue + running_batch + last_batch (is_idle, status, batch_composition).

Else: don't. Read r.req.X / t._scheduler.X in the test; inline single-use accessors.

Never:

  • Weaken an assertion to fit a missing probe.
  • Probe implementation details ("field non-None", "which branch ran") — assert the consequence.

Other Tips

  • Engine-self-driven behavior: drive the real loop, don't call the private. Never synchronously call a scheduler private (e.g. scheduler._abort_on_waiting_timeout()) from the harness/test — it runs at the wrong loop phase, bypasses the ordered recv_requestsprocess_input_requests injection, and can fire in states the real loop never reaches (e.g. while paused). For sweeps the engine runs itself (timeout/idle), enable the config/env and advance the loop with yield.

Version History

  • 1df78c2 Current 2026-08-20 08:18

Same Skill Collection

.claude/skills/add-jit-kernel/SKILL.md
.claude/skills/add-sgl-kernel/SKILL.md
.claude/skills/babysit-pr-to-pass-ci/SKILL.md
.claude/skills/ci-workflow-guide/SKILL.md
.claude/skills/clean-startup-log/SKILL.md
.claude/skills/compute-mamba-ratio/SKILL.md
.claude/skills/cookbook-add-model/SKILL.md
.claude/skills/cookbook-migrate-model/SKILL.md
.claude/skills/cookbook-review-pr/SKILL.md
.claude/skills/debug-cuda-crash/SKILL.md
.claude/skills/debug-distributed-hang/SKILL.md
.claude/skills/env-var-conventions/SKILL.md
.claude/skills/generate-profile/SKILL.md
.claude/skills/kl-consistency-test/SKILL.md
.claude/skills/large-class-style/SKILL.md
.claude/skills/llm-torch-profiler-analysis/SKILL.md
.claude/skills/mechanical-refactor-verify/SKILL.md
.claude/skills/sglang-bisect-ci-regression/SKILL.md
.claude/skills/sglang-cherrypick/SKILL.md
.claude/skills/sglang-prod-incident-triage/SKILL.md
.claude/skills/sglang-runtime-context/SKILL.md
.claude/skills/speculative-naming/SKILL.md
.claude/skills/write-sglang-test/SKILL.md

Metadata

Files
0
Version
1df78c2
Hash
9d354879
Indexed
2026-08-20 08:18

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 10:05
浙ICP备14020137号-1 $방문자$