Skip to content

fix: key the runtime's repo pull on config_updated_on instead of updated_on - #10049

Open
nishantmonu51 wants to merge 2 commits into
mainfrom
nishant/skip-unchanged-deployment-status
Open

nishantmonu51 wants to merge 2 commits into
mainfrom
nishant/skip-unchanged-deployment-status

Conversation

@nishantmonu51

@nishantmonu51 nishantmonu51 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator
  • Since Move resource checks to deployment reconciliation #9653, ValidateDeploymentsWorker reconciles every prod deployment twice an hour, and each reconcile bumps updated_on through UpdateDeploymentStatus.
  • The runtime's configReloader treated updated_on as its "deployment changed" signal, so every hourly reload forced a repo pull and a full re-parse (a controller restart for archive-backed projects), cancelling in-flight model reconciles. Status changes from slot changes and resumes had the same effect.
  • GetDeploymentConfigResponse now has config_updated_on, set from desired_status_updated_on. Every change that must reach the runtime (branch, project, variable and desired-status changes) bumps that column; status writes don't. configReloader compares it instead of updated_on.
  • configReloader only records config_updated_on once the pull, parser trigger and EditInstance succeed, so a failed reload is retried on the next reload.
  • The reconcile job is unchanged and still bumps updated_on. The orphaned prod deployment check in ValidateDeploymentsWorker relies on that to keep non-primary prod deployments alive.
  • TestRuntimeDeployments asserts that a second no-op reconcile doesn't re-parse the project even though the first one bumped updated_on, and that a reconcile after a --prod-slots change leaves the deployment Running.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Developed in collaboration with Claude Code

…ts status unchanged

Since #9653 the ValidateDeploymentsWorker schedules ReconcileDeployment for every prod deployment twice an hour.
For a running deployment the job always called UpdateDeploymentStatus(Running, ""), which sets updated_on = now() even when nothing changed.
The runtime's configReloader uses updated_on as its "deployment changed" signal, so every reload forced a repo pull and a full re-parse of the project (or a controller restart for archive-backed projects), cancelling in-flight reconciles.

The job now re-fetches the deployment and only writes the status when it actually differs.
The re-fetch matters because UpdateDeploymentInner may have moved the status to updating in the DB without updating the job's copy.

Side effect: the orphaned prod deployment teardown in ValidateDeploymentsWorker (updated_on older than 3h) can fire again, as it did before v0.89.

@k-anshul k-anshul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't seem safe on a high level.
A lot of validation/garbage collection in admin depends on updated_on so bumping it on reconcile seems correct.
May be we should revisit the approach commented here :

// to avoid repo handshake refresh on each reload we track last updatedon of each deployment
// if the deployment has not changed skip the repo pull
//
// this can further be optimised to only check for properties that affect repo like url, branch etc but keeping it simple for now
updatedOn map[string]time.Time

…d of `updated_on`

Keeps the reconcile heartbeat; the runtime now keys repo pulls on desired_status_updated_on,
which status writes don't touch, and only records it after a successful reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@k-anshul k-anshul changed the title fix: don't bump a deployment's updated_on when a reconcile leaves its status unchanged fix: key the runtime's repo pull on config_updated_on instead of updated_on Oct 21, 2026

This branch has not been deployed

No deployments
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.

2 participants