Repository navigation
Description
Problem
Polylogue maintenance commands can trigger heavy disk I/O and CPU usage that competes with interactive desktop workloads. Observed on sinnix-prime (2026-05-02): Chrome freezing during polylogue doctor --repair --target session_insights with ~30 GiB read, I/O pressure full avg10 ~50%.
The deeper problem is that heavy CLI operations (reparse, materialize, doctor repair, index, embed) can run with opaque and effectively unbounded performance behavior — no throughput accounting, no built-in backpressure, no visibility into why a command is saturating the host.
Direction (revised 2026-05-02)
The initial implementation (#711) added a product-side --resource-mode flag with systemd/nice/ionice self-demotion. That was the wrong boundary. polylogue is a portable product CLI, not the host policy layer.
Revised direction:
- Remove the public
--resource-modeoption and CLI self-demotion/systemd-scope helper (fix(cli): isolate heavy foreground maintenance #711's mechanism was reverted in fix(cli): fall back when systemd scope launch fails #715). - Heavy CLI maintenance/reparse paths should not be advertised as the normal way to run workstation-scale jobs.
- Daemonized/supervised entrypoints (
polylogued) should own long-running/heavy operator work, with the host (Sinnix) supplying local cgroup/slice/device policy. - Polylogue should emit workload/run facts and eventually a queryable execution ledger (Add xtask-like execution history for Polylogue dev and operator workflows #716), not expose kernel scheduler knobs.
- No Sinnix-specific paths, devices, timers, or cgroup caps should land in Polylogue.
Acceptance criteria
--resource-modeis removed from the public CLI surface.- Heavy CLI maintenance paths are classified but do not self-demote.
- Polylogue records enough facts (records scanned/changed, bytes read/written, DB/blob/render/index counters, stage timings, RSS) for host observability to join with external monitors.
- A generic resource-wrapper hook (e.g.
POLYLOGUE_RESOURCE_WRAPPERenv) is available so hosts can inject their own scope/slice policy without Polylogue encoding host-specific details. - Heavy interactive runs on a desktop without a resource wrapper active should warn.
polylogue runpersists a compact performance ledger per run.polyloguedis the durable execution path for long-running/heavy operator work.
What landed and was reverted
- fix(cli): isolate heavy foreground maintenance #711 added
polylogue.maintenance.resourcespolicy with--resource-mode auto|off, systemd transient scope, and nice/ionice fallback. This was reverted in fix(cli): fall back when systemd scope launch fails #715 — the mechanism worked but was at the wrong architectural boundary.
Related
- Add xtask-like execution history for Polylogue dev and operator workflows #716 — execution history / xtask-like ledger
- feat(surfaces): implement polylogued local reader and query-native CLI UX #717 — polylogued daemon as the durable execution surface
- fix(acquisition): make live cursors and source freshness content-aware #620 — live ingestion cursor/freshness (daemon-owned)
- fix(browser-capture): harden capture mode, receiver, and adapters #622 — browser capture (daemon-owned)
- feat(pipeline): surface actionable performance diagnostics from existing telemetry #713 — surfacing pipeline performance diagnostics from existing telemetry
Ref #578
Activity
Sinity commentedon May 2, 2026
Implemented in #711.
Scope covered:
polylogue.maintenance.resourcespolicy for foreground heavy workloads.polylogue doctor --repair/--cleanupnow classifies mutating maintenance and applies the resource boundary before running selected maintenance.polylogue runstages (materialize,render,site,index,publish, watch-mode runs, and batchembed) go through the same resource boundary.automode prefers a Linux usersystemd-run --scopewith low CPU/I/O weights; if unavailable it falls back to process-localnice/ionice;--resource-mode offis available for benchmarks/debugging.run --reparsenow propagatesforce_writethrough pipeline execution, parsing services, and sync ingest writes so same-hash rows are replaced after parse status reset.Verification run:
pytest -q tests/unit/proof/test_evidence_runners.py;devtools render-all --check;devtools verify-topology;devtools verify-layering;devtools affected-obligations --path docs/plans/topology-target.yaml;devtools affected-obligations --path docs/topology-status.md;devtools proof-pack --path ... --markdown;devtools verify --quicklocally and again via pre-push hook.Note: a broad
pytest -q tests/unit/clirun was started but became unreliable because a concurrent livepolylogue run --reparse --source codex parse materializewas saturating the system and causing PTY/subprocess timeouts. I reran the affected PTY/subprocess tests serially after that and they passed.fix(cli): isolate heavy foreground maintenance (#711)
Sinity commentedon May 2, 2026
Closing after #711. The remaining daemon split/watch retirement questions belong to #620/#648 rather than this resource-boundary issue.
Sinity commentedon May 2, 2026
Clarification from the 2026-05-02 workstation incident: stopping/killing
polylogue run --reparse ...was emergency load shedding, not a solution.The product bug is that reparse/materialize can run with opaque and effectively unbounded performance behavior:
polylogue run --reparse --source codex --resource-mode off parse materializecan bypass the systemd/user-service resource envelope;Acceptance should include making reparse performance observable and controlled, not just documenting how to kill it. The command should either self-place into a resource-managed scope or refuse/require an explicit unsafe flag when launched without resource controls on an interactive desktop.
fix(cli): fall back when systemd scope launch fails (#715)
Sinity commentedon May 2, 2026
Follow-up investigation from the 2026-05-02 workstation pressure incident.
The resource-boundary layer from #711 exists, but it is still too easy for real workloads to bypass or overwhelm the desktop:
polylogue run --reparse ... --resource-mode off parse materializebypasses the systemd scope/process demotion entirely. That may be useful for controlled benchmarks, but it is unsafe as a normal operator escape hatch on the workstation.parse/reparseby itself. In practice--reparse parse materializewas the live bad shape, but parse/reparse can scan and rewrite a large archive even before materialize/render/index.devtools status,devtools render-agents,uv sync, and arbitrarydevtools verify/pytest work without a Polylogue-owned resource wrapper or durable run record.pyproject.tomldefaults pytest to-n auto, so full verification can fan out aggressively..localis ignored and currently holds multi-GB stale artifacts: about 21G total, including ~8.9G vetting output and ~11G browser-capture/chromium artifacts. The devshell cleans legacy Python caches but does not prune large repo-local generated state.$XDG_DATA_HOME/polylogueis still about 68G, dominated by ~40G blob store and ~3.4G render output. That may be legitimate data, but Polylogue should report why it is that size and what is reclaimable.Concrete acceptance should be broader than "run in a scope":
--resource-mode offshould be renamed/gated as an explicit unsafe benchmark/debug path or refused for heavy interactive desktop runs unless an unsafe env/flag is also present.--reparseand parse stages over non-trivial archives should be classified as heavy and resource-managed by default.devtools verify, benchmark/probe commands, and pytest fanout should either run through a devtools resource wrapper or emit a clear unmanaged-workload warning and durable run record..local/.cacheartifacts by age/size.polylogue runshould persist a compact performance ledger per run: stage durations, records scanned/changed, bytes read/written, DB/blob/render/index work, effective resource mode, cgroup/scope, and pressure/backpressure observations.Killing a runaway reparse remains emergency load shedding only; this issue should stay open until Polylogue itself makes the workload bounded, observable, and hard to launch unsafely by accident.
Sinity commentedon May 2, 2026
Portability constraint: Polylogue should not encode this workstation's concrete resource policy.
The Polylogue-side fix should be generic and host-integrable:
/cachepolicy, or timer decisions in Polylogue.POLYLOGUE_RESOURCE_WRAPPER) so Sinnix can launch heavyrun,reparse,devtools verify, and benchmark/probe work through its localsinnix-scope --class ...policy.below.Sinnix can then own the machine-specific cgroup classes, I/O caps,
/cacherouting, and global pressure report without making Polylogue workstation-specific.Sinity commentedon May 2, 2026
Direction correction from the 2026-05-02 workstation incident:
polylogueCLI should not own workstation scheduling/resource policy.The previous #711 implementation made this a product-side
--resource-modesystemd/nice/ionice mechanism. That was the wrong boundary:polylogueis a portable product CLI, not the host policy layer.polylogued-owned for long-running/heavy operator work, with Sinnix supplying local cgroup/slice/device policy.--resource-mode offor self-reexec into transient scopes.Current local fix removes the public
--resource-modeoption and deletes the CLI self-demotion/systemd-scope helper rather than adding more limits around it. Remaining acceptance for this issue should be reframed as:refactor(cli): remove foreground resource policy (#718)
Sinity commentedon May 2, 2026
Closing per 2026-05-02/03 architectural decision: Polylogue CLI should not own workstation scheduling policy. The --resource-mode mechanism was added in #711, fixed in #715, and completely removed in
15b46574 refactor(cli): remove foreground resource policy. The remaining concerns are tracked in #717 (daemon-owned execution) and #716 (execution ledger). The env hook idea (POLYLOGUE_RESOURCE_WRAPPER) is a Sinnix host concern, not a Polylogue product concern.fix(cli): isolate heavy foreground maintenance (#711)
fix(cli): fall back when systemd scope launch fails (#715)
refactor(cli): remove foreground resource policy (#718)