Repository navigation
Description
Summary
The canvas stops watching a deploy workflow after about 20 minutes and reports failed (run-unconfirmed): Timed out waiting for the deploy workflow to complete, while the workflow is still running and later succeeds. A slow cloud resource, such as an RDS instance, fails a real deploy in the canvas.
Area
Core packages (core, adapter-shared, adapter-canvas)
Steps to reproduce
- Deploy an AWS application with two RDS MySQL instances from the canvas.
- Wait while the deploy workflow creates the second instance.
- See the canvas report the deploy as failed about 20 minutes after it started.
- Delete the app from the Deployments page and watch the GitHub rate limit while the delete runs.
Expected behavior
The canvas keeps watching a deploy or delete for as long as the workflow can reasonably run, then reports the real outcome, without using up the user's GitHub API quota.
Actual behavior
The deploy monitor gives up after 240 polls 5 seconds apart (DEPLOYMENT_MONITOR_LIMITS.runPollAttempts in packages/core/src/deployment-policy.ts) and marks the attempt run-unconfirmed. The deploy workflows set no timeout-minutes, so a run can go well past 20 minutes. A deploy with one RDS instance took about 18 minutes end to end, so there is little headroom. The same limit applies to Azure deploys.
Polling every 5 seconds also reads the run and its jobs about 24 times a minute on the user's token, which adds up against GitHub's 5,000 requests an hour.
The Deployments page makes it much worse. While a deploy is in flight, every 2.5 second status tick asks for a fresh deployments listing (/api/list-deployments?fresh=1) and aborts the previous one. A fresh listing takes longer than a tick, so no answer ever reaches the page: it never sees the real deployment row and never stops, and the server keeps running each aborted lookup. During a 23-minute AWS deploy, the page made 324 fresh listings of 23 GitHub requests each (2 environments), and the user's token hit 5,000 of 5,000 about 30 minutes into the run. The page also gives up on its own after about 30 minutes.
App deletes have the same problem. While an app delete runs, every 4 second check on the Deployments page fetches a fresh listing and then loads the same listing again to repaint the table: about 234 GitHub requests a minute in a real AWS run. The check gives up after about 3 minutes, so a longer delete (for example one removing an RDS database) never shows its success message, and it keeps polling after the delete has failed instead of reporting the failure.
Logs, screenshots, or stack traces
failed (run-unconfirmed): Timed out waiting for the deploy workflow to complete. It may still be runningVersion and environment
Version: main at ef304d3
Cloud provider: AWS (Azure uses the same monitor)
Activity
[-]Canvas stops watching a deploy after about 20 minutes while the workflow is still running[/-][+]Long deploys fail in the canvas and use up the GitHub API quota[/+]Stop the Deployments page from flooding GitHub during a delete
End a stalled app delete at its time limit
Describe the app delete fix in the release note
Test that the delete time limit cancels a queued check
[-]Long deploys fail in the canvas and use up the GitHub API quota[/-][+]Long deploys and deletes fail in the canvas and use up the GitHub API quota[/+]Guard the delete poll against a diagnostic-only listing
Keep refreshing a deploy past a diagnostic-only listing
Keep the listed environments in step with cleanup details
Make the deploy and listing fakes honor the real reads' filters
Correct the app delete time limit comment
Keep polling while the server reports the deploy running
Test the forced delete redirect when the run is not resolved