From 141a54efed821ebe3ba12feb3b388efe9e1c24e0 Mon Sep 17 00:00:00 2001 From: Dudu-0223 Date: Sat, 31 Oct 2026 00:31:48 +0800 Subject: [PATCH 1/2] fix(ci): keep benchmarks on their calibrated hosted runner --- .../2026-09-04-session-open-performance-gate.i18n.yaml | 4 ++-- .../2026-09-04-session-open-performance-gate.md | 2 +- .../2026-09-04-session-open-performance-gate.zh.md | 2 +- .github/workflows/ci.yml | 8 +++----- scripts/ci-workflow.spec.ts | 10 ++-------- scripts/run-bench-suite.ts | 8 ++++---- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.i18n.yaml b/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.i18n.yaml index d03a5ff8c5..4eaf0b9bb3 100644 --- a/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.i18n.yaml +++ b/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.i18n.yaml @@ -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 diff --git a/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.md b/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.md index 926203ea5b..fd3518d09a 100644 --- a/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.md +++ b/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.md @@ -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. diff --git a/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.zh.md b/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.zh.md index e8a64dca20..8c0b8022d4 100644 --- a/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.zh.md +++ b/.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.zh.md @@ -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。 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3da0bda3e..91cb953a30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/checkout@v7.0.1 diff --git a/scripts/ci-workflow.spec.ts b/scripts/ci-workflow.spec.ts index acf4814d07..0ba930e847 100644 --- a/scripts/ci-workflow.spec.ts +++ b/scripts/ci-workflow.spec.ts @@ -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() diff --git a/scripts/run-bench-suite.ts b/scripts/run-bench-suite.ts index bb6b789a8f..38d18986a0 100644 --- a/scripts/run-bench-suite.ts +++ b/scripts/run-bench-suite.ts @@ -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 { From 934a228d47c6f6e58d26a191399279e5f5c287a7 Mon Sep 17 00:00:00 2001 From: Dudu-0223 Date: Sat, 31 Oct 2026 00:34:52 +0800 Subject: [PATCH 2/2] test(ptc): observe synchronous readiness before canceling a busy process --- .../ptc-runtime/ptc-runtime-node/tests/runtime.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ptc-runtime/ptc-runtime-node/tests/runtime.spec.ts b/packages/ptc-runtime/ptc-runtime-node/tests/runtime.spec.ts index 03688e1ae4..6028e5fd52 100644 --- a/packages/ptc-runtime/ptc-runtime-node/tests/runtime.spec.ts +++ b/packages/ptc-runtime/ptc-runtime-node/tests/runtime.spec.ts @@ -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() + 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' }) })