From 0dccb3a9be363ccebcf88af321dcac3e08e8ac2b Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Tue, 25 Aug 2026 04:31:36 +0000 Subject: [PATCH] chore(wolf): checkpoint buglog.json (1022 bugs) --- .wolf/buglog.json | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/.wolf/buglog.json b/.wolf/buglog.json index 7e723665..256622d0 100644 --- a/.wolf/buglog.json +++ b/.wolf/buglog.json @@ -17963,21 +17963,22 @@ "error_message": "Discovered analyzing a real 108-session replay (xce_scheduler -i -s scheduler-replay-20260820-070103.replay, continue to EOF): sim_print_decision() (sim_loop.c) never printed a single DISPATCH or PREEMPT line across the entire replay -- only PEND -- even though 22 of the 30 jobs pushed at round 32 clearly transitioned to running (confirmed by ongoing JOB_UPDATE/JOB_RUSAGE ticks for jobids [0]-[21] every few rounds through round 107). An operator watching only decision output has zero confirmation those 22 jobs ever dispatched; they just silently stop appearing in PEND.", "file": "src/scheduler/src/sim_loop.c", "root_cause": "Not yet root-caused with certainty. Plausible, benign explanation: in --sim/-s REPLAY mode, jobs already resolved (dispatched) in the ORIGINAL recorded run may be replayed purely as state deltas (JOB_UPDATE/JOB_RUSAGE) without the live picker/allocator re-deriving a fresh XCE_DECISION_DISPATCH -- only jobs still outstanding (PEND) get freshly re-decided every round, which is why PEND is the only decision op ever observed. Unconfirmed against sim_loop.c's actual replay-vs-live-decide branching; needs a source read of how sim_loop.c distinguishes replayed-decision playback from freshly-computed decisions before concluding this is 'working as designed' vs a real visibility gap.", - "fix": "Not yet fixed. If confirmed benign (dispatch legitimately has no fresh decision object in replay mode), the round-summary rollup being designed for bug-1609/1610 should not label its dispatch count misleadingly (a permanent 'X dispatch' column reading 0 for an entire replay looks like a bug even when it isn't) -- consider deriving a running-job delta from info-jobs-equivalent state instead of the decision tally for replay-mode display. If NOT benign (a real decision-visibility gap), this is a separate, more serious finding than the formatting issues in bug-1609/1610.", + "fix": "Not yet fixed. If confirmed benign (dispatch legitimately has no fresh decision object in replay mode), the round-summary rollup being designed for bug-1609/1610 should not label its dispatch count misleadingly (a permanent 'X dispatch' column reading 0 for an entire replay looks like a bug even when it isn't) -- consider deriving a running-job delta from info-jobs-equivalent state instead of the decision tally for replay-mode display. If NOT benign (a real decision-visibility gap), this is a separate, more serious finding than the formatting issues in bug-1609/1610.\n\n--- STATUS UPDATE 2026-08-24 (xce-audit-invariants scheduler audit) ---\n\nRoot cause confirmed and the literal mechanism is now built: sim_reconcile_unaccounted_jobs() (sim_loop.c:566-709, landed via scheduler-sim-decision-parity tasks 2.1-3, 2026-08-22) reconstructs and reports a decision for a RUN-state job whose DISPATCH decision was only in the recorded replay stream. BUT its trigger gate (sim_loop.c:592) requires JOB_IS_RUN(job->state) before searching, and the search only scans the CURRENT round's decoded_session (decoded fresh at sim_loop.c:871, freed at line 999 -- no cross-round persistence). So reconciliation only fires when a job's DISPATCH decision and its RUN confirmation land in the exact same replay round. This bug's own original scenario (dispatch at round 32, RUN confirmation through round 107) never matches -- the round-32 DISPATCH decision is gone by the time the job reaches RUN state. The scheduler-sim-decision-parity spec's own task 4.3 implementation notes explicitly acknowledge this residual does NOT fix bug-1611's dominant real-world manifestation. A follow-up spec already exists for this exact residual: .kiro/specs/scheduler-sim-eager-reconciliation/ (created 2026-08-22, phase=requirements-generated, ready_for_implementation=false -- design/tasks not yet generated). Its diagnosis: decouple allocation CAPTURE from the JOB_IS_RUN gate (capture as soon as a DISPATCH decision is seen for a job with job->accounts == NULL, regardless of state), leaving sched_account_jobs()'s existing JOB_IS_RUN + job->accounts != NULL gate to keep deferring actual charging until state transitions to RUN. Fix location: sim_reconcile_unaccounted_jobs() (sim_loop.c:566-709), trigger gate at line 592, plus its ownership-transfer logic (609-693) needs a double-capture guard since capture would no longer imply state==RUN. Do NOT fix inline as a drive-by patch per scheduler-driver-equivalence.md's testing discipline -- promote scheduler-sim-eager-reconciliation to design/tasks instead.", "tags": [ "repl", "sim", "replay", "dispatch", "decision-visibility", - "scheduler-sim-diagnostics" + "scheduler-sim-diagnostics", + "scheduler-sim-eager-reconciliation" ], "related_bugs": [ "bug-1609", "bug-1610" ], - "occurrences": 1, - "last_seen": "2026-08-21T15:10:00Z" + "occurrences": 2, + "last_seen": "2026-08-24T21:30:00Z" }, { "id": "bug-1612", @@ -18005,7 +18006,7 @@ "error_message": "User-reported (xce_scheduler -i -s , 'info worker '): 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.", "file": "src/scheduler/src/sim_loop.c", "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.\n\n--- CONFIRMED 2026-08-21 (scheduler-sim-decision-parity spec research) ---\n\nThe \"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.\n\nAlso 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.\n\nThis 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\").\n\nA 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).\n\n--- PARTIAL FIX 2026-08-22 (scheduler-sim-decision-parity task 2.1) ---\n\nsim_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.\n\nSTILL 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.", + "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.\n\n--- CONFIRMED 2026-08-21 (scheduler-sim-decision-parity spec research) ---\n\nThe \"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.\n\nAlso 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.\n\nThis 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\").\n\nA 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).\n\n--- PARTIAL FIX 2026-08-22 (scheduler-sim-decision-parity task 2.1) ---\n\nsim_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.\n\nSTILL 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.\n\n--- CONFIRMED FIXED 2026-08-24 (xce-audit-invariants scheduler audit) ---\n\nscheduler-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).", "tags": [ "scheduler", "sim", @@ -18020,8 +18021,8 @@ "related_bugs": [ "bug-1611" ], - "occurrences": 3, - "last_seen": "2026-08-22T07:10:00Z" + "occurrences": 4, + "last_seen": "2026-08-24T21:30:00Z" }, { "id": "bug-1614", @@ -18628,6 +18629,29 @@ ], "occurrences": 1, "last_seen": "2026-08-25T04:10:00Z" + }, + { + "id": "bug-1681", + "timestamp": "2026-08-24T21:30:00Z", + "error_message": "xce-audit-invariants scheduler-driver-equivalence audit finding (not user-reported, no live symptom today): driver.c's normal-mode round (xce_sched_driver_run_normal_mode_round, driver.c:750,802) calls plugin_begin_session(sched)/plugin_end_session(sched) -- iterating every registered plugin and invoking its begin_session_fn/end_session_fn hook, called 'real, load-bearing per-session bookkeeping for EVERY registered plugin' per driver.c's own comment (lines 688-693). sim_loop.c has zero equivalent call anywhere (grep-confirmed across sim*.c/repl*.c). This is structurally the same shape of gap as bug-1613's original root cause (a driver.c-only per-session call with no sim_loop.c mirror), but under the codebase's only currently-supported configuration it is inert: sim mode's sim_bootstrap_picker() (sim_picker.c:60-70) only ever registers builtin_fcfs, which explicitly leaves begin_session_fn/end_session_fn NULL (plugins/builtin_fcfs.c:973-981), and the one plugin that does set a hook (legacy fcfs, plugins/fcfs.c:352, end_session_fn=fcfs_end_session, only sets privdata->new_session=1, no reach into resInUse/sharedInUse/job->accounts) is unreachable in sim mode either way (sim mode refuses any picker name other than builtin_fcfs).", + "file": "src/scheduler/src/sim_loop.c", + "root_cause": "plugin_begin_session()/plugin_end_session() (plugin.c:370,407) are a distinct hook category from xce_job_picker_iface_t's begin_session/end_session (which both drivers DO call symmetrically -- scheduler.c:111,131 vs sim_loop.c:467,484). Nothing in sim_loop.c or sim.c acknowledges skipping the plugin-level begin/end_session hooks -- unlike the wire/capnp-only and REPL-only differences the audit also found, which are documented deliberate exclusions.", + "fix": "Not yet fixed -- currently inert (no plugin in either driver's reachable registry sets a non-NULL begin_session_fn/end_session_fn that touches resInUse/sharedInUse/job->accounts), so no live divergence exists today. Would silently reactivate the instant any plugin sets a non-NULL hook that touches real per-session state. Recommended: either (a) add a companion plugin_begin_session(&sim->core-owning scheduler shim)/plugin_end_session() call in sched_sim_driver_run() mirroring driver.c:750,802's position (after xce_core_begin_session(), before signal; after decision drain, before xce_core_end_session()), or (b) if intentionally out of scope for sim mode, add an explicit comment in sim_loop.c and a note in scheduler-driver-equivalence.md documenting it as a deliberate exclusion (matching how the wire/capnp-only differences are already documented) so a future plugin author doesn't unknowingly reintroduce a live version of bug-1613's class of gap. Do not fix inline as a drive-by patch without user direction -- same testing-discipline caution as bug-1611/bug-1613 applies to this invariant area.", + "tags": [ + "scheduler", + "sim", + "replay", + "plugin", + "driver-equivalence", + "latent", + "scheduler-driver-equivalence" + ], + "related_bugs": [ + "bug-1611", + "bug-1613" + ], + "occurrences": 1, + "last_seen": "2026-08-24T21:30:00Z" } ] }