Skip to content

Retry reliability port — improved persist build (2026-11-21)

Choose a tag to compare

@yyoossk yyoossk released this 21 Nov 03:04
· 5 commits to main since this release

Retry reliability port — improved persist build

A fork of SeanHeuc/CivSwitchFS at commit 0f7b361 (the pin used by SeanHeuc/civ-autoloader), with the timing learning and freeze fix from improved-20261117, plus three retry-reliability changes ported from the design of s8n/CivSwitchFS-kaiHEN (slop branch).

What's new in this build

  1. Retirement precheck (src/core/helpers/cache.mjs, src/core/steps/cleanup.mjs)
    Before running the cache-retirement waves, the payload now reads back the candidate cache entry and classifies it (original / aliased / unexpected / unavailable). If the alias is already gone — a rejected timing window can still have cleared the valid byte — the retirement waves are skipped entirely and the state counts as verified. Fewer runs end in a false "Cleanup failed; another attempt is unsafe." stop, so more failures become safe same-boot retries.

  2. Cleanup cache invalidate (src/core/ipc/filesystem.js, src/core/steps/cleanup.mjs, src/core.js)
    Cleanup now invalidates the cached dirty scratch file (save:/hole/big8, 8 MiB) via IFile::OperateRange before deleting the scratch tree and committing, so the delete + commit starts from a clean cache state.

  3. Retune threshold (src/core/steps/campaign.mjs)
    The canary campaign now retunes its delays unless at least 80% of windows qualify (previously 50%), so in-run timing adjustments engage more readily across the up-to-30-attempt budget.

Unchanged: timing learning (the XCFG record in the save) and the bounded-IPC freeze fix work exactly as in improved-20261117. The attempt budget (10, up to 30), the delay tables, and the control-wave budget are unchanged from upstream.

Status: built from source and verified at the source and payload level. The three new changes have NOT yet been verified on real hardware (the 2026-11-17 improvements remain hardware-verified). To use this build, reinstall the autoloader save once; reinstalling resets the timing record. Reinstall with improved-20261117 to go back.

Changed files vs upstream 0f7b361 (cumulative)

  • 2026-11-17 improvements: src/core/timing-slot.mjs (new), src/core.js, src/core/autoloader.mjs, persist/save-codec.js, src/core/ipc/transport.js
  • This build: src/core/helpers/cache.mjs, src/core/steps/cleanup.mjs, src/core/steps/campaign.mjs, src/core/ipc/filesystem.js, src/core.js

Build

  • persist-bootstrap.js sha256 246786a36e0d42258f485bdfe28cf85dad448aeb24a8cbc10fe75ef94dbb3d77
  • save-template.bin sha256 32fa8a0d6dd0a480d8e541e63ea44c4619bc6f7be4282cfc3cb6a4f6d305dfae (unchanged from upstream)

Credits
Original work: SeanHeuc (CivSwitchFS / civ-autoloader), Gezine (CivSwitch). Retry design reference: s8n (CivSwitchFS-kaiHEN). Same license as upstream.


リトライ信頼性の移植 — 改良版 persist ビルド

SeanHeuc/CivSwitchFS(civ-autoloader が使うピン 0f7b361)のフォークです。improved-20261117 のタイミング学習とフリーズ修正に加えて、s8n/CivSwitchFS-kaiHEN(slop ブランチ)の設計からリトライの信頼性に関わる3点を移植しました。

今回の変更

  1. リタイア前チェック(src/core/helpers/cache.mjs、src/core/steps/cleanup.mjs)
    キャッシュのリタイア用ウェーブを走らせる前に、候補エントリを読み戻して状態を判定します(original / aliased / unexpected / unavailable)。エイリアスが既に消えていればウェーブ自体を省略し、安全とみなします。「Cleanup failed; another attempt is unsafe.」で止まってしまうケースが減り、同一ブート内で安全に再試行できる幅が広がります。

  2. クリーンアップ時のキャッシュ無効化(src/core/ipc/filesystem.js、src/core/steps/cleanup.mjs、src/core.js)
    スクラッチを削除してコミットする前に、汚れたスクラッチファイル(save:/hole/big8、8MiB)のキャッシュを IFile::OperateRange で無効化します。

  3. 再調整のしきい値(src/core/steps/campaign.mjs)
    タイミング再調整が働く条件を「合格率50%未満」から「80%未満」に変更し、最大30回のアテンプトの中で調整が効きやすくしました。

タイミング学習(セーブ内 XCFG 記録)とフリーズ修正は improved-20261117 のままです。アテンプト数(10回、最大30回)、遅延テーブル、コントロールウェーブ数は upstream から変更していません。

状態:ソースとペイロードのレベルで検証済みですが、今回の3点は実機未検証です(2026-11-17 の改良点は実機確認済み)。使うにはオートローダーのセーブを1回入れ直してください。入れ直すとタイミング学習の記録は初期化されます。戻すときは improved-20261117 で入れ直してください。