myxce/.wolf/bugs/bug-1751.md
Rongsong Shen d26ff8870d
feat(buglog): one Markdown record per bug, checked against a record standard
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>
2026-09-28 03:40:11 +00:00

5.8 KiB

id status status_updated status_note component severity timestamp last_seen occurrences files tags related legacy
bug-1751 fixed 2026-09-24 scheduler unknown 2026-09-01T09:00:00Z 2026-09-19T09:00:00Z 1
src/scheduler/src/scheduler.c
src/scheduler/src/core_session.c
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
bug-1745
bug-1746
bug-1747
bug-1748
bug-1750
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