Merge branch 'codex/stack-review-6285' into codex/stack-review-6288

This commit is contained in:
Dudu-0223 committed 2026-10-31 00:35:45 +08:00
commit be1500b4b6
7 files changed
+17 -25

No files matched your search

@@ -9,8 +9,8 @@
en: 00ba1f66195351e2
zh: a738b81adceda351
/agent-note-required-ci-performance-gate-for-opening-large-sessions/decision:
en: 4f94b61c48cceaf4
zh: dbb51bfe1fb0f681
en: 44679f406701cb13
zh: 45dbf85748dd23c1
/agent-note-required-ci-performance-gate-for-opening-large-sessions/calibration-evidence:
en: f1001a139470f6b7
zh: b7b46f96b84b1271
@@ -12,7 +12,7 @@ Measuring only `SessionPersistence.open()` does not stably describe the result f
## Decision
Linux pull requests run a required `node 24 / benchmarks` job that executes `pnpm run check:ci:bench` → `scripts/run-ci-bench.ts`. Its disposable library build omits repeated TypeScript diagnostics under the [PR artifact build policy](../process/2026-10-05-pr-artifact-typechecks.md); required full builds retain them. The private `@deepseek-ai/dsh-benchmarks` workspace owns benchmark-only dependencies. The command first builds workspace libraries and dedicated workers under `benchmarks/.dsh-build/`, then invokes `vitest.bench.config.ts`. The [standard hosted runner reference](../../../../.github/workflows/ci.yml) owns runner selection and the outer job timeout. The job runs the benchmark lane alone; Vitest runs one file at a time and only prepares input, starts measurement children, aggregates results, and enforces budgets. Every timed Node CPU path executes compiled JavaScript under plain Node with `NODE_OPTIONS` removed and no TypeScript loader; bare workspace imports therefore resolve from `benchmarks/node_modules` through package exports to built `lib/` entries.
Linux pull requests run a required `node 24 / benchmarks` job that executes `pnpm run check:ci:bench` → `scripts/run-ci-bench.ts`. Its disposable library build omits repeated TypeScript diagnostics under the [PR artifact build policy](../process/2026-10-05-pr-artifact-typechecks.md); required full builds retain them. The private `@deepseek-ai/dsh-benchmarks` workspace owns benchmark-only dependencies. The command first builds workspace libraries and dedicated workers under `benchmarks/.dsh-build/`, then invokes `vitest.bench.config.ts`. The [standard hosted runner reference](../../../../.github/workflows/ci.yml) owns runner selection and the outer job timeout. Required measurements use GitHub-hosted `ubuntu-24.04`, the runner family used to calibrate their budgets; general CI failover selection does not change it. The job runs the benchmark lane alone; Vitest runs one file at a time and only prepares input, starts measurement children, aggregates results, and enforces budgets. Every timed Node CPU path executes compiled JavaScript under plain Node with `NODE_OPTIONS` removed and no TypeScript loader; bare workspace imports therefore resolve from `benchmarks/node_modules` through package exports to built `lib/` entries.
Required performance gates live under top-level `benchmarks/`, grouped by measured user path rather than package ownership. Host files use `*.bench.ts`, Client-face files use `*.bench.client.ts`, and scenario-specific workers and fixtures stay beside their benchmark without a benchmark suffix. Package-local `.perf.ts` files remain non-gating diagnostics; `scripts/` owns orchestration rather than benchmark cases.
@@ -12,7 +12,7 @@ Session format v2 的推出改变了两条成本随模型输出增长的路径
## 决定
Linux pull request 运行必需的 `node 24 / benchmarks` job,执行 `pnpm run check:ci:bench` → `scripts/run-ci-bench.ts`。其临时 library 构建按 [PR 产物构建政策](../process/2026-10-05-pr-artifact-typechecks.zh.md)省略重复的 TypeScript 诊断;必需的完整构建保留这些诊断。私有 `@deepseek-ai/dsh-benchmarks` workspace 拥有 benchmark 专属依赖。该命令先构建 workspace library 和 `benchmarks/.dsh-build/` 下的专用 worker,再调用 `vitest.bench.config.ts`。[标准托管运行器说明](../../../../.github/workflows/ci.yml)拥有运行器选择及外层 job 超时。该 job 单独运行 benchmark lane;Vitest 逐文件运行,只负责准备输入、启动测量子进程、汇总结果和执行预算断言。每条被计时的 Node CPU 路径都以纯 Node 执行编译后的 JavaScript,并移除 `NODE_OPTIONS` 且不加载 TypeScript runtime;workspace 裸导入因此从 `benchmarks/node_modules` 通过 package exports 解析到构建后的 `lib/` 入口。
Linux pull request 运行必需的 `node 24 / benchmarks` job,执行 `pnpm run check:ci:bench` → `scripts/run-ci-bench.ts`。其临时 library 构建按 [PR 产物构建政策](../process/2026-10-05-pr-artifact-typechecks.zh.md)省略重复的 TypeScript 诊断;必需的完整构建保留这些诊断。私有 `@deepseek-ai/dsh-benchmarks` workspace 拥有 benchmark 专属依赖。该命令先构建 workspace library 和 `benchmarks/.dsh-build/` 下的专用 worker,再调用 `vitest.bench.config.ts`。[标准托管运行器说明](../../../../.github/workflows/ci.yml)拥有运行器选择及外层 job 超时。必需测量使用预算校准时采用的 GitHub 托管 `ubuntu-24.04` 运行器类型,不随通用 CI 故障切换选项改变。该 job 单独运行 benchmark lane;Vitest 逐文件运行,只负责准备输入、启动测量子进程、汇总结果和执行预算断言。每条被计时的 Node CPU 路径都以纯 Node 执行编译后的 JavaScript,并移除 `NODE_OPTIONS` 且不加载 TypeScript runtime;workspace 裸导入因此从 `benchmarks/node_modules` 通过 package exports 解析到构建后的 `lib/` 入口。
必需性能 gate 位于顶层 `benchmarks/`,按被测用户路径而非 package 归属组织。Host 文件使用 `*.bench.ts`,Client 面文件使用 `*.bench.client.ts`,场景专属 worker 与 fixture 留在对应 benchmark 旁且不带 benchmark 后缀。包内 `.perf.ts` 文件仍是非门禁诊断;`scripts/` 负责编排而不承载 benchmark case。
+3 -5
View File
@@ -269,14 +269,12 @@ jobs:
node-24-bench:
if: github.event_name == 'pull_request'
runs-on: >-
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
|| 'ubuntu-24.04' }}
runs-on: ubuntu-24.04
name: node 24 / benchmarks
# Wall-clock budgets need an otherwise idle runner, so this job runs the
# benchmark lane alone instead of joining a concurrent gate aggregate, with
# one measured file at a time inside that runner. The self-hosted
# failover pool is shared, so the benchmarks stay on hosted Linux there.
# one measured file at a time inside that runner. Keep the hosted runner
# family used to calibrate the budgets, independently of general CI routing.
timeout-minutes: 20
steps:
- uses: actions/[email protected]
@@ -182,11 +182,11 @@ describe('Node program process', () => {
})
it.each([{}, { timeoutMs: null }] as const)('cancels a live program and closes its managed process with %j', async (timing) => {
const { run } = await setup()
const entered = Promise.withResolvers<undefined>()
const { run, cwd } = await setup()
const controller = new AbortController()
const active = run({ ...timing, program: 'void tools.enter({}); for (;;) {}', signal: controller.signal, bindings: bindings({ enter: async () => { entered.resolve(undefined); return null } }) })
await entered.promise
// Synchronous readiness cannot remain queued on the control pipe behind the busy loop.
const active = run({ ...timing, program: 'const fs = await import("node:fs"); fs.writeFileSync("started", "ready"); for (;;) {}', signal: controller.signal, bindings: [] })
await expect.poll(() => readFile(join(cwd, 'started'), 'utf8'), { timeout: 30_000 }).toBe('ready')
controller.abort('stop')
expect((await active).error).toEqual({ kind: 'abort', message: 'stop' })
})
+2 -8
View File
@@ -675,18 +675,12 @@ describe('CI workflow', () => {
}
})
it('runs required benchmarks on a four-vCPU Blacksmith runner and falls back to hosted Linux', () => {
it('keeps required benchmarks on their calibrated hosted Linux runner', () => {
const workflow = loadWorkflow('.github/workflows/ci.yml')
const benchmark = workflowJob(workflow, 'node-24-bench')
const aggregate = workflowJob(workflow, 'all-checks-passed')
// The shared self-hosted pool is not an idle runner, so only the
// Blacksmith leg moves the benchmarks off hosted Linux.
expect(evaluateRunsOn(benchmark['runs-on'], { vars: { DSH_CI_FAILOVER_LINUX: 'blacksmith' } }))
.toBe('blacksmith-4vcpu-ubuntu-2404')
for (const mode of ['', 'selfhosted', 'unexpected']) {
expect(evaluateRunsOn(benchmark['runs-on'], { vars: { DSH_CI_FAILOVER_LINUX: mode } })).toBe('ubuntu-24.04')
}
expect(benchmark['runs-on']).toBe('ubuntu-24.04')
expect(JSON.stringify(benchmark.steps)).not.toContain('DSH_CI_FAILOVER_LINUX')
expect(benchmark.if).toBe("github.event_name == 'pull_request'")
expect(benchmark.needs).toBeUndefined()
+4 -4
View File
@@ -1,11 +1,11 @@
/** Run the benchmark suite in the two phases its measurements tolerate. */
/** Run corpus and latency-sensitive benchmarks in separate reporting phases. */
import { resolve } from 'node:path'
import { runPnpmCommand } from './compile-referenced-projects.ts'
/**
* Cases whose wall-clock endpoints cannot absorb a sibling: they drive a
* browser page, compare animation frames or paced streams, or spawn fresh
* children and budget their startup. Corpus cases tolerate a sibling.
* children and budget their startup.
*/
export const SERIAL_BENCH_FILES = [
'benchmarks/long-session-browser/long-session.bench.ts',
@@ -25,8 +25,8 @@ const CONFIG = ['--config', 'vitest.bench.config.ts'] as const
/**
* Run one phase of the suite.
* @param root - Repository root containing the Vitest configuration.
* @param phase - `first` clears the report and runs the CPU cases two at a time;
* `last` runs the browser cases one at a time and renders the report.
* @param phase - `first` clears the report and runs corpus cases;
* `last` runs latency-sensitive cases and renders the report.
* @throws If the phase fails.
*/
export function runBenchPhase(root: string, phase: 'first' | 'last'): void {