fix-wg-cleanup

Fix: wg cleanup nightly/orphaned error 'WG not initialized' in an initialized graph

Metadata

Statusopen ‖ paused
Created2026-07-26T06:37:08.378470719+00:00
Started2026-07-26T07:16:17.847250920+00:00
Completed2026-07-26T07:16:39.829205063+00:00
Tagsbug, cli
Tokens0 in / 0 out

Description

Objective

wg cleanup nightly and wg cleanup orphaned fail with "Error: WG not initialized. Run 'wg init' first." when run from the repo root of a fully initialized, actively-running graph (the daemon dispatches on it fine). So the sanctioned disk/lifecycle cleanup is unusable exactly when it's needed, forcing manual rm/graph surgery. (wg cleanup orphaned --dir exists but the default path detection is broken.)

Work

  • Fix graph detection for the wg cleanup * subcommands so they operate on the current project graph by default (consistent with wg service, wg agents, etc.).
  • Honor --dir / --graph explicitly; default to the CWD project graph.
  • Verify dry-run + --execute both work from a standard repo layout.

Validation

  • wg cleanup nightly and wg cleanup orphaned run from the repo root without "not initialized"; dry-run reports, --execute cleans.
  • Graph detection matches the rest of the wg CLI.

Reference

This session: both cleanup subcommands errored "WG not initialized" on a running graph.

Depends on

Required by

Log