Skip to content

fix(id-bench): recover stress_gen after interrupted generation #13181

Closed

Description

@dezren39

Evidence

pkgs/id/benches/world_bench.rs:2126-2132 deletes an existing stress output root before generation, but writes manifest.json only at the end (2249-2253). If generation exits after creating the root but before writing the manifest, a retry refuses to proceed because the directory exists without a manifest.

Reproduced on the current origin/main bench binary: with ID_BENCH_STRESS_OUT=<fresh path> and ID_BENCH_STRESS_HOT_MEMBERS=0, --quick --only stress_gen exits 1 after creating the output directory (stress world hot-000 needs at least one member). Re-running with the same output path exits 1 with stress output root ... exists and holds no stress manifest; refusing to overwrite it. The failed run leaves generated files behind and no documented recovery other than manual deletion.

Why it matters

The 100x tier is explicitly expected to hit resource walls, and the run protocol treats such walls as results. Recoverable generator failures (including a resource/interruption during materialization) instead strand the deterministic output path and make reruns fail before useful work can proceed.

Acceptance criteria

  • Generation is recoverable after a failure before manifest publication; retrying the same (seed, tier, output) succeeds or reports a clear resumable/cleanup action.
  • Never recursively delete an existing directory based only on the presence of an arbitrary manifest.json; verify generator ownership/identity, and preserve unrelated files.
  • Add a regression test that induces a mid-generation failure, retries with the same output root, and verifies a valid manifest and restorable worlds (or verifies the documented safe recovery behavior).
  • Keep manifest publication atomic so consumers cannot mistake a partial generation for a complete fixture.

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane QW claiming this item (2026-11-23): premise + ownership check passed (issue open, no prior claim — only the Kaneo bot link). Plan: verify the reproduction on current main in a laptop worktree, make stress_gen recoverable after a pre-manifest failure (ownership-verified recovery, atomic manifest publication), add the mid-generation-failure regression test, PR + merge when verified.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Done — Lane QW. PR #13211 merged (merge 095714b258b2, head SHA-guarded at cea664de6776); this issue auto-closed via the PR body.

    What landed, against the acceptance criteria:

    • Recoverable generation: generation materializes into a staging sibling (.partial) carrying an ownership marker written before anything else; a retry after a pre-manifest failure recovers the verified staging directory and proceeds. The completed output root is untouched until publish, so a failed regeneration keeps the last good fixture.
    • Identity, not presence: a previous output root is replaced only after its manifest verifies (type: "stress-manifest", schema_version: 1); a foreign manifest, a manifest-less partial, or an unmarked staging directory is refused with the cleanup action named and preserved byte-for-byte. Nothing is ever recursively deleted on the strength of an arbitrary manifest.json.
    • Atomic manifest publication: temp file + sync + rename inside the staging directory, then the staging directory renames into place — the output root only ever holds a complete generation or nothing.
    • Regression test: new integration suite pkgs/id/tests/stress_gen_recovery.rs (5 tests) driving the shared lifecycle in pkgs/id/tests/common/stress_output.rs (the bench includes it via #[path], the loadgen pattern — a #[cfg(test)] module in the bench itself never runs, since the bench is harness = false). The recovery test publishes a world and restores it through WorldCore::restore from its published location.

    Verification (laptop): the 5 new tests pass (19/19 in the target incl. the shared common tests); loadgen_determinism 16/16 (the common/mod.rs registration breaks no other consumer); clippy over the bench + new test target shows no warnings in the touched files; rustfmt applied. End-to-end with the rebuilt bench binary, using this issue's own reproduction: fail with HOT_MEMBERS=0 → exit 1, no output root created, marker-bearing staging left; retry with the same bad config → staging recovered, same real error (not the old refusal); retry fixed → success with the same quick-tier hot_state_hash=8ef2ffc8a61f687b recorded at #13163 (determinism preserved); regeneration over the completed fixture succeeds; foreign-manifest directory refused with contents intact; --quick --only guest_replay unaffected.

    Remote dispatch was attempted per the dispatch-first rule (run 45160224820): the container's command step failed before any test ran — the known fleet-build container toolchain gap (#13170/#13159 family, flag-held), an environment failure rather than a test result; the laptop runs above are the verifying route.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions