Skip to content

Fix automatic workflow run updates with improved polling mechanism - #541

Open
spboyer wants to merge 16 commits into
github:mainfrom
spboyer:fix/229-auto-refresh-new-workflow
Open

Fix automatic workflow run updates with improved polling mechanism#541
spboyer wants to merge 16 commits into
github:mainfrom
spboyer:fix/229-auto-refresh-new-workflow

Conversation

@spboyer

Copy link
Copy Markdown

Description

This PR fixes issue #229 where newly triggered workflow runs required manual refresh to see updates in the UI. The extension now automatically polls for workflow run updates and reflects changes in real-time.

Changes

Enhanced Polling Mechanism

  • Added checks for window focus and view visibility before polling to prevent unnecessary API calls
  • Enhanced logging to show run status and conclusion during polling attempts
  • Improved cleanup of polling intervals when runs complete or polling attempts are exhausted

Key Improvements

  1. Respects window focus and view visibility, optimizing API usage
  2. Workflow runs now update automatically without requiring manual refresh
  3. Proper cleanup prevents memory leaks and unnecessary API calls

Related Issues

Fixes#229

Testing

The fix ensures that:

  • When a new workflow is triggered, it automatically appears and updates in the extension view
  • Re-running workflows shows progress updates in real-time
  • Polling stops when runs complete
  • API calls are minimized when the window is not focused or the view is not visible

CopilotAI review requested due to automatic review settings December 18, 2025 20:54
@spboyer
spboyer requested a review from a team as a code ownerDecember 18, 2025 20:54
@spboyer
spboyer requested review from cschleiden and thyeggman and removed request for CopilotDecember 18, 2025 20:54
@spboyer

Copy link
Copy Markdown
Author

Related #285

CopilotAI review requested due to automatic review settings December 19, 2025 15:45

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements an automatic polling mechanism to update workflow runs in real-time without requiring manual refresh, addressing issue #229. The solution adds intelligent polling that respects window focus and view visibility to minimize unnecessary API calls.

Key changes include:

  • Automatic polling for active workflow runs (in_progress, queued, waiting, requested) with a 4-second interval for up to 15 minutes
  • Window focus and view visibility tracking to pause polling when the extension is not in use
  • Enhanced workflow trigger command that waits for new runs to appear and automatically starts polling them

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
FileDescription
src/treeViews/workflows.tsExports WorkflowsTreeNode type to enable access from other modules
src/treeViews/workflowRunTreeDataProvider.tsAdds automatic polling initiation for active workflow runs when tree nodes are created
src/treeViews/treeViews.tsTracks workflow tree view visibility state and notifies the store
src/store/workflowRun.tsUnconditionally clears job cache on run updates to ensure polling fetches latest job status
src/store/store.tsImplements polling mechanism with focus/visibility checks and cleanup logic for completed runs
src/extension.tsRegisters window state change handler to track focus state
src/commands/triggerWorkflowRun.tsEnhanced to detect newly triggered runs and automatically start polling them

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/store/store.ts
Comment threadsrc/treeViews/workflowRunTreeDataProvider.ts
Comment threadsrc/treeViews/workflowRunTreeDataProvider.ts
Comment threadsrc/commands/triggerWorkflowRun.ts Outdated
Comment threadsrc/commands/triggerWorkflowRun.ts
Comment threadsrc/commands/triggerWorkflowRun.ts
Comment threadsrc/treeViews/treeViews.ts Outdated
Comment threadsrc/commands/triggerWorkflowRun.ts
spboyerand others added 2 commits December 19, 2025 10:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JustinGrote

Copy link
Copy Markdown

FYI Over at https://github.com/justingrote/vscode-github-actions-enhanced I've implemented using the ETag for polling so that it can poll every second and not incur any rate limit decrease, so updates are very responsive.

I've stopped making PRs to this repo as none have ever been accepted and maintaining the fork to keep the PRs clean became too much hassle.

Sign up for freeto 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.

When running a new workflow, you have to manually click refresh and there are not automatic updates.

3 participants

@spboyer@JustinGrote