--- id: "bug-1930" status: "fixed" status_updated: "2026-10-09" status_note: "" component: "scheduler" severity: "wrong-result" timestamp: "2026-10-09T03:28:14Z" last_seen: "2026-10-09T03:28:14Z" occurrences: 1 files: ["src/scheduler/src/repl_trace.c", "src/scheduler/src/repl_trace_store.c", "src/scheduler/src/repl_internal.h", "src/scheduler/testsuite/test_repl_trace_cmd.c"] tags: ["repl", "sim", "trace", "jobid"] related: ["bug-1926"] fix_commits: ["ba6f42cd"] gitea_issue: 355 gitea_synced_status: "fixed" gitea_synced_hash: "b18384b47412" --- # bug-1930: xce_scheduler --sim REPL trace on job rejects the raw decimal job id info trace accepts ## Description **Observed:** `trace on job` rejects a raw packed decimal job id, the form `info trace` and `info job` accept for the same job: ``` [sim] trace: invalid job id: 104 (invalid job identity: expected --- optionally followed by [k] or [a-b] (decimal digits only, no sign or whitespace)) ``` while `info trace 104` and `info job 104` both resolve job 0-0-0-104. In the unit test the same rejection for a full packed id: ``` unexpected output for 'trace on job 81064794341244970': [sim] trace: invalid job id: 81064794341244970 (invalid job identity: expected --- optionally followed by [k] or [a-b] (decimal digits only, no sign or whitespace)) ``` **Expected:** `trace on job` accepts the same forms as `info trace`/`info job` -- the dashed id, `X[k]`, `X[a-b]` and a raw packed decimal id -- and a raw decimal id selects exactly what its dashed bare form selects (for an array-aligned id, the exact job plus the whole array, tasks.md Implementation Notes 4.3). **Impact:** inconsistent REPL grammar: an operator who copies a raw id (as `info job`/`info trace` accept it) into `trace on job` gets an error and no trace. No scheduling effect. **Found by:** user report during scheduler-sim-decision-trace validation. ## Environment - OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64 - libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2) - Toolchain: gcc (GCC) 15.2.0, meson 1.9.1 - Build: asan (xce.build), default ASAN_OPTIONS; the symptom does not depend on sanitizer options - Code: scheduler-framework @ 5ca59dc9-dirty - Deployment: standalone simulator only (`xce_scheduler --sim ... --interactive`), no controller, no workers; single dev host ## Reproduction 1. Build: `bash src/tools/xce-build.sh scheduler --jobs 12 --incremental` at the Environment commit. 2. `printf 'trace on job 104\ninfo trace 104\nquit\n' | TERM=dumb ASAN_OPTIONS=detect_leaks=0 src/xce.build/scheduler/xce_scheduler --sim src/scheduler/testsuite/fixtures/repl_trace_baseline/contention.replay --interactive --logfile /sched.log` (repo root) -- `trace on job 104` prints the "invalid job id" error above; `info trace 104` accepts the id. 3. Smaller: `test_on_job_raw_decimal_ids` in src/scheduler/testsuite/test_repl_trace_cmd.c. - Frequency: deterministic (every run, 2026-10-09) - Evidence: /home/claude/tmp/bug-1930/ -- trace-cmd-red.txt (unit test before the fix), trace-cmd-green.txt, live-green.txt (`trace on job 104` after the fix, tracing 0-0-0-104 through `continue` and `info trace 104`) ## Root cause `parse_sel()` in src/scheduler/src/repl_trace.c:210 (before the fix) passes each JOBSEL word straight to libxce's `parse_jobsel()`, whose grammar is only the dashed `cluster-apiserver-timestamp-sequence` id with an optional `[k]`/`[a-b]` (utils.h), and reports any error. `info trace`'s `info_trace_sel()` (src/scheduler/src/repl_trace_store.c:456) adds a fallback after a failed `parse_jobsel()`: an all-digits argument is taken as a raw packed id (`strtoull`), matching `info job`. The two selector parsers were written separately and only `info trace` got the fallback. Since: aa4c43c8 (scheduler-sim-decision-trace task 4.3, the `trace` command parser). Scope: `break ... jobid=` has the opposite problem (it takes only the raw form) and is tracked separately as bug-1926; not changed here. ## Fix - src/scheduler/src/repl_trace_store.c: new `repl_parse_jobsel_arg(arg, out, raw)` (declared in repl_internal.h): `parse_jobsel()` plus the raw packed decimal fallback, returned as `JOBSEL_BARE` with `key` = the number and `*raw` = true; a decimal too wide for 64 bits is `JOBSEL_EWIDTH` (before, `info trace` passed it to `strtoull`, which saturated to UINT64_MAX). `info_trace_sel()` uses it and keeps its existing behaviour (a raw id names that job). - src/scheduler/src/repl_trace.c `parse_sel()`: uses `repl_parse_jobsel_arg()`. A raw id comes back as the same `JOBSEL_BARE` selector its dashed form produces, so the existing bare-id rule applies unchanged: the exact selector, plus the whole-array selector when the id is array-aligned (Implementation Notes 4.3). repl_trace.c is 652 lines. - src/scheduler/testsuite/test_repl_trace_cmd.c: new `test_on_job_raw_decimal_ids`; the old "`7` is rejected" case now uses `7x` (a raw `7` is a valid id now), and an over-wide decimal is rejected with the width error. ## Verification - Test: `test_on_job_raw_decimal_ids` in src/scheduler/testsuite/test_repl_trace_cmd.c (raw plain id, raw array-aligned id and `104` each give the same selectors as their dashed form; mixed raw/dashed/range line) and the over-wide case in `test_invalid_arguments_leave_settings`: RED before the fix (`test_on_job_raw_decimal_ids: FAIL ... unexpected output for 'trace on job 81064794341244970': [sim] trace: invalid job id ...`; the width case got the syntax error instead), GREEN after (14 Tests 0 Failures, leak detection on). - Suites: `bash src/tools/xce-build.sh scheduler --jobs 12 --incremental`: scheduler suite 118/118 OK, asan (log: /home/claude/tmp/bug-1930/gate-scheduler-suite.log). - Live: Reproduction step 2 after the fix: `[sim] trace: enabled; applies from the next session`, then `[trace] job 0-0-0-104 ...` blocks for sessions 1-5 under `continue`, and `info trace 104` shows the stored trace (live-green.txt). ## References - Related: bug-1926 (`break ... jobid=` accepts only the raw form; separate fix) - Docs: .kiro/specs/scheduler-sim-decision-trace/tasks.md (Implementation Notes 4.3), requirements.md 1.2-1.3