Skip to content

fix: keep the pull request comment in sync when a config change skips redeploy - #241

Merged
vigneshrajsb merged 6 commits into
mainfrom
fix/mission-control-comment-refresh-without-redeploy
Aug 28, 2026
Merged

fix: keep the pull request comment in sync when a config change skips redeploy#241
vigneshrajsb merged 6 commits into
mainfrom
fix/mission-control-comment-refresh-without-redeploy

Conversation

@vigneshrajsb

@vigneshrajsb vigneshrajsb commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

Two changes to how environment config updates behave.

The pull request comment could go stale. The comment is rebuilt from the database, but that only happened when a build or deploy changed status. A config change on an environment with deploys paused updated the database and queued nothing, so the comment kept showing the old selections. Editing that stale comment then reapplied the old state and silently undid the change. The comment is now refreshed whenever a config change is applied without queueing a redeploy.

The patch response did not say whether a redeploy started. PATCH /api/v2/environments/{uuid} already knew, but threw the answer away, so clients had to guess from deployEnabled. That guess is wrong when the server drops the submitted overrides as no-ops. The response now carries redeployQueued and, when one started, deployId.

Notes

The comment refresh is queued rather than rendered inline, and it runs after the build deployment lock is released. It takes its own lock on the same build, so holding both would let a slow comment update block other operations on that build. Any failure in it is caught and logged, so it cannot fail the config request.

redeployQueued and deployId are added as new schema components used only by the patch operation. The shared environment detail schema and the GET response are unchanged.

Testing

Unit tests cover both outcomes for each change. Verified on a live environment: a config change with deploys paused returned redeployQueued: false and the comment refreshed within about 15 seconds, and a no-op patch returned redeployQueued: false while deployEnabled was still true.

Config changes applied through the API or UI on an environment with
deploys disabled never queued a redeploy, so the GitHub Mission
Control comment was never regenerated. The comment kept showing the
old state, and the next manual edit to it silently reverted the
change.

Force a comment refresh whenever a change is persisted but no
redeploy gets queued, in both entry paths: BuildService's API patch
flow, and OverrideService's direct config/service override calls used
by the legacy build patch routes. Both paths check the same
queue-vs-no-queue outcome so a single request never enqueues two
comment jobs.
PATCH /api/v2/environments/{uuid} discarded the result of applying the
patch, so a client could not tell whether its request actually queued
a redeploy. This mattered when submitted service overrides matched
the current state and were dropped as no-ops.

The response now adds redeployQueued (boolean) and, when true,
deployId, alongside the existing environment detail fields. GET keeps
its original response shape.
@vigneshrajsb
vigneshrajsb requested a review from a team as a code owner August 28, 2026 21:42
The refresh takes its own lock on the same build, so running it while the
deployment lock was still held meant a slow comment update could block every
other operation on that build. It now runs after the lock is released.

Also widen the error handling to cover the whole refresh, not just the request.
Hoisting the result out of the lock callback widened mode to string, which no
longer matched the declared result type and broke the build.
@vigneshrajsb
vigneshrajsb force-pushed the fix/mission-control-comment-refresh-without-redeploy branch from d75ac37 to 61fe8cc Compare August 28, 2026 22:43
The two write paths decide when to refresh at different levels, so both call
sites stay, but the body now lives once alongside the other comment helpers.
@vigneshrajsb
vigneshrajsb force-pushed the fix/mission-control-comment-refresh-without-redeploy branch from 61fe8cc to 9eba144 Compare August 28, 2026 22:44
@vigneshrajsb
vigneshrajsb merged commit 0bf9316 into main Aug 28, 2026
5 checks passed
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.

1 participant