feat(BA-5278): Use deploying-revision image for new route session creation#10271
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a bug where new route sessions during rolling updates used the deployment's target revision image instead of the image from the specific revision assigned to each route.
Changes:
- Added
revision_idfield toRouteDataand populated it fromRoutingRow.revisionin both route query methods - Extended
fetch_deployment_context()with an optionalrevision_idparameter to resolve the image from a specific revision's DB row - Passed
revision_idthrough from_provision_route()to ensure each route uses its own revision's image
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
types/endpoint.py |
Added revision_id optional field to RouteData dataclass |
db_source.py |
Populated revision_id in route queries; added revision-specific image resolution logic in fetch_deployment_context() |
repository.py |
Passed revision_id parameter through to db_source.fetch_deployment_context() |
executor.py |
Passed route.revision_id when calling fetch_deployment_context() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
During rolling updates, new route sessions were incorrectly using the target revision image from deployment_info instead of the image associated with the specific revision assigned to each route. This caused new sessions to use the old revision's image when a rolling update was in progress. - Add `revision_id` field to `RouteData` to carry per-route revision info - Populate `revision_id` from `RoutingRow.revision` in both `get_routes_by_endpoint` and `get_routes_by_statuses` in db_source - Add `revision_id` parameter to `fetch_deployment_context` in db_source and repository; when provided, resolve the image from that revision's DB row via `selectinload(DeploymentRevisionRow.image_row)` instead of falling back to `deployment_info.target_revision()` - Pass `revision_id=route.revision_id` when calling `fetch_deployment_context` in `_provision_route` inside the route executor
Verify that _provision_route passes route.revision_id to fetch_deployment_context so the correct revision's image is used for session creation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HyeockJinKim
approved these changes
Mar 19, 2026
Comment on lines
+783
to
+792
| # Build model_revisions list from loaded revision rows | ||
| if "revisions" in instance_state(self).dict and self.revisions: | ||
| model_revisions: list[ModelRevisionSpec] = [] | ||
| for rev_row in self.revisions: | ||
| if rev_row.image_row is None: | ||
| continue | ||
| if rev_row.id == self.current_revision or rev_row.id == self.deploying_revision: | ||
| model_revisions.append(self._build_revision_spec(rev_row)) | ||
| if model_revisions: | ||
| info = self._to_deployment_info_with_revisions(model_revisions) |
Collaborator
There was a problem hiding this comment.
The code for checking the string key doesn't look great, but since it seems to be an existing issue, I'll leave it for now.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
During rolling updates, new route sessions were incorrectly using the target revision image from deployment info rather than the image of the specific revision assigned to each route. This fix ensures that when provisioning a new session for a route, the image is resolved from the route's own revision record.
Changes
revision_id: uuid.UUID | None = Nonefield toRouteDatadataclassrevision_idfromRoutingRow.revisionin bothget_routes_by_endpointandget_routes_by_statusesindb_source.pyrevision_idparameter tofetch_deployment_context()indb_source.py; when provided, queriesDeploymentRevisionRowwithselectinload(image_row)and builds anImageIdentifierfrom it instead of usingdeployment_info.target_revision()revision_idparameter tofetch_deployment_context()inrepository.pyand pass it through todb_sourcerevision_id=route.revision_idwhen callingfetch_deployment_context()in_provision_route()inside the route executorTesting
Related Issues
Fixes BA-5278