The buglog was one 27K-line JSON file whose fields covered only symptom,
root cause and fix, as free text: 2% of entries named the code version a
bug was found on, 12% the build profile, 36% a way to reproduce, and 58% of
the file was OpenWolf hook auto-detections ("Missing guard clause",
"Function not marked async" on .md files).
- .claude/skills/buglog/bug-record.md: the record standard. Eight
sections (Summary as the title, Description, Environment, Reproduction;
Root cause, Fix, Verification, References once fixed), each with the
content it must contain -- e.g. Environment needs the OS, the libc the
failing binary loads (from its ELF interpreter: glibc 2.42 in the nix
shell vs 2.40 on the host), toolchain, build profile and commit.
- .wolf/bugs/<id>.md: 500 records migrated from buglog.json; every field
verified to round-trip. They carry legacy: true and an explicit "not
recorded" where the old log had no such field; component derived from
file paths, severity from keywords (else unknown), fix_commits from
hashes in status_note/fix that git resolves (91 of 463 fixed).
- .wolf/buglog-archive.json: the 710 hook auto-detections, verbatim.
- .wolf/buglog.json is now an index generated from the records, keeping
the fields OpenWolf's hooks and `openwolf bug search` read.
- scripts/buglog.py rewritten: new (template + Environment collected from
the machine and --binary), check, status (refuses a status the record
doesn't support; fixed needs Root cause, Fix, Verification and
--commit hashes git resolves), note, recur, set, show, list, triage,
env, index. 29 unittest cases in scripts/tests/test_buglog.py.
- scripts/git-hooks/pre-commit runs `check --staged`: incomplete staged
records, a legacy record hand-changed to fixed without the fix-time
sections, a new record claiming legacy: true, or a stale index refuse
the commit.
- scripts/gitea-sync.py reads the records: issue body = the record's
sections plus linked fix commits (origin remote, GITEA_COMMIT_REPO to
override), and a body hash so an issue's text is refreshed when the
record changes.
- bug-1866 rewritten to the full standard as the worked example.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
59 lines
9.1 KiB
Markdown
59 lines
9.1 KiB
Markdown
---
|
|
id: "bug-1613"
|
|
status: "fixed"
|
|
status_updated: "2026-09-24"
|
|
status_note: "e2bb98c8 (scheduler-sim-decision-parity)"
|
|
component: "scheduler"
|
|
severity: "unknown"
|
|
timestamp: "2026-08-21T07:25:00Z"
|
|
last_seen: "2026-09-19T09:00:00Z"
|
|
occurrences: 4
|
|
files: ["src/scheduler/src/sim_loop.c"]
|
|
tags: ["scheduler", "sim", "replay", "resource-accounting", "resInUse", "sched_account_jobs", "correctness", "repl", "confirmed"]
|
|
related: ["bug-1611"]
|
|
fix_commits: ["e2bb98c8"]
|
|
legacy: true
|
|
---
|
|
|
|
# bug-1613: User-reported (xce_scheduler -i -s <replay>, 'info worker <name>'): every CONSUMABLE resource's…
|
|
|
|
## Description
|
|
User-reported (xce_scheduler -i -s <replay>, 'info worker <name>'): every CONSUMABLE resource's used= value reads 0.00 for a worker regardless of how many jobs are actually dispatched and running on it, e.g. 'resource slots: value=22.00 used=0.00' and 'resource mem: value=17286225920.00 used=0.00' with jobs clearly active (confirmed via ongoing JOB_RUSAGE ticks in the same session). Confirmed real, not a display bug.
|
|
|
|
## Environment
|
|
_Not recorded (migrated from buglog.json)._
|
|
|
|
## Reproduction
|
|
_Not recorded (migrated from buglog.json)._
|
|
|
|
## Root cause
|
|
sched_account_jobs() (scheduler.c:1255, exported via scheduler.h) is the ONLY mechanism that re-populates per-worker (w->resInUse) and shared (core->sharedInUse) resource-in-use accounting after each session's resval reset zeroes them (core.h's own doc comment on xce_core_begin_session()/xce_core_signal_go(): 'the picker thread must never observe a session whose resource-in-use accounting has been reset to zero ... but not yet re-summed from currently running jobs (sched_account_jobs())'). This obligation was split out (scheduler-core spec task 5.2) into xce_core_begin_session()+xce_core_signal_go() specifically so a driver can call sched_account_jobs() in between; the normal-mode driver does this correctly (driver.c:739-749, xce_sched_driver_run_normal_mode_round(): xce_core_begin_session() -> plugin_begin_session()+sched_account_jobs() -> xce_core_signal_go()). The simulation driver (sim_loop.c:680) was never migrated to this split -- it still calls the older monolithic xce_core_go() (core_session.c:402-409, itself now just xce_core_begin_session()+xce_core_signal_go() called back-to-back with zero interleaving slot), and sim_loop.c/sim.c/sim_verify.c/sim_record.c contain NO call to sched_account_jobs() anywhere (grep-confirmed). Consequently every session's resval reset in simulation/replay mode is never followed by re-accumulation, so w->resInUse/core->sharedInUse stay at their zero-initialized value for the entire run -- even a job freshly dispatched via sched_commit_decision()'s direct sched_charge_account() call (scheduler.c:1438-1443) would have that charge wiped by the very next session's reset with nothing to re-sum it. Broader concern (not yet verified): the live allocator thread's own capacity checks (sched_try_alloc_on_host_ -> sched_check_host_satisfy/sched_meet_host_selection, resource.c) may read w->resInUse to compute free capacity -- if so, the simulation driver could be scheduling against permanently-zero 'in use' data, i.e. believing full capacity is always available regardless of what is actually running, which would be a correctness risk for scheduler-core's documented normal-mode/sim-mode decision-equivalence invariant, not merely a REPL display cosmetic. This needs confirmation before being treated as proven.
|
|
|
|
## Fix
|
|
Not yet fixed -- investigation only, per user request. Proposed direction: call sched_account_jobs(sched) in sim_loop.c's round loop, in the same relative position driver.c uses (after xce_core_begin_session()'s resval reset, before signaling the picker/allocator thread) -- likely requires migrating sim_loop.c from the monolithic xce_core_go() to the split xce_core_begin_session()+xce_core_signal_go() calls, mirroring xce_sched_driver_run_normal_mode_round()'s exact pattern (driver.c:739-749). Should be paired with confirming/refuting the broader allocator-capacity-check concern above before scoping a fix.
|
|
|
|
--- CONFIRMED 2026-08-21 (scheduler-sim-decision-parity spec research) ---
|
|
|
|
The "broader concern (not yet verified)" above is CONFIRMED, not theoretical: `sched_check_host_satisfy_()`/`sched_check_shared_satisfy_()` (resource.c) read `w->resInUse`/`core->sharedInUse` directly as inputs to the live allocator's own per-host capacity check (`sched_try_alloc_on_host_`'s viability test). With `resInUse` permanently zero in sim/replay mode, simulation-mode capacity checks can systematically pass where normal-mode execution of the same recorded state would fail -- this is a scheduling-decision-correctness bug under resource contention, not merely a REPL display cosmetic.
|
|
|
|
Also determined to likely share one root cause with bug-1611 (see that entry): sim_loop.c decodes the recorded decision stream (`decoded_session->decisions`) every round but only ever uses it for optional `--sim-verify` comparison, never to reconstruct state (job->allocs/job->accounts) or report a decision for a job already resolved before the replay reaches it.
|
|
|
|
This is now elevated to an enforced steering invariant: `.kiro/steering/scheduler-driver-equivalence.md` ("normal-mode and sim-mode must produce identical decisions AND identical resource-accounting state, not just a matching decision sequence").
|
|
|
|
A dedicated fix spec has been scoped (deliberately not folded into the closed scheduler-core spec or the narrower scheduler-sim-repl-verbosity spec): `.kiro/specs/scheduler-sim-decision-parity/` (requirements approved; design generated, not yet approved; tasks not yet generated -- next step is /kiro-validate-design or /kiro-spec-tasks). Chosen approach: reconstruct job->allocs/job->accounts for already-resolved RUN-state jobs from the recorded decision stream at the round-boundary accounting point, keyed/deduped on job->accounts == NULL (the same signal sched_account_jobs() already uses), and feed the reconstructed decision through the same on_decision/xce_repl_check_decision reporting path a fresh decision uses -- fixing bug-1613's accounting gap and bug-1611's decision-visibility gap as one change. See that spec's research.md for full architecture-option evaluation and risks (--sim-verify interaction, snapshot-restored jobs with no in-window recorded decision).
|
|
|
|
--- PARTIAL FIX 2026-08-22 (scheduler-sim-decision-parity task 2.1) ---
|
|
|
|
sim_loop.c's round boundary now calls the relocated sched_account_jobs(&(sim->core)) (core.h, task 1.1) in exactly the position driver.c uses: xce_core_go() replaced with the split xce_core_begin_session() -> [reconciliation insertion point, not yet built] -> sched_account_jobs() -> xce_core_signal_go() sequence. Proven via a new spy-based regression test (test_sim_session_ordering.c): 0 calls pre-fix (RED, matches this bug's own symptom exactly), 2 calls (one per replayed round) with core->session_active==1 post-fix (GREEN). Interactive and batch sim runs share this one call site (Req 5.1), no change to normal-mode behavior (Req 5.3) -- full scheduler suite 45/46 OK post-fix, only pre-existing unrelated bug-1560 fails.
|
|
|
|
STILL NOT FULLY OBSERVABLE END-TO-END: confirmed while implementing this task that job->accounts/job->allocs is ALWAYS NULL for every RUN-state job in sim mode today -- sim_picker_thread_fn() never emits a live DISPATCH (unconditionally PENDs every candidate), and sched_commit_decision() (the only function that ever sets job->accounts) is only ever called from scheduler.c's real sched_allocator() thread, which sim mode never runs. sched_account_jobs()'s round-boundary re-charge therefore has nothing to charge yet in isolation -- 'info worker' will still show used=0.00 until Recorded-Decision Reconciliation (scheduler-sim-decision-parity tasks 2.2-2.4, not yet implemented) populates job->accounts from the recorded decision stream. This task deliberately leaves a documented insertion point for that work (sim_loop.c comment, right before the sched_account_jobs() call) rather than building it now (out of task 2.1's own scope). Do not close this bug until tasks 2.2-2.4 land.
|
|
|
|
--- CONFIRMED FIXED 2026-08-24 (xce-audit-invariants scheduler audit) ---
|
|
|
|
scheduler-sim-decision-parity's remaining tasks (2.2-4.3) are now implementation-complete (spec.json phase=implementation-complete, updated_at 2026-08-22T13:10:00Z). sim_reconcile_unaccounted_jobs() (sim_loop.c:566-709) now searches each round's decoded replay decisions for RUN-state jobs with job->accounts == NULL, takes ownership of the matching DISPATCH allocation, builds job->accounts via make_job_account(), and feeds a reconstructed decision through the same reporting path a live decision uses -- called at sim_loop.c:948, immediately before sched_account_jobs() at line 950 (itself already relocated to take xce_sched_core_t* -- scheduler.c:1258 -- with no remaining signature mismatch against xce_sched_sim_driver_t). Live-verified: 'info worker' shows nonzero used= at multiple checkpoints (.wolf/memory.md line 3342). Full accounting-parity gap closed. Do not reopen for the same-round-only limitation -- that residual gap is bug-1611's concern, tracked separately (see bug-1611 and scheduler-sim-eager-reconciliation spec).
|
|
|
|
## Verification
|
|
_Not recorded (migrated from buglog.json)._
|
|
|
|
## References
|
|
- Related: bug-1611
|