Skip to content

Use Write-Progress for long-running operations #30

@ocalvo

Description

@ocalvo

Problem

PwrCortex currently has zero Write-Progress calls (grep confirms). Every long-running operation silently blocks or prints ad-hoc Write-Host banners. This:

  • Breaks automation transcripts (progress UI is invisible to non-interactive hosts, Write-Host is not).
  • Gives no indication of liveness during multi-minute swarm runs.
  • Cannot be suppressed via $ProgressPreference.

Per PwrClaude/CLAUDE.md:

Write-Progress — use for any long-running status (X of Y, percentages, migration steps, spinners). It renders in the host's progress UI and is invisible when not interactive, so it never clutters transcripts or breaks automation.

Candidate sites

  1. Invoke-LLMSwarm — planning, fan-out, per-task completion, synthesis. Natural X of Y with -PercentComplete as tasks finish.
  2. Invoke-LLMAgent — turn loop (Turn 3 of $MaxTurns), tool-call execution, token usage so far.
  3. Invoke-LLM pipeline mode — prompt N of M.
  4. Push-LLMInput — when piping a large collection, show how many items have been buffered.
  5. Get-LLMModuleDirectives — module scan across $env:PSModulePath can take seconds on large profiles.
  6. API call wait (Private/Api.ps1) — indeterminate spinner with elapsed seconds while Invoke-RestMethod is blocked.

Conventions for this issue

  • Use a distinct -Id per nested progress (swarm outer, per-task inner).
  • Use -Activity = cmdlet name, -Status = current step, -CurrentOperation = live detail.
  • Always complete with -Completed in the outermost finally so progress clears on error/cancel.
  • Do not replace Write-Verbose — progress is for users, verbose is for diagnosis. Both can coexist.

Acceptance

  • Invoke-LLMSwarm -Verbose in an interactive host shows a progress bar that advances per task.
  • The same command redirected to a file or run in CI produces no progress noise.
  • $ProgressPreference = "SilentlyContinue" silences everything.

Related

  • Sibling issue: Replace Write-Host console UI with .format.ps1xml views (some of the removed Write-Host status lines should become progress).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions