myxce/docs
lei.chen 91c3fb7f04 feat(scheduler): restore PEND-reason P1 + fix dispatchwindow merge regressions
The scheduler-framework merge (2026-08-25) silently regressed the PEND
reason P1 work (4e2ac86/ee79179): the old fcfs.c became dead-on-default
(builtin_fcfs replaced it), resource.c/limit.c conflict resolution took
Rongsong's side, and the merge-fix only re-added the dispatchwindow FIELD
without the logic. After the merge, sched_queue_is_ready/sched_job_is_ready
were `return 1` stubs and only MATCH_FAIL/NO_RESOURCE were ever emitted.

Restore P1 on the active (framework) path, keeping every reason attach in
the allocator thread (bug-1521: the picker thread must not write
job->schedobj->reason — it races the allocator's MOVE_PTR):

- core.c: sched_job_is_ready (PEND & not suspended) and sched_queue_is_ready
  (QUEUE_STAT_CLOSED/INACT_ADMIN/INACT_WINDOW gate) real implementations.
- scheduler.c: allocator loop injects sched_queue_status_reason() — queue
  status first, then the dispatch window evaluated against the core's
  virtual clock (xce_core_now/1e9) so live and sim modes agree; attaches
  QUEUE_CLOSED/DRAINING/TIME_WINDOW and pends the job. Adds <time.h>.
- resource.c: skip UNAVAIL/CLOSED/CLOSED_BY_ADMIN workers + HOST_UNAVAIL
  (restored from 4e2ac86).
- limit.c: attach LIMIT_GLOBAL/LIMIT_HOST + carry reason in
  limit_job_election (restored from 4e2ac86).

Two further merge regressions found during cluster verification (the
framework core path never carried the queue dispatch window):

- core_events.c core_build_queue: duplicate q->dispatchwindow_config onto
  xce_sched_queue_t.dispatchwindow (make_sched_queue did this; the core path
  dropped it, so TIME_WINDOW could never fire on the default path).
- core_events.c core_upsert_queue update branch: refresh dispatchwindow on
  QUEUE_UPDATE.

Regression test: test_core_ready_gates.c (white-box #include of core.c,
7 cases covering both gates), registered in scheduler testsuite meson.build.

Cluster-verified on t1/t2/t3 (nix xcecore closure + AppImage standard
deployment): night queue (window closed) -> main_reason=8 time_window;
all workers down -> main_reason=9 host_unavail with per-host detail;
closed queue -> job stays PEND; normal queue baseline -> DONE. Scheduler
suite 52/53 (1 pre-existing admin-request symlink-escape failure, unrelated).

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-08-30 12:06:10 +00:00
..
superpowers/plans update documents 2026-08-10 17:51:51 +08:00
aibot_poc_investiagting.md docs: mark PEND reason end-to-end done (bug-1513), note main_reason follow-up 2026-08-13 09:16:49 +00:00
Job-Finish-Robustness-设计文档.md fix(controller,worker): dual-state worker loss + resend actual job state (bug-1509 P3) 2026-08-06 06:49:24 +00:00
left_scheduler_work.md feat(scheduler): restore PEND-reason P1 + fix dispatchwindow merge regressions 2026-08-30 12:06:10 +00:00
pend-reason-investigation-design.md docs: PEND reason investigation + classification design (LSF-aligned) 2026-08-13 10:24:32 +00:00
Scheduler-Agent-设计文档.md docs: update status — Phase 2 done, human jobid, priorities (2026-08-13) 2026-08-13 03:35:00 +00:00