Skip to content

fix: recover ACR log streams after replacement - #9957

Open
Jon Gallant (jongio) wants to merge 1 commit into
Azure:mainfrom
jongio:fix/acr-log-restarts
Open

fix: recover ACR log streams after replacement#9957
Jon Gallant (jongio) wants to merge 1 commit into
Azure:mainfrom
jongio:fix/acr-log-restarts

Conversation

@jongio

Copy link
Copy Markdown
Member

Fixes #9956

Summary

Recover ACR log streaming when a build replaces or truncates its log blob, instead of aborting publishing with HTTP 416 while the remote build continues.

Changes

  • Reset the read cursor when the log shrinks, disappears, or rejects its range.
  • Bind range downloads to the observed ETag and re-poll after HTTP 412/416 within the existing polling limit.
  • Preserve cancellation, normal append behavior, and genuine HTTP and writer failures.
  • Add deterministic Blob SDK transport regressions for these paths.

Validation

go test -race ./pkg/containerregistry -count=1, golangci-lint run ./pkg/containerregistry/..., repeated stream tests, Go modernization checks, and CLI build passed. A private patched CLI completed remote image publishing in a development rollout.

#9939 handles the related fallback policy separately. This PR does not change fallback behavior.

Fixes Azure#9956

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The 412 recovery path can retain a stale cursor and omit the beginning of a replacement log.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity cli/​azd/​pkg/​containerregistry/​remote_build.go — Reset or validate the cursor after a 412 replacement race
What changed in this PR

Improves ACR remote-build log streaming when log blobs are replaced or truncated.

Changes:

  • Resets stale read cursors and retries range conflicts.
  • Adds ETag-bound downloads and regression tests.
File Description
remote_build.go Adds cursor recovery and conditional range downloads.
remote_build_logs_test.go Tests replacement, cancellation, and failure paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +322 to +324
if responseErr.StatusCode == http.StatusRequestedRangeNotSatisfiable {
written = 0
}

@JeffreyCA JeffreyCA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, the Copilot comment seems worth addressing

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.

ACR log replacement aborts successful remote builds with HTTP 416

4 participants