chore(wolf): regenerate handoff, sync anatomy/memory bookkeeping

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-28 03:54:58 +00:00
parent 25d8a461fa
commit eee76a75ab
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
6 changed files with 952 additions and 825 deletions

View file

@ -5,54 +5,48 @@
---
## ✅ Done
## ✅ Done (2026-09-27, all pushed)
- **Worker security fixes** (2026-09-26, pushed, all TDD RED→GREEN, worker suite 12/12, sequential HA soaks PASS on xcecd_virtual):
- **bug-1508** (`7723a4f4`): worker `fetchfile` (root) opened any path. Now only `<dir>/job_<jobid>_task<N>.out` for the request's jobid (exact match, `xcecd_is_job_output_path()` in `worker/include/job_output_path.h`), O_NOFOLLOW|O_NONBLOCK, regular single-link file. Also closed the REST route (submit with `out_file=/etc/shadow`, then GET output).
- **bug-1868** (`7864a3da`): job output file created as root in /tmp followed planted links. `xcecd_create_job_output()` unlinks + O_EXCL|O_NOFOLLOW.
- **bug-1869** (`5df33e69`): `xcecd_worker.log` (was chmod 0666 by path), `/tmp/xcecd_worker.log` append, and the restart flag. `worker/include/xcecd_tmpfile.h`: `xcecd_open_owned_file()` / `xcecd_owned_file_exists()`, fchmod instead of chmod(path).
- Live gap: the sandbox only runs `xcecd_virtual`, so the real root worker's output/log creation is covered by unit tests only.
- **bug-1754** (2026-09-26, `6876e4f6`, pushed): a failed job's exit code is now persisted. A worker reports every nonzero exit as a FAIL (not FINISH), and WAL_JOB_FAIL had no code slot, so `job.exit_info` was NULL for every failed job. WAL_JOB_FAIL now carries an int32 code trailer (`persist_submit_job_fail_fact`); both apply seams adopt it via `apply_job_fail_exit_code()` (non-POST_EXEC stages only). `apply_wal_entry` also no longer assigns wire state 0 for STAGE_FLAG FAIL entries. New `test_wal_job_fail_fact.c`; controller suite 1228/0. Soaks: sequential 6 rounds PASS (SIMVERIFY 7 files, 0 mismatches) + factstream 2 rounds PASS.
- **HA stability fixes** (2026-09-25, pushed, soak-verified): bug-1864 (per-endpoint FIFO in vtask dispatcher), bug-1865 (primary control endpoint refcounted, no double-close), bug-1850 (NOT_READY retries in place, no failover rotate), bug-1854 (re-pushed resource defs are idempotent).
- **bug-1714 / bug-1840** marked cannot-reproduce (0 crashes across 2,400-element burst on old + current builds).
- **Gitea sync** (2026-09-26): issues #264-#289 created (#287-#289 = bug-1508/1868/1869) (recent bugs + bug-1798..1804, 1714, 1754, 1850, 1854, 1508, 1868, 1869), #74 closed. Only a subset of the buglog is mirrored by design; `scripts/gitea-sync.py` gained `--ids` because bulk triage bumped the date fields `--since` relies on.
- Logged: **bug-1866** (worker `launch_type` leak), **bug-1867** (controller snapshot drops `exit_info` — capnp `Job` has no exit field).
- **Bug records are Markdown** (`d26ff887`): one `.wolf/bugs/<id>.md` per bug, written to `.claude/skills/buglog/bug-record.md` (bug-1866 = worked example). `buglog.json` is a generated index; 710 hook auto-detections archived in `buglog-archive.json`; 500 migrated records carry `legacy: true`. `buglog.py status` and the pre-commit hook enforce the standard. `gitea-sync.py` renders records and links fix commits; 23 issues refreshed (`25d8a461`).
- **bug-1866** fixed (`e84a8d43`): `remove_worker` frees 5 more strings. Worker suite 12/12.
- **HA / async-I/O group**: bug-1450/1451/1728/1433/1474/1469/1741 + bug-1870 follow-up (`cb1415d7`); all 6 HA soak modes PASS. bug-1747 FAIL half and bug-1867 were already fixed (`1d6c04c2`, `e4bb492a`).
- Gitea #290–#297 created; weekly report + `CHANGES.md` for Sep 20–26.
---
## 🚀 Next phase
**Goal:** _None active._ Suggested order: bug-1747 FAIL half (add finish_time to the WAL_JOB_FAIL trailer) → bug-1867 (snapshot exit_info, capnp schema) → `xce_test` harness batch + bug-1866 → a tasks-ready spec.
**Goal:** _None active._ Suggested order: `xce_test` harness bug batch → bug-1871 → spec metadata sync → a tasks-ready spec.
### Open items (not yet actioned)
- _none pending_
- **`xce_test` harness batch** (all in `src/harness`, small): bug-1574, 1702, 1703, 1705, 1707–1710, 1712, 1777, 1793, 1796, 1797. Use `buglog.py status <id> fixed --commit <sha>` — the record must meet the standard first.
- **bug-1871** (investigating): HA snapshot transfer to a rejoining standby stalls 3+ s mid-stream (2 of 4 force-snapshot runs). Suspect: edge-triggered epoll not re-signalled for data buffered while the endpoint task was blocked. Evidence: `/home/claude/tmp/xce-ha-final-force-snapshot`.
- **Other open bugs** (25 total, `buglog.py list --open`): bug-1553/1580 (intermittent controller_unit_test), bug-1632/1763 (ASAN in sim tests), bug-1604, bug-1736 partial.
- **Spec metadata lag**: `controller-status`, `scheduler-sim-live-allocation`, `xce-test-cli-ux`, `scheduler-sim-diagnostics` are functionally done but `spec.json` still reads `tasks-generated`.
- **Pending specs awaiting approval**: `controller-peers-env-fallback` (design review), `libxce-alloc-preason-equality` (tasks, 0/8, not ready).
### Files to create / edit
- _none pending_
### Open decisions
- **REST job output for jobs with a custom `out_file`/`err_file`**: the worker never writes those paths (always `/tmp/job_<id>_task<N>.out`), so since bug-1508 `GET /jobs/:id/output` for such a job returns a permission error from the worker. Either the apiserver's `resolveOutputPath()` (controllers/output.go) always targets the worker's own output file, or the worker starts honouring `out_file`. Waiting on the user.
- **~400 older bug records were never mirrored to Gitea.** A sync without `--since`/`--ids` would create an issue for each. Default: leave them off Gitea.
---
## 📁 Active architecture
- **Stack:** Go API/CLI tier (`src/frontend/apiserver`) fronting C daemons (`src/controller`, `src/worker`, `src/scheduler`); Meson-based build via `src/tools/xce-build.sh`, hermetic nix dev shell.
- **Current focus area:** `src/controller` persistence (WAL fact payloads/apply seams in `persist.c`, `job.c`) and worker root-privilege file handling (`src/worker/include/job_output_path.h`, `xcecd_tmpfile.h`).
- **Bug tracking:** `.wolf/bugs/*.md` (records) → `scripts/buglog.py` (CLI + checks) → `.wolf/buglog.json` (generated index) → `scripts/gitea-sync.py` (Gitea issues in `nexa/xce`).
- **Local-only, never committed:** `.claude/settings.json` (hook paths rewritten for this machine), `data/` (450 MB replays/logs).
---
## 🔧 Useful commands
```bash
# Build controller unit tests in place (nix shell) and run one group
cd src && nix develop . --command meson compile -C xce.build controller_unit_test xce_controller
ASAN_OPTIONS=detect_leaks=0 ./xce.build/controller/controller_unit_test -t test_wal_job_fail_fact
# HA soaks (sequential with real worker+scheduler; worker fact stream)
python3 scripts/buglog.py list --open | new ... --binary <bin> | check <id> | status <id> fixed --commit <sha>
ln -sf ../../scripts/git-hooks/pre-commit .git/hooks/pre-commit # once per clone
XCE_HA_ROUNDS=6 nix develop ./src --command bash .claude/skills/xce-test-ha/run-ha-soak.sh --sequential <dir>
nix develop ./src --command bash .claude/skills/xce-test-ha/run-ha-soak.sh --factstream <dir>
# Gitea bug sync (REST, no MCP needed) — always dry-run first
python3 scripts/gitea-sync.py --dry-run --bugs --since <date> [--ids bug-N,bug-M]
python3 scripts/gitea-sync.py --dry-run --bugs --since <date> [--ids bug-N,bug-M] # dry-run first
```