macOS Windows daemon parity follow-up hardening

Task 9057 · Done · Coder · created · updated

Follow-ups found while landing Task 9003 (macOS/Windows daemon parity). Each is a small hardening item: 1. `packaging/windows/bin/jaah-acp-host` runs `#!/usr/bin/env python3` without `-I` (its macOS twin uses `-I`): a PYTHONPATH or user site could shadow `acp`. Make it isolated like macOS. 2. `JaahService.cs` caps the runner service's `claude_cli_windows ensure` at 20 min; worst case is claude.exe install (900 s) + `npm pack` + `npm ci` (900 s each). Align the cap with the steps' budgets, or run the adapter step on its own budget. 3. `node_logs` off Linux: all log files share one `MAX_BATCHES_PER_PASS` and `jaahd.log` goes first, so a busy daemon log can starve `runner.log`/`update.log`. Share the budget fairly. 4. `node_logs` file cursor keys on byte offset only: a log replaced by a new file already longer than the old offset reads as an append and skips its start. Also record the file identity (inode / Windows file id). 5. Windows engine-health warnings now ship twice (from `jaahd.log` as `jaahd.service` and directly as `jaah-engine`). Ship one. 6. A Windows `.cmd` shim has no shebang, so `runner_clis` attests `claude-agent-acp` even if Node.js was removed later; then the ACP run dies at spawn instead of falling back. Attest the shim only when `windows.NODEJS_DIR\node.exe` exists. 7. `apps/jaahd/nodevault_store.py` calls `os.geteuid()` unguarded (Windows lacks it; unreachable today because a Windows node is never NodeVault-capable). Guard it. 8. Several runner hook scripts under `tools/` (read_once_guard, project_memory_*, runner_flags) use `dir_fd=` opens, which raise NotImplementedError on Windows. Extend `tools/tests/test_posix_only_calls.py` to flag `dir_fd=` on shipped paths and give Windows a path-based branch. 9. Lint gaps in `tools/tests/test_posix_only_calls.py`: `setsid` is flagged only as a shell string's first word (`cd x && setsid y` passes), and `os.setsid()` and `start_new_session=True` are not checked. Out of scope: Linux behaviour (must stay byte-identical), MicroVM, new console UI. Done means: - Each item has a test that fails without its fix (host-side jaahd/tools suites, fake-platform where needed). - `./dc check quick` is green.

Outcome

Fixed all 9 Windows/macOS hardening items, each with a test that fails without its fix. Quick gate is green and PR #6661 is queued in the merge lane. Assumed hook dir_fd calls need no Windows branch: they can't run there (allowlisted). Porting those state writes: draft #9093.

Pull request

Artifacts

Activity

  • Created
  • Run
  • Runner started
  • Runner ended (done)