Skip to content

Add dynamic progress updates to long-running spinner operations - #5123

Merged
pelikhan merged 3 commits into
mainfrom
copilot/add-dynamic-progress-updates
Nov 30, 2025
Merged

pelikhan merged 3 commits into
mainfrom
copilot/add-dynamic-progress-updates

Conversation

Copilot AI commented Nov 30, 2025 •

Copy link
Copy Markdown
Contributor

Spinners for long-running operations showed static messages with no progress indication. This adds UpdateMessage() calls to show real-time progress during execution.

Changes

  • Cancellation operations (cancelWorkflowRuns, cancelWorkflowRunsByLockFile): Show (X/Y completed) count after each cancellation
  • Retry operations (getLatestWorkflowRunWithRetry): Show (attempt X/Y, Zs elapsed) with elapsed time tracking; spinner now created outside loop for proper updates
  • Concurrent downloads (downloadRunArtifactsConcurrent): Show (X/Y completed) using atomic counter for thread-safe progress tracking

Example output

⠋ Cancelling workflow runs... (3/10 completed)
⠋ Waiting for workflow run... (attempt 2/6, 4s elapsed)
⠋ Downloading artifacts... (7/15 completed)
✓ Downloaded artifacts (14/15 successful)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Add dynamic progress updates to long-running spinner operations</issue_title>
<issue_description>## Objective

Add dynamic progress updates to spinners for long-running operations to provide better user feedback during execution.

Context

Most spinner messages are static. The spinner library supports UpdateMessage() for dynamic updates, which is already used in one location (listWorkflowRunsWithPagination). Expanding this to other long-running operations will significantly improve UX.

Current Behavior

⠋ Downloading artifacts for run 12345...
[user waits with no progress indication]

Desired Behavior

⠋ Downloading artifacts... (45% - 2.3MB/5.1MB)
⠋ Downloading artifacts... (67% - 3.4MB/5.1MB)
⠋ Downloading artifacts... (89% - 4.5MB/5.1MB)
✓ Downloaded 3 artifacts successfully (5.1MB)

Approach

Add progress updates to key operations:

  1. Download operations (downloadRunArtifacts):

    • Show download progress percentage
    • Display bytes downloaded / total size
    • Update message as download progresses
  2. Cancellation operations (cancelWorkflowRuns):

    • Show count of runs cancelled
    • Display "Cancelling runs... (3/10 completed)"
    • Update after each successful cancellation
  3. Retry operations (getLatestWorkflowRunWithRetry):

    • Show retry attempt number
    • Display "Waiting for run... (attempt 2/5)"
    • Include elapsed time

Implementation Strategy

  1. Identify operations with measurable progress
  2. Add spinner.UpdateMessage() calls within operation loops
  3. Include relevant metrics (counts, percentages, sizes, attempts)
  4. Ensure updates don't add significant performance overhead

Files to Modify

  • pkg/cli/ files containing:
    • downloadRunArtifacts - Add download progress
    • cancelWorkflowRuns - Add cancellation count
    • getLatestWorkflowRunWithRetry - Add retry attempt number

Example Implementation

// In download loop
for i, artifact := range artifacts {
    progress := float64(i) / float64(len(artifacts)) * 100
    downloaded := calculateSize(i)
    total := calculateSize(len(artifacts))
    spinner.UpdateMessage(fmt.Sprintf("Downloading artifacts... (%.0f%% - %s/%s)", 
        progress, formatSize(downloaded), formatSize(total)))
    // ... download logic ...
}

Acceptance Criteria

  • Download operations show percentage and size progress
  • Cancellation operations show count of completed cancellations
  • Retry operations show attempt number and elapsed time
  • Progress updates don't significantly impact performance
  • Updates are smooth and not overly frequent (rate limit if needed)
  • Existing tests pass

References

AI generated by Plan Command for discussion #5094

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 30, 2025 15:04
- Add progress updates to cancelWorkflowRuns showing count of completed cancellations
- Add progress updates to cancelWorkflowRunsByLockFile showing count of completed cancellations
- Add progress updates to getLatestWorkflowRunWithRetry showing attempt number and elapsed time
- Add progress updates to downloadRunArtifactsConcurrent showing download progress count

Co-authored-by: pelikhan <[email protected]>
Move the spinner.UpdateMessage call to after the cancellation operation
completes, so the progress count accurately reflects completed operations
rather than showing incorrect progress before the operation finishes.

Co-authored-by: pelikhan <[email protected]>
Copilot AI changed the title [WIP] Add dynamic progress updates to spinner operations Add dynamic progress updates to long-running spinner operations Nov 30, 2025
Copilot AI requested a review from pelikhan November 30, 2025 15:18
@pelikhan
pelikhan marked this pull request as ready for review November 30, 2025 18:05
@pelikhan
pelikhan merged commit faacd5c into main Nov 30, 2025
@pelikhan
pelikhan deleted the copilot/add-dynamic-progress-updates branch November 30, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Add dynamic progress updates to long-running spinner operations

2 participants