-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(webapp): keep paused environments paused when concurrency limits are pushed #4624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+175
−10
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
.server-changes/paused-environment-stays-paused-after-deploy.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: fix | ||
| --- | ||
|
|
||
| Fix paused environments starting to run work again after a deploy: a paused environment now stays paused until you resume it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 An environment that was just resumed can be silently stopped from picking up work
The concurrency limit written into the queue is now forced to zero whenever the caller's copy of the environment says it is paused (
environment.paused ? 0 : ...atapps/webapp/app/v3/runQueue.server.ts:11-12), and that copy is read earlier in the request (and from a read replica), so a deploy that started just before a resume can overwrite the restored limit with zero and leave a running environment unable to start any work.Impact: An environment can appear active in the dashboard yet process nothing until someone pauses and resumes it again, or another concurrency update happens.
How a stale paused flag turns into a permanent zero limit
Deploy/worker-creation callers pass the environment object obtained at authentication time:
finalizeDeployment.server.ts:126usesauthenticatedEnv,createBackgroundWorker.server.ts:241usesenvironment. Those objects come fromfindEnvironmentByApiKey, which reads via$replica(apps/webapp/app/models/runtimeEnvironment.server.ts:275-289), sopausedcan be stale both because of replica lag and because the row can change during the request.Sequence: (1) deploy request authenticates while the env is paused →
paused: truecaptured; (2) user resumes →PauseEnvironmentServicewritespaused: falseand pushes the real limit (apps/webapp/app/v3/services/pauseEnvironment.server.ts:123); (3) the in-flight deploy reachesupdateEnvConcurrencyLimits(authenticatedEnv)and the new clamp writes0. Nothing re-pushes the env limit afterwards, and dequeueing is gated only on that Redis value (internal-packages/run-engine/src/run-queue/index.ts:467-473), so the env stalls withpaused: falsein the database.Before this change an argument-less push always wrote the stored limit, so this failure mode did not exist.
Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.