--- id: "bug-1751" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "scheduler" severity: "unknown" timestamp: "2026-09-01T09:00:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/scheduler/src/scheduler.c", "src/scheduler/src/core_session.c"] tags: ["worker-rejoin-resync", "task-5", "scheduler-c", "core_session-c", "requirement-5.1", "requirement-5.2", "dead-code", "driver-equivalence", "candidate-filter", "sched_reset_worker", "core_reset_workers", "design-reality-mismatch", "found-live-during-implementation", "symbol-guard-test"] related: ["bug-1745", "bug-1746", "bug-1747", "bug-1748", "bug-1750"] legacy: true --- # bug-1751: worker-rejoin-resync task 5 (scheduler candidate-filter exclusion for XCE_WORKER_RECONCILING)… ## Description worker-rejoin-resync task 5 (scheduler candidate-filter exclusion for XCE_WORKER_RECONCILING): design.md's Components/Architecture/Testing Strategy sections all cite scheduler.c:1211 (sched_reset_worker_(), the IS_WORKER_UNAVAIL skip inside the legacy sched_reset_workers()/sched_begin_session() path) as 'the existing candidate-host filter' to extend with the new reconciling-bit disjunct. Investigating before implementing (grep for every IS_WORKER_UNAVAIL skip-style check across src/scheduler/src/*.c) found sched_begin_session() has NO live callers anywhere in the current driver.c/sim_loop.c production paths -- both call xce_core_begin_session() (core_session.c, added by the scheduler-core refactor) directly instead, which runs core_reset_workers() (core_session.c:102), an independently-maintained mirror of sched_reset_worker_() with the IDENTICAL IS_WORKER_UNAVAIL-only check, per that function's own header comment ('mirrors scheduler.c's sched_reset_workers/sched_reset_worker_'). Extending only scheduler.c:1211 as design.md literally specifies would leave the task's own Observable Completion Criterion (a RECONCILING host is never selected as a dispatch candidate while the flag is set) factually false on both real drivers, since neither ever executes the code path being changed. bug-1688's own investigation (2026-08-26) independently confirms core_reset_workers()/xce_core_begin_session() as the actively-traced, live production path. No test in src/scheduler/testsuite exercises sched_reset_worker_()'s or sched_begin_session()'s IS_WORKER_UNAVAIL behavior either (design.md's Testing Strategy claim of an 'existing IS_WORKER_UNAVAIL candidate-filter test' to extend does not correspond to any test that actually exists). ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause design.md's research (Architecture > Existing Architecture Analysis) predates, or did not re-trace, the scheduler-core refactor's replacement of sched_begin_session() with xce_core_begin_session() as the driver-invoked session-start entry point on both the normal-mode driver (driver.c:751) and the simulation driver (sim_loop.c:919). sched_reset_worker_()/sched_reset_workers()/sched_begin_session() (scheduler.c) are consequently dead code on both live paths today, referenced only in historical doc comments ('the still-live sched_begin_session()...main.c loop', core_session.c:27-30, itself now stale) -- the design cited the pre-refactor site without noticing its post-refactor mirror in core_session.c had become the one that actually runs. ## Fix FIXED (2026-09-01, task 5, found live during implementation, same in-boundary-companion-fix pattern as bug-1746/bug-1747 in this same spec). Applied the identical one-line disjunct (IS_WORKER_UNAVAIL(w->status) || IS_WORKER_RECONCILING(w->status)) to BOTH scheduler.c:1211 (sched_reset_worker_(), matching design.md's literal instruction and File Structure Plan entry verbatim) AND core_session.c:102 (core_reset_workers(), the live mirror, necessary for the task's Observable Completion Criterion to hold on either real driver). Comment wording in scheduler.c/driver.c deliberately avoids the literal substring 'resync' anywhere (caught once live: an earlier comment draft containing 'worker-rejoin-resync' tripped test_no_worker_resync_symbols_in_scheduler_publish_path, since strstr() matches inside compound words too) -- fixed by rewording to 'job-state reconciliation' with no spec-name reference. New regression coverage added to test_core_session.c (white-box #include of core.c/core_session.c/core_clock.c/decision.c, the file's existing convention) since core_session.c's core_reset_workers() is reachable from a lightweight fixture (key_add() a worker directly into core->workers, populate resInUse with a known non-zero value, call the real xce_core_begin_session(), assert resInUse is/isn't zeroed) whereas scheduler.c's sched_reset_worker_() is static and scheduler.c's own dependency closure (client.h network I/O, plugin registration) is already established codebase precedent (test_snapshot_load_allocator_regression.c's header comment) as too large to white-box #include for a single new test. Five new tests: baseline available-host reset, baseline unavailable-host skip (unchanged), new reconciling-host skip, both-bits-set truth-table completeness (guards the exact orthogonal-condition mistake class flagged for this spec's task 3.2), and reconciling-bit-clears re-includes-on-next-session. Full scheduler suite (xce-build.sh scheduler, ASAN, --incremental): 54/55 OK, sched_core_session_test 13/13, sched_scheduler_decision_redelivery_test's test_no_worker_resync_symbols_in_scheduler_publish_path green and unmodified; the one remaining failure (test_job_rusage_reconciles_mem_reservation_against_usage, sched_core_events_test) is pre-existing and unrelated -- core_events.c was already modified in this worktree before this task started and this task's diff never touches it. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1745, bug-1746, bug-1747, bug-1748, bug-1750