myxce/.wolf
Rongsong Shen 5ee329b1b8
fix(scheduler): recorder silently truncated a round's decisions on realloc failure (bug-1843)
sched_record_session_add_decision() (recording_session.c) grows its
per-round decisions array via realloc(), doubling from 8. On a failed
growth it silently dropped the current decision and every one after it
that round, without marking the round incomplete -- finalize() then
wrote the short array as an ordinary, apparently-complete ReplaySession.
--sim-verify's replay comparison had no way to distinguish that from a
genuinely smaller live round, producing spurious "expected: <none>"
mismatches for jobs that were, in reality, correctly decided live and
simply never recorded. Live scheduling itself was unaffected either
way -- only the .replay file's own record of that one round lost its
tail.

This refutes the leading theory from the prior investigation (replay
seeing a job's first appearance "one round early" via coarser event
batching in sim_loop.c) -- confirmed via targeted diagnostic
instrumentation against the original captured .replay file: replay
deterministically reproduces the full candidate set every round;
the recording itself has the one-round gap.

Fix: track truncation on the session ctx; finalize() now refuses to
write an incomplete session and fails loudly through the same
sched_record_abort_on_error() path every other recording failure in
this subsystem already uses.

TDD: added a regression test forcing a real, deterministic realloc()
failure via -Wl,--wrap=realloc (scoped to this one test binary --
no prior malloc/realloc fault-injection harness existed in this
codebase). Verified genuine red -> green: the test fails without the
fix, passes with it. Full 85/85 scheduler suite green.

Note: this prevents future recordings from losing decisions this way;
it cannot retroactively repair an already-captured .replay file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 08:37:42 +00:00
..
hooks chore(wolf): checkpoint buglog.json (1062 bugs) 2026-08-27 08:27:43 +00:00
.gitignore chore(wolf): checkpoint buglog.json (1062 bugs) 2026-08-27 08:27:43 +00:00
_scan-state.json Merge branch 'better_xce_build' into scheduler-framework 2026-09-08 03:09:53 +00:00
anatomy-index.json chore: persist OpenWolf state, controller-peers-env-fallback spec, and scheduler backlog notes 2026-09-23 03:19:52 +00:00
anatomy.md chore: persist OpenWolf state, controller-peers-env-fallback spec, and scheduler backlog notes 2026-09-23 03:19:52 +00:00
buglog.json fix(scheduler): recorder silently truncated a round's decisions on realloc failure (bug-1843) 2026-09-23 08:37:42 +00:00
cerebrum.md fix(scheduler): sim mode force-dispatched recorded decisions past live capacity (bug-1836, bug-1838) 2026-09-21 09:50:27 +00:00
config.json docs: save scheduler-snapshot-job-allocation and xce-test-cli-ux spec docs, sync OpenWolf state 2026-08-28 06:30:37 +00:00
cron-manifest.json chore: checkpoint all prior work for clean state 2026-06-04 13:04:16 +00:00
cron-state.json chore(build): make xce-build.sh self-wrap into nix develop 2026-09-07 15:31:06 +00:00
memory.md save wolf status 2026-09-23 14:45:38 +08:00
OPENWOLF.md chore(wolf): checkpoint buglog.json (1062 bugs) 2026-08-27 08:27:43 +00:00
reframe-frameworks.md chore: checkpoint all prior work for clean state 2026-06-04 13:04:16 +00:00
STATUS.md chore(wolf): regenerate handoff, sync anatomy/memory bookkeeping 2026-09-13 09:43:21 +00:00