Skip to content

[PR] fix: return failure status when foreign block archives fail - #6498

Merged
ranxianglei merged 16 commits into
ranxianglei:masterfrom
Afloat16:2026-11-12_foreign-sweep-failure-exit
Nov 14, 2026
Merged

ranxianglei merged 16 commits into
ranxianglei:masterfrom
Afloat16:2026-11-12_foreign-sweep-failure-exit

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #6497

Problem

bili sessions foreign-blocks --apply returns exit code 0 even when every block archive fails. The report contains failed entries and the blocks remain live, but scripts checking the process status still treat the repair as successful. This differs from the individual archive/restore commands, which report failure.

Changes

Return a nonzero result whenever the sweep has a failed archive, for both text and JSON output. Preserve the complete archived/failed report so callers can inspect partial results. Dry-runs, successful sweeps and empty reruns retain success status.

Original feature validation

The new tests seed a real SQLite store with two foreign blocks and one healthy block, then make the archive-log path a directory. On unchanged master 9674cfa, both output modes report code 0 after the real EISDIR write failure: 2 failed regressions and 1 passing dry-run control.

After the fix, all 17 tests across the new failure suite, foreign-block-sweep, and storage-maintenance-cli pass. Tests also remove the obstruction, retry successfully, confirm healthy data remains, and verify an empty rerun succeeds.

Passed: npm run typecheck; npm run build; npm run check:unused-exports; npm run check:test-import-graph; git diff --check.

The zero-token Codex preflight finds the CLI and built distribution; its local model endpoint is unreachable and the real-model case is skipped. Full real-model E2E and upstream CI remain unverified.

Scope and prior work

The exit status now reflects failures already reported by the existing sweep result; archive policy, retention, restore behavior and CLI options are unchanged. Checked 61 author PRs, 163 fork heads, complete storage-maintenance history, and foreign-blocks/failed/maintenance/exit searches. The original #5343 adds the sweep and reports failures in its body; it does not propagate them to the CLI exit status.

Current master integration

Merged upstream fcc2e848486cc2152e36b6658c517fbfa51ec428 into this branch without rewriting the existing feature commit. Integration head: da16c4133f9fa5305b5e79569448c3aa04ee6a5c. The merge parents are the original feature head 816b289db2d89e36cf00d4eb72641daa0541ac09 and the upstream commit above.

The production file and feature test are byte-for-byte unchanged from the original feature head. Relative to current master, this PR still changes only src/storage-maintenance.ts and tests/foreign-block-sweep-exit.test.ts.

Revalidated the merged tree on Node 24.22.1:

  • All 17 tests across foreign-block-sweep-exit, foreign-block-sweep, and storage-maintenance-cli pass, using the repository's storage and test-environment preloads.
  • npm run typecheck, npm run build, npm run check:unused-exports, and npm run check:test-import-graph pass.
  • git diff fcc2e848486cc2152e36b6658c517fbfa51ec428 --check is clean for this PR's net changes.

The original failure/control reproduction above remains tied to 9674cfafbc78c50245ae0d887483d3d6ce880c15; the validation in this section was rerun after integrating current master. Full real-model E2E was not rerun locally.

Review status

Linked to #6497 and ready for maintainer review. The branch now includes current master and is mergeable; GitHub no longer reports it as behind. CI run 43377305290 was queued for this exact integration head when this update was prepared. The Checks tab contains the current hosted results.

Please apply the existing ci:full label to run the FULL matrix, including the required Windows / Node 24 checks. The default CORE matrix does not produce those checks.

@ranxianglei ranxianglei changed the title fix: return failure status when foreign block archives fail [PR] fix: return failure status when foreign block archives fail Nov 13, 2026
@Afloat16
Afloat16 marked this pull request as ready for review November 13, 2026 04:46
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Duplicate screening: no duplicate. Independent check of open+closed PRs/issues on this topic (foreign-blocks exit status, storage-maintenance exit propagation, sweep-failure reporting): only related items are #5343 (the original sweep PR, closed — added the feature, did not propagate failures to exit status, as the PR body states) and #5334 (orphan-sweep, a different command and mechanism). No other PR or issue targets the foreign-blocks --apply exit status.

Label judgment (reported here; source PR not mutated per the 2026-11-12 no-relabel rule): bug / scope/storage / p2 — a repair-scheduling script misreads a failed sweep as success, but the failure is visible in the report, blocks stay live and retryable; usable with a clear workaround, no data loss.

Review — verified, not just read

  • Rebased the PR head onto current master (243709bef2): clean, no conflicts. Between the PR base (9674cfafbc) and master, the only drift in touched-area files is src/storage/store.ts (8 commits, archive-log hardening); none of it changes the archiveBlock append path this fix and its test rely on.
  • On the rebased head: npm run typecheck clean; new suite 3/3 pass; adjacent foreign-block-sweep + storage-maintenance-cli 14/14 pass (17 total, matching the PR's claim); check:unused-exports and check:test-import-graph clean.
  • Teeth check (done both directions): with the fix reverted to master's storage-maintenance.ts, exactly the 2 apply-mode tests fail and the dry-run control passes — the tests genuinely reproduce the bug, not tautologies.
  • CI (live, mirror cache): 30 checks, 0 failed, 7 test shards still in progress on the original head; all static/contract/zero-token lanes green or skipped.
  • Code quality (⑤b checklist): 2-line fix, no dead code, no new deps/exports; code: 1 matches the file's own fail() convention (src/storage-maintenance.ts:81); test follows the adjacent suite's established env/cleanup/seed patterns (tests/foreign-block-sweep.test.ts:12-14); gate discipline Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617 satisfied — both directions asserted (failure → 1; dry-run/success/empty-rerun → 0).

Existing-behavior walk (②): dry-run path (returns before apply, code 0 — tested); successful sweep (code 0 — tested via retry); empty rerun (code 0 — tested); JSON/text report shape (byte-identical, only code changes); other sessions subcommands and storage gc (untouched); CLI wiring (process.exit(r.code) at src/cli.ts:767 already handles nonzero). No regressions found.

Behavior change (disclosed per policy): bili sessions foreign-blocks --apply exit code when ≥1 archive fails: 0 → 1 (both text and JSON modes). Intended, already stated in the PR body; report content unchanged so partial results remain inspectable.

Adjacent finding — same symptom family, different command (out of scope for this PR)

bili storage gc has the same defect class: UnifiedStore.gc() (src/storage/store.ts:2004) loops if (r.ok) archived++ and silently drops per-session archive failures (no failure list, no log), and runGc (src/storage-maintenance.ts:193) returns code 0 regardless. A scheduled gc script gets the same "mistake failure for success" symptom, with even less visibility (no failed entries in the report at all). The fix is bigger than this PR's: the facade return shape { archived, contentRowsDeleted } would need a failed list, and the same facade feeds the admin HTTP endpoint (POST /__bili/storage/gc). Recommendation: keep this PR narrow (one issue = one scope); track the gc gap as a sub-item under #6497 (same user-visible symptom → same issue, separate PR for the fix).

八问

  1. 是什么问题: bili sessions foreign-blocks --apply 在块归档写失败(如 EISDIR)时仍返回退出码 0,依赖进程退出码的定时修复脚本会把失败误判为成功。
  2. 什么原因导致的: runForeignBlocks 在 applyForeignBlockSweep 返回后,两条输出路径都硬编码 code: 0 —— sweep 结果的 failed 列表只渲染进了报告正文,从未传播到退出状态(原始 [PR] Recover legacy cross-session fold blocks stuck in parent sessions (#5312) #5343 只报告、不传播)。
  3. 影响范围与严重程度: 所有以退出码判断修复结果的 foreign-blocks --apply 调用方(典型为定时脚本);失败本身在报告中可见、块保持 live 可重试,无数据丢失 —— p2(能用但有明显误判)。
  4. 怎么修复的: result.failed.length > 0 时返回 code 1(与同文件 fail() 约定一致),完整保留 archived/failed 报告;dry-run、成功、空重跑保持 0。
  5. 是否有回归问题: 无。逐项过: dry-run(0,有测试)、成功(0,有测试)、空重跑(0,有测试)、JSON/text 报告形状(不变)、其他 sessions 子命令与 storage gc(未触碰)、CLI 退出接线(已支持非零)。唯一行为变更即第 3 问所述失败退出码 0→1,有意且已在 PR 披露。
  6. 是否破坏缓存: 不涉及(纯 CLI 退出状态,无缓存/重试/游标)。
  7. 是否改了设计方向: 不涉及(无架构/边界/数据流变化)。
  8. 是否引入了新的配置: 不涉及。

判定: 可合(merge 由人执行)。PR 当前 behind master —— 已本地验证 rebase 到 243709bef2 干净且全绿,合并时 rebase 或直接用 GitHub 合并均可;原 head 的 CI 无失败、测试分片仍在跑。

ework-agent and others added 14 commits November 14, 2026 04:35
The suite baseline preload (preload-storage-baseline.mjs) pins
BILI_STORAGE_UNIFIED="legacy" for the broad corpus. After ranxianglei#6480 flipped the
storage default to pure-sqlite, the notice-registry suite's visibleNotices
assertions expect the pure-sqlite default notice, which is gated on
unifiedSelectionIsSqlite (unified "sqlite" or absent) — the preload's
"legacy" made the notice silent, so the suite was born-red on master. Pin
the selection explicitly (ranxianglei#4011 lesson: a test that depends on the production
default passes locally but fails in CI).
…test

The dsh plugin lane (ci-e2e-dsh.yml) runs node --import tsx --test
WITHOUT the preload-storage-baseline.mjs preload, so BILI_STORAGE_UNIFIED
is unset and the storage mode defaults to 'full'. Under the pure-sqlite
default flip (5a80e2b, ranxianglei#6480), 'full' mode turns the JSON envelope
writer OFF — so the .content-store.json sidecar is never written, and
the test's readdirSync(namespace) hits ENOENT.

Pin BILI_STORAGE_JSON_WRITER=on in the test so the content-store
sidecar is written regardless of the storage mode. This keeps the
corrupted-store detection path exercised in both full and legacy modes.

Closes: dsh plugin lane red on master (run 43532980164, job 132255459726)
The pure-sqlite default flip (5a80e2b, ranxianglei#6480) turns the JSON envelope
writer OFF, so the .json session file this lane asserts on is never
written and 'proxy must persist the session' / 'no persisted session
carried compressed blocks' fail after the 20s wait. Pin the writer ON in
the spawned client's env (the bootstrapped proxy inherits it) so the
envelope this test was written for is still produced.

Closes: native opencode lane red on master (run 43547593803, job 132302438610)
Same pure-sqlite default flip (5a80e2b, ranxianglei#6480) as the opencode lane:
the JSON envelope writer is OFF, so 'proxy must persist the session
within 20000ms' fails — the on-disk .json session file is never written.
Pin the writer ON in the spawned dsh client's env (the bootstrapped
proxy inherits it).

Closes: native dsh lane red on master (run 43547497015, job 132302138843)
…e2e lane

Same pure-sqlite default flip (5a80e2b, ranxianglei#6480) as the opencode/dsh
lanes: the JSON envelope writer is OFF, so 'session persisted' fails —
the on-disk .json session file is never written. Pin the writer ON in
the spawned pi client's env (the bootstrapped proxy inherits it).

Closes: pi codex-responses WS lane red on master (run 43547626291, job 132302540960)
…lane

4th lane of the pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the
JSON envelope writer is OFF, so 'proxy must persist the session' and
'at least one persisted session must carry compressed blocks' fail — the
on-disk .json session file is never written. Pin the writer ON in the
spawned pi client's env (the bootstrapped proxy inherits it).

Closes: pi package-native lane red on ci-fixes (run 43558179054, job 132336647955)
Same pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON writer
is OFF, so the per-session CCR content-store sidecar (.content-store.json)
that 'child persists its own companion and survives a proxy restart'
asserts on is never written (0 !== 1). The earlier b1bc17b pin only
covered tests/plugin-fork.test.ts, not this file. Pin the writer ON at
module load (before any SessionStore is constructed).

Closes: dsh plugin lane red on ci-fixes (run 43558179102, job 132336519539)
…lane

Pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON envelope
writer is OFF, so 'proxy must persist the session' fails — the on-disk
.json session file is never written. Pin the writer ON in the spawned
opencode client's env (the bootstrapped proxy inherits it).
Pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON envelope
writer is OFF, so the on-disk .json session envelope this lane asserts on
(exactly ONE persisted session under the raw key) is never written. Pin
the writer ON in the spawned dsh client's env.
Pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON envelope
writer is OFF, so the on-disk .json session file this lane asserts on
(state survival across the OLD→NEW update) is never written. Pin the
writer ON in the spawned proxy's env (both update phases share envBase).
Resolve CI baseline conflicts using the current upstream test setup.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ai: vllm-qwen/qwen3.8-27b)

Review — code is correct; the current head's CI is CANCELLED (not green), holding approval

The prior review (2026-11-13) verified the code on the original head and concluded mergeable. I independently re-verified the code on the current head 714dae4f5 and it holds. But the PR has since been updated to a new head (the Merge upstream master and ci-fixes commit), and that head's CI is fully cancelled — so the "green" premise no longer holds for the head under review.

Code (re-verified on head 714dae4f5)

  • runForeignBlocks computes const code = result.failed.length > 0 ? 1 : 0 and uses it in both the JSON (src/storage-maintenance.ts:290) and text (src/storage-maintenance.ts:298) return paths. The exit code propagates to the process via src/cli.ts:767 (if (r.code !== 0) process.exit(r.code)), so a failed sweep now exits 1 instead of 0.
  • New suite 3/3 pass; adjacent foreign-block-sweep + storage-maintenance-cli 14/14 pass (17 total, matching the body's claim).
  • Teeth check both directions: reverting src/storage-maintenance.ts to master → exactly the 2 apply-mode tests fail and the dry-run control passes. Genuine regression test, not a tautology.
  • No kernel/ changes, no new config, no new deps. The one behavior change (failure exit 0 → 1) is the intended fix and is disclosed in the body.

⚠️ Blocker — CI on head 714dae4f5 is fully CANCELLED

All 41 check runs / 12 check suites for head 714dae4f5 (created 2026-11-14T06:03:57Z) have conclusion cancelled and never completed. This is not green. The full regression was not verified on CI for the head under review. Please re-trigger the ci:full matrix and confirm green before merge.

File scope — body claim is now stale

The body says "Relative to current master, this PR still changes only src/storage-maintenance.ts and tests/foreign-block-sweep-exit.test.ts." The actual diff vs master is 12 files: the 2 PR-owned files + 10 test files pulled in by the Merge upstream master and ci-fixes commit. I confirmed the 10 extras come from origin/ci-fixes (pinning BILI_STORAGE_JSON_WRITER=on after #6480's pure-sqlite default) — the sanctioned CI-coordination flow — but they will merge to master via this PR, so the "only 2 files" claim is inaccurate. Worth a one-line correction so the merge is intentional.

八问

  1. 是什么问题: bili sessions foreign-blocks --apply 在块归档写失败(如 EISDIR)时仍返回退出码 0,依赖退出码的定时修复脚本会把失败误判为成功。
  2. 什么原因导致的: runForeignBlocks 的 apply 路径两条输出分支硬编码 code: 0,applyForeignBlockSweep 返回的 failed 列表只进了报告正文、从未传播到退出状态(原始 #5343 只报告、不传播)。
  3. 影响范围与严重程度: 所有以退出码判断结果的 foreign-blocks --apply 调用方(典型为定时脚本);失败在报告中可见、块保持 live 可重试、无数据丢失 —— p2(能用但有明显误判)。
  4. 怎么修复的: result.failed.length > 0 时 code=1(text/JSON 共用),完整保留 archived/failed 报告;dry-run/成功/空重跑保持 0。
  5. 是否有回归问题: 无。逐项过: dry-run(0,有测试)、成功(0,有测试)、空重跑(0,有测试)、JSON/text 报告形状(不变)、其他 sessions 子命令与 storage gc(未触碰)、CLI 退出接线(已支持非零)。唯一行为变更=失败退出码 0→1,有意且已披露。
  6. 是否破坏缓存: 不涉及(纯 CLI 退出状态,无缓存/重试/游标)。
  7. 是否改了设计方向: 不涉及(单函数退出码修正,无架构/数据流变化)。
  8. 是否引入了新的配置: 不涉及(无新 env/config/默认值)。

判定: 代码合格(本地已双向往返验证),但当前 head 714dae4f5 的 CI 整轮被取消(41/41 cancelled),全量回归未在 CI 上验证 —— 先重跑 ci:full 矩阵确认绿再合。另请修正文 "only 2 files" 的过期表述(实际 12 文件,10 个来自 ci-fixes 合并)。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Review posted — COMMENT (holding approval; CI on the current head is cancelled, not green)

I posted a formal review (COMMENT) on this PR. Summary:

Code is correct (independently re-verified on head 714dae4f5):

  • The fix is minimal and right: runForeignBlocks now computes code = result.failed.length > 0 ? 1 : 0 and uses it in both the JSON and text return paths; the exit code propagates via src/cli.ts:767.
  • New suite 3/3 pass; adjacent foreign-block-sweep + storage-maintenance-cli 14/14 pass (17 total).
  • Teeth check both directions: reverting src/storage-maintenance.ts to master → exactly 2 apply-mode tests fail, dry-run control passes. Genuine regression test.

⚠️ Blocker — CI on head 714dae4f5 is fully CANCELLED (41/41 check runs, 12/12 suites, created 2026-11-14T06:03:57Z, never completed). This is not green. The prior review (2026-11-13) assessed an earlier head where CI was "0 failed, 7 shards in progress" — that state is stale. Please re-trigger the ci:full matrix and confirm green before merge.

File scope — body claim is stale: the body says "only 2 files" but the actual diff vs master is 12 files (the 2 PR-owned + 10 test files from the ci-fixes merge). The 10 extras are the sanctioned CI-coordination flow, but they'll merge to master via this PR, so the "only 2 files" line should be corrected.

八问

  1. 是什么问题: bili sessions foreign-blocks --apply 在块归档写失败(如 EISDIR)时仍返回退出码 0,依赖退出码的定时修复脚本会把失败误判为成功。
  2. 什么原因导致的: runForeignBlocks 的 apply 路径两条输出分支硬编码 code: 0,applyForeignBlockSweep 返回的 failed 列表只进了报告正文、从未传播到退出状态(原始 [PR] Recover legacy cross-session fold blocks stuck in parent sessions (#5312) #5343 只报告、不传播)。
  3. 影响范围与严重程度: 所有以退出码判断结果的 foreign-blocks --apply 调用方(典型为定时脚本);失败在报告中可见、块保持 live 可重试、无数据丢失 —— p2(能用但有明显误判)。
  4. 怎么修复的: result.failed.length > 0 时 code=1(text/JSON 共用),完整保留 archived/failed 报告;dry-run/成功/空重跑保持 0。
  5. 是否有回归问题: 无。逐项过: dry-run(0,有测试)、成功(0,有测试)、空重跑(0,有测试)、JSON/text 报告形状(不变)、其他 sessions 子命令与 storage gc(未触碰)、CLI 退出接线(已支持非零)。唯一行为变更=失败退出码 0→1,有意且已披露。
  6. 是否破坏缓存: 不涉及(纯 CLI 退出状态,无缓存/重试/游标)。
  7. 是否改了设计方向: 不涉及(单函数退出码修正,无架构/数据流变化)。
  8. 是否引入了新的配置: 不涉及(无新 env/config/默认值)。

判定: 代码合格(本地已双向往返验证),但当前 head 714dae4f5 的 CI 整轮被取消(41/41 cancelled),全量回归未在 CI 上验证 —— 先重跑 ci:full 矩阵确认绿再合。另请修正文 "only 2 files" 的过期表述(实际 12 文件,10 个来自 ci-fixes 合并)。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Review complete. Formal review (COMMENT) posted on this PR; full findings + 八问 in the review above.

Verdict: code is correct (independently verified on head 714dae4f5, teeth check both directions — reverting the fix fails exactly the 2 apply-mode tests), but CI on that head is fully CANCELLED (41/41 check runs) — not green. Hold approval until ci:full is re-run and green. Secondary: body's "only 2 files" claim is stale (actual 12 files, 10 from the ci-fixes merge).

No small findings to fix on the spot (both findings are CI-state / author's body to correct); no kernel/ changes so the HARD RULE does not apply. Reported one line on CI coordination #4599.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ai: vllm-qwen/qwen3.8-27b)

Review — APPROVE: code correct, CI re-triggered (nearly green), previous cancellation resolved

The PR was updated to a new head 101dc32e6 (a merge of the latest master 9495c764 into the branch). This addresses the previous review's CI-cancellation blocker: the CI is now running (no longer cancelled).

Code (re-verified, byte-for-byte unchanged)

  • The fix diff is identical to the original: runForeignBlocks computes const code = result.failed.length > 0 ? 1 : 0 and uses it in both the JSON and text return paths. Exit propagates via src/cli.ts:767.
  • Independently re-verified locally (previous review): new suite 3/3 pass, adjacent foreign-block-sweep + storage-maintenance-cli 14/14 pass, teeth check both directions (reverting the fix → exactly 2 apply-mode tests fail, dry-run control passes).

CI (previous blocker resolved; nearly green)

  • The previous head 714dae4f5 had all 41 checks CANCELLED. The new head 101dc32e6 has a fresh CI run: 16 success + 12 skipped + 2 in_progress + 0 failed (total 30). The 2 in_progress are the last test shards (ubuntu 22/24); all 28 completed checks are green. The CI is on track to be fully green — the previous cancellation is resolved.

Net diff (body claim slightly stale)

  • The body says "only 2 files" but the actual net diff vs the new base 9495c764 is 3 files: src/storage-maintenance.ts (+3 -2, the fix), tests/foreign-block-sweep-exit.test.ts (+81, the test), and tests/e2e/e2e-update-state.test.ts (+5, from the ci-fixes merge — 9 of the 10 ci-fixes test files are now in master, so only this 1 remains in the net diff). The 3rd file is the sanctioned CI-coordination flow, not the PR's intended fix. The PR's intended fix is still just the 2 PR-owned files.

八问

  1. 是什么问题: bili sessions foreign-blocks --apply 在块归档写失败(如 EISDIR)时仍返回退出码 0,依赖退出码的定时修复脚本会把失败误判为成功。
  2. 什么原因导致的: runForeignBlocks 的 apply 路径两条输出分支硬编码 code: 0,applyForeignBlockSweep 返回的 failed 列表只进了报告正文、从未传播到退出状态(原始 #5343 只报告、不传播)。
  3. 影响范围与严重程度: 所有以退出码判断结果的 foreign-blocks --apply 调用方(典型为定时脚本);失败在报告中可见、块保持 live 可重试、无数据丢失 —— p2(能用但有明显误判)。
  4. 怎么修复的: result.failed.length > 0 时 code=1(text/JSON 共用),完整保留 archived/failed 报告;dry-run/成功/空重跑保持 0。
  5. 是否有回归问题: 无。逐项过: dry-run(0,有测试)、成功(0,有测试)、空重跑(0,有测试)、JSON/text 报告形状(不变)、其他 sessions 子命令与 storage gc(未触碰)、CLI 退出接线(已支持非零)。唯一行为变更=失败退出码 0→1,有意且已披露。
  6. 是否破坏缓存: 不涉及(纯 CLI 退出状态,无缓存/重试/游标)。
  7. 是否改了设计方向: 不涉及(单函数退出码修正,无架构/数据流变化)。
  8. 是否引入了新的配置: 不涉及(无新 env/config/默认值)。

判定: APPROVE。代码合格(本地已双向往返验证,与上一轮一致);CI 已重跑(28/30 完成、0 失败、2 个测试分片 in_progress,前一轮的整轮取消已解决)。唯一小瑕疵:正文 "only 2 files" 略过期(实际 net diff 3 文件,第 3 个 tests/e2e/e2e-update-state.test.ts 来自 ci-fixes 合并,属授权的 CI 协调流,非本 PR 的修复内容)——非阻塞。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Review posted — APPROVE (code correct; CI re-triggered, nearly green; previous cancellation resolved)

The PR was updated to a new head 101dc32e6 (a merge of the latest master 9495c764). This addresses the previous review's CI-cancellation blocker.

Code: byte-for-byte unchanged, correct (re-verified: new suite 3/3 + adjacent 14/14 pass, teeth check both directions — reverting the fix fails exactly the 2 apply-mode tests).

CI: the previous head 714dae4f5 had all 41 checks CANCELLED. The new head 101dc32e6 has a fresh run: 16 success + 12 skipped + 2 in_progress + 0 failed (total 30). All 28 completed checks are green; the 2 in_progress are the last test shards (ubuntu 22/24). The previous cancellation is resolved; the CI is on track to be fully green.

Net diff: 3 files (2 PR-owned + 1 ci-fixes file tests/e2e/e2e-update-state.test.ts — 9 of the 10 ci-fixes test files are now in master, so only this 1 remains). The body's "only 2 files" is slightly stale, but the PR's intended fix is still just the 2 PR-owned files. Non-blocking.

八问

  1. 是什么问题: bili sessions foreign-blocks --apply 在块归档写失败(如 EISDIR)时仍返回退出码 0,依赖退出码的定时修复脚本会把失败误判为成功。
  2. 什么原因导致的: runForeignBlocks 的 apply 路径两条输出分支硬编码 code: 0,applyForeignBlockSweep 返回的 failed 列表只进了报告正文、从未传播到退出状态(原始 [PR] Recover legacy cross-session fold blocks stuck in parent sessions (#5312) #5343 只报告、不传播)。
  3. 影响范围与严重程度: 所有以退出码判断结果的 foreign-blocks --apply 调用方(典型为定时脚本);失败在报告中可见、块保持 live 可重试、无数据丢失 —— p2(能用但有明显误判)。
  4. 怎么修复的: result.failed.length > 0 时 code=1(text/JSON 共用),完整保留 archived/failed 报告;dry-run/成功/空重跑保持 0。
  5. 是否有回归问题: 无。逐项过: dry-run(0,有测试)、成功(0,有测试)、空重跑(0,有测试)、JSON/text 报告形状(不变)、其他 sessions 子命令与 storage gc(未触碰)、CLI 退出接线(已支持非零)。唯一行为变更=失败退出码 0→1,有意且已披露。
  6. 是否破坏缓存: 不涉及(纯 CLI 退出状态,无缓存/重试/游标)。
  7. 是否改了设计方向: 不涉及(单函数退出码修正,无架构/数据流变化)。
  8. 是否引入了新的配置: 不涉及(无新 env/config/默认值)。

判定: APPROVE。代码合格(本地双向往返验证),CI 已重跑且前一轮整轮取消已解决(28/30 已绿、0 失败,2 个测试分片仍在跑)。唯一小瑕疵:正文 "only 2 files" 略过期(实际 3 文件,第 3 个来自 ci-fixes 合并)——非阻塞。

@ranxianglei
ranxianglei merged commit d768cb4 into ranxianglei:master Nov 14, 2026
50 checks passed
@ranxianglei

Copy link
Copy Markdown
Owner

Superseded by #6677 (merged as 3858b6956, 2026-11-14).

Landed into master via the real merge commit d768cb4d40b (Merge Afloat16/2026-11-12_foreign-sweep-failure-exit (PR #6498)), so your original commits are preserved verbatim in master history — only hashes of the batch wrapper changed, your authorship and commit messages are intact.

The fix for #6497 is now in master. Closing this PR as superseded — thanks for the careful, well-tested fix.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Confirmed — the fix for #6497 is in master via PR #6677 (merged as 3858b6956, real merge commit d768cb4d40b), with the original commits preserved verbatim in master history. Thanks for the careful review and for landing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

foreign-blocks --apply signals success after archive writes fail

2 participants