Skip to content

Harden build-failure-analysis Azure DevOps fetch (raise artifact cap, fail closed, timeouts) - #10835

Merged
Amaury Levé (Evangelink) merged 13 commits into
microsoft:mainfrom
YuliiaKovalova:fix-build-failure-analysis-robustness
Aug 28, 2026
Merged

Amaury Levé (Evangelink) merged 13 commits into
microsoft:mainfrom
YuliiaKovalova:fix-build-failure-analysis-robustness

Conversation

@YuliiaKovalova

@YuliiaKovalova YuliiaKovalova commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Robustness fixes to the shared Azure DevOps fetch step, all found while validating the equivalent workflow on dotnet/roslyn#85046 end to end against real failing builds.

1. Raise the per-artifact download cap: 500 MB -> 2 GB (the important one)

MAX_ZIP_BYTES is a download guard, not a size expectation. An artifact that exceeds it is silently dropped from the analysis rather than reported, so a too-tight value hides the exact failure the workflow exists to explain.

On roslyn this fired for real: a 636 MB analyzer-logs artifact tripped the 500 MB cap, and the run completed "successfully" having analysed nothing (run 33161086176). After raising the cap the same build produced a correct root cause and an inline fix suggestion (run 33161255171).

This repo is next in line: the largest artifact this workflow selects (Logs_Build_Windows Release_Release on definition 209) currently measures ~497 MB -- about 0.6% under the cap. It will start silently skipping the Windows Release logs on the next size bump.

The cumulative budgets (MAX_TOTAL_ZIP_BYTES 3 GB compressed, MAX_TOTAL_BYTES 4 GB uncompressed) and MAX_UNZIP_BYTES are unchanged and are what actually bound the runner's disk and network -- so this raises no real resource ceiling.

2. Fail closed on Azure DevOps fetch / non-JSON responses

A failed curl or an HTML error page produced an empty .value/.records, which is indistinguishable from a healthy build -- the step reported "no failed jobs" and the agent stayed inert. A transient ADO outage therefore looked like a green build.

All metadata fetches now go through an ado_get helper that checks the curl exit status and validates the body parses as JSON, reporting a data-resolution failure instead. (It returns a status code rather than calling emit_none directly, because emit_none inside a command substitution would only exit the subshell.) The timeline fetch already had equivalent fail-closed handling and is left as is.

3. Bound Azure DevOps request time, and make the download deadline hard

Retries without timeouts meant a stalled endpoint hung the step until the whole job timed out. Two rounds of review sharpened this considerably:

  • Metadata requests use --connect-timeout 10 --max-time 20 --retry-max-time 40. These are small JSON documents from an endpoint that normally answers in well under a second, and there are three of them before any download begins, so their combined retry windows must not eat into the job on their own.
  • --max-time is per attempt, so --retry 3 alone would have permitted four full transfers plus backoff — roughly 20 minutes against timeout-minutes: 15. The download loop now has a wall-clock deadline (DOWNLOAD_BUDGET=420, MAX_ATTEMPT_SECONDS=120) and every transfer derives both --max-time and --retry-max-time from the time actually left.
  • --retry-max-time only gates whether a new retry may start, so the whole invocation is additionally wrapped in timeout "${TIME_LEFT}". That is what makes the deadline real; without it a retry begun just inside the window could overshoot by a further attempt.

A transfer killed at the deadline is treated like any other failed download: the leg is reported missing and the analysis is disabled rather than run on a partial picture.

5. Enforce the download budgets, and never analyze a stale binlog

  • The compressed-budget and time-budget guards now actually break out of the loop. The step pins set +o posix and then sets ulimit -f, which bash counts in 1024-byte units (POSIX mode would make it 512, hence the pin). The block count is rounded up, so a small remaining allowance still buys at least one block instead of flooring to zero and failing every write. (This is a budget, not a byte-exact ceiling: a transfer can overshoot its cap by under 1 KiB before the size check rejects it.)
  • The binlog directory is cleared immediately after it is created. The extract and upload steps glob the whole directory, so anything left by an earlier run on the same runner would otherwise be attributed to this build.

4. Validate GITHUB_OUTPUT once up front

Previously unchecked; the success path writes six outputs. The guard now proves the path is writable with a zero-byte append, not merely non-empty — a set-but-unwritable path passed the old check and then failed every append, emitting no outputs at all. Both the no-op and success paths fail loudly rather than writing into nothing.

Validation

  • gh aw compile build-failure-analysis build-failure-analysis-command --strict — 2 succeeded, 0 warnings; both .lock.yml files regenerated and committed. The diff contains no uses: changes.
  • shellcheck and bash -n over the fetch script extracted from every generated .lock.yml — clean.
  • A checker parses the generated workflows and asserts the invariants directly, so they cannot silently rot: the worst-case download time fits the job's timeout-minutes; every retrying curl bounds its whole retry window; the download is wrapped in timeout; every budget guard actually leaves the loop; and the binlog directory is cleared. It reproduced a real regression during this work — a bad scripted substitution had replaced a break with a literal None, which both bash -n and shellcheck happily accept.
  • End to end on a fork against real failing Azure DevOps builds, most recently run 33172351332: all seven jobs green, the large log artifact downloaded with no cap or budget warnings, and a correct root cause with an inline fix suggestion.

The same fixes are applied to the sibling copies of this workflow in dotnet/roslyn, dotnet/runtime, dotnet/sdk and dotnet/arcade.

Four robustness fixes found while validating the equivalent workflow on
dotnet/roslyn (dotnet/roslyn#85046) end to end:

- Raise the per-artifact download cap from 500 MB to 2 GB. This cap is a
  download guard, not a size expectation, and an artifact that exceeds it
  is silently dropped rather than reported -- so a too-tight value hides
  the exact failure the workflow exists to explain. On roslyn a 636 MB
  analyzer-logs artifact tripped the 500 MB cap and the run produced no
  analysis at all. This repo's largest log artifact is already ~497 MB,
  so it is about to hit the same wall. The cumulative compressed and
  uncompressed budgets still bound the runner's disk and network.
- Fail closed when an Azure DevOps metadata request fails or returns a
  non-JSON body. Previously a transient outage produced an empty
  '.value'/'.records' and was reported as "no failed jobs", which is
  indistinguishable from a healthy build. Routed through a new ado_get
  helper that checks the curl exit status and validates the payload.
- Bound Azure DevOps request time (--connect-timeout 15 --max-time 60 on
  metadata, --connect-timeout 15 on the artifact download); previously a
  stalled endpoint hung the step until the whole job timed out.
- Validate GITHUB_OUTPUT once up front, so both the no-op path and the
  success path fail loudly instead of writing outputs into nothing.

Co-authored-by: Copilot <[email protected]>

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.

Pull request overview

Hardens the shared Azure DevOps binlog-fetching workflow against failed requests, oversized artifacts, and missing output configuration.

Changes:

  • Adds validated, time-bounded Azure DevOps metadata requests.
  • Raises the artifact download cap from 500 MB to 2 GB.
  • Regenerates both strict-mode workflow lock files.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/shared/build-failure-analysis-fetch.md Implements fetch validation, timeouts, and revised limits.
.github/workflows/build-failure-analysis.lock.yml Regenerates the automatic workflow.
.github/workflows/build-failure-analysis-command.lock.yml Regenerates the command workflow.

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

Addresses review feedback on this PR:

- `--max-time 1200` exceeded this job's own `timeout-minutes: 15`, so a
  transfer that stalled after connecting would consume the whole job and be
  killed before the script could emit its controlled no-op -- the exact
  failure mode the timeouts were added to prevent. Restored a 5-minute
  per-artifact budget, which is still very generous: the full artifact set
  for the equivalent roslyn build downloads in ~30 seconds.

- The cumulative compressed budget was only checked after a transfer
  finished, so a download could start just below MAX_TOTAL_ZIP_BYTES and
  still pull a further MAX_ZIP_BYTES, making the real ceiling
  MAX_TOTAL_ZIP_BYTES + MAX_ZIP_BYTES. Each transfer is now bounded by
  min(MAX_ZIP_BYTES, remaining budget) before it starts.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 28, 2026 10:47

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (3)

Previously missed (1) — in code that hasn't changed since the last review.

.github/workflows/shared/build-failure-analysis-fetch.md:193

  • --max-time applies to each curl attempt and resets for retries. With --retry 3, this metadata request can therefore run for roughly four minutes (plus retry delays), rather than the documented 60-second request budget. Apply an outer deadline to the whole operation, then recompile both importing workflows.

This issue also appears in the following locations of the same file:

  • line 493
  • line 602
            ADO_DOC=$(curl -sSL --fail --retry 3 --connect-timeout 15 --max-time 60 "${url}")

.github/workflows/shared/build-failure-analysis-fetch.md:493

  • This timeout is also reset for every retry, so the timeline request can consume about four minutes instead of 60 seconds. Bound the complete retry operation, not only each attempt, then regenerate both lock files.
          timeline_json=$(curl -sSL --retry 3 --connect-timeout 15 --max-time 60 "${ADO_API}/build/builds/${BUILD_ID}/timeline?api-version=7.1" 2>/dev/null || true)

.github/workflows/shared/build-failure-analysis-fetch.md:602

  • Because curl resets --max-time for each retry, one stalled artifact can take about 20 minutes with --retry 3, exceeding this job's 15-minute timeout and preventing the controlled no-op described above. Wrap the complete curl operation in a five-minute outer deadline and regenerate both lock files.
            curl -sSL --retry 3 --connect-timeout 15 --max-time 300 "${url}" 2>/dev/null | head -c $((ZIP_CAP + 1)) > /tmp/a.zip || true

Two review findings that turned out to apply to every repo carrying this
workflow rather than only where they were reported.

The GITHUB_OUTPUT guard only checked that the variable was non-empty. A set
but unwritable path still passed and then failed on every append, so the step
produced no outputs at all instead of the intended controlled no-op. The guard
now probes the path with a zero-byte append, which verifies writability
without adding content.

The cumulative compressed budget rejected only a non-positive remaining
allowance. A positive remainder below 512 bytes still started a transfer, but
ulimit -f counts 512-byte blocks, so the file limit floored to 0 and every
write failed - the artifact was guaranteed to be discarded after paying for
the request. A new MIN_ZIP_BYTES (1 MB) floor treats such a remainder as
exhausted, which also makes a zero-block ulimit unreachable by construction.

Validated in the roslyn reference implementation by test-fetch-guards.sh
(13/13) and by fork E2E run 33167910190, whose fetch job downloaded the full
artifact set with no cap or budget warnings.

Co-authored-by: Copilot <[email protected]>
@YuliiaKovalova

Copy link
Copy Markdown
Contributor Author

Follow-up in 8ef4a9056: two further defects found while reviewing the sibling
backports apply here too, so they're fixed in this PR as well.

  1. The GITHUB_OUTPUT guard only checked the variable was non-empty; a
    set-but-unwritable path passed it and then failed on every append, leaving
    the step with no outputs instead of the intended controlled no-op. It now
    probes the path with a zero-byte append.
  2. The cumulative compressed budget rejected only a non-positive remaining
    allowance, so a tiny positive remainder still started a transfer that could
    never yield a usable archive. A new MIN_ZIP_BYTES (1 MB) floor treats such
    a remainder as exhausted.

Validated in the reference implementation by a new test-fetch-guards.sh
(13/13) and by fork E2E run
33167910190,
which is green end to end and downloaded the full artifact set with no cap or
budget warnings.

Note

This comment was generated with GitHub Copilot.

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@Evangelink Amaury Levé (Evangelink) 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.

Requesting changes for the unresolved retry deadline: --max-time resets for every retry, so the current settings can still exceed the 15-minute job timeout and prevent the intended controlled no-op. Please also address the existing comment on MIN_ZIP_BYTES, which can stop before downloading a valid archive that fits the remaining budget.

The fail-closed metadata validation, cumulative byte cap, and regenerated lock files otherwise look sound.

`--max-time` applies per attempt, so `--retry 3` permitted four full
transfers plus backoff and could outlive the job's `timeout-minutes`.
Give the download loop a wall-clock deadline (DOWNLOAD_BUDGET=420s),
cap each attempt at 120s, and derive both `--max-time` and
`--retry-max-time` from the time actually left. Bound the metadata
calls the same way. Worst case is now 720s against a 1800s job timeout.

Also revert the 1 MB MIN_ZIP_BYTES floor: it dropped legs whose archive
was legitimately smaller than the floor. Round the `ulimit -f` block
count up instead, which guarantees at least one block for any positive
cap without rejecting small artifacts.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 28, 2026 12:37
@microsoft-github-policy-service microsoft-github-policy-service Bot added needs/attention Needs maintainer attention. and removed needs/author-feedback Waiting on the original author. labels Aug 28, 2026
The extract loop globs the whole directory, so any *.binlog left behind by
an earlier run on the same runner would be uploaded and analyzed as if it
belonged to this build. Remove pre-existing binlogs right after the
directory is created, before anything is written into it.

Also correct a test header that still described the reverted MIN_ZIP_BYTES
clamp instead of the guards actually in the script.

Co-authored-by: Copilot <[email protected]>

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

`--retry-max-time` only decides whether curl may start another retry; a
retry begun just inside it still runs a further `--max-time`, so a
transfer could overshoot DOWNLOAD_DEADLINE by up to MAX_ATTEMPT_SECONDS
and the advertised wall-clock budget was not actually enforced. Wrap the
whole invocation in `timeout "${TIME_LEFT}"`, keeping the curl limits, so
the phase really is bounded by DOWNLOAD_BUDGET. A killed transfer is
treated like any other failed one: the leg is reported missing and the
analysis is disabled, which fails closed.

Also state plainly that the compressed budget is a budget rather than a
byte-exact ceiling: `ulimit -f` rounds up to 512-byte blocks, so a
transfer can overshoot its cap by under 512 bytes before the size check
rejects it, bounded overall by MAX_ARTIFACTS.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 28, 2026 12:55

@Evangelink Amaury Levé (Evangelink) 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.

The prior timeout, cumulative-byte, and sub-1 MB budget blockers are fixed, and the generated locks match the shared source.

One blocking robustness issue remains on the artifact download: retry attempts share the same output stream, so a transient HTTP error body can be prepended to the eventual ZIP. The resulting unzip warning is treated as extraction failure, making one recoverable response suppress the entire analysis. Please isolate retry output as noted inline before approval.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs/author-feedback Waiting on the original author. label Aug 28, 2026

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

.github/workflows/shared/build-failure-analysis-fetch.md:500

  • This retrying timeline request has the same non-rewindable stdout problem: bytes from a partial failed attempt remain in the command substitution and are followed by the successful retry's JSON. The combined document then fails validation, incorrectly reporting timeline completeness as unknown. Store the response in a regular file so retries replace partial output.
          timeline_json=$(curl -sSL --retry 3 --connect-timeout 10 --max-time 20 --retry-max-time 40 "${ADO_API}/build/builds/${BUILD_ID}/timeline?api-version=7.1" 2>/dev/null || true)

.github/workflows/shared/build-failure-analysis-fetch.md:628

  • Piping a retrying curl to head preserves bytes emitted by failed attempts. A mid-transfer timeout followed by a successful retry therefore produces partial ZIP + full ZIP, which unzip rejects and causes the otherwise recoverable leg—and then the entire analysis—to be skipped. Use a retry-aware temporary-file/attempt loop that resets the destination for each attempt while still charging every attempt's transferred bytes against TOTAL_ZIP_BYTES and honoring the shared deadline/cap.
            timeout "${TIME_LEFT}" curl -sSL --retry 3 --connect-timeout 15 --max-time "${ATTEMPT_SECONDS}" --retry-max-time "${TIME_LEFT}" "${url}" 2>/dev/null | head -c $((ZIP_CAP + 1)) > /tmp/a.zip || true

`curl --retry` can only rewind seekable output. Through a pipe or a
command substitution a retry appends to whatever the failed attempt
already wrote, so a *successful* retry produces a corrupt two-response
payload:

- The artifact download streamed through `head -c` into the zip. A 503
  error page followed by a successful retry yielded `<error page><zip>`,
  which could still pass the size and path guards and then make `unzip`
  return warning status 1 -- read as failure, leaving staged_legs short
  and suppressing the whole analysis. It now downloads with `-o` to a
  freshly removed file, behind `--fail` so HTTP error bodies never reach
  it and `ulimit -f` as the disk backstop.
- `ado_get` and the completeness-check timeline fetch captured curl in a
  command substitution. A partial body plus a successful retry parsed as
  neither document, so a recoverable blip was reported as a
  data-resolution failure. Both write to a file that curl truncates
  before each attempt.

Tests assert the invariant rather than the text: no retrying curl may be
piped or captured, every one writes to a file, and every one uses
`--fail`.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 28, 2026 14:33
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the needs/author-feedback Waiting on the original author. label Aug 28, 2026

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Suppressed comments (1)

.github/workflows/shared/build-failure-analysis-fetch.md:666

  • stat measures only the final output file, not all bytes transferred. Because curl truncates/rewinds -o /tmp/a.zip before each retry, a failed attempt can consume nearly ZIP_CAP bytes and then disappear from this accounting; up to four attempts can therefore exceed the advertised 3 GB cumulative network budget. Enforce the remaining allowance across attempts (for example with an explicit retry loop that charges each attempt) and regenerate both lock files.
            ZIP_BYTES=$(stat -c%s /tmp/a.zip 2>/dev/null || echo 0)
            # Charge the budget with the bytes that actually crossed the wire,
            # including those of an artifact that is about to be skipped.
            TOTAL_ZIP_BYTES=$((TOTAL_ZIP_BYTES + ZIP_BYTES))

The Azure DevOps response and the artifact archive were written to fixed
paths under /tmp. On a runner that is not exclusively ours -- self-hosted,
or simply running two of these jobs at once -- a pre-existing file or
symlink at a known path decides where curl writes and what gets read back
into ADO_DOC. Both now come from `mktemp`.

The download reuses one scratch file across artifacts and truncates it per
iteration rather than removing and recreating it, so the private file we
were handed stays the one we write to.

BINLOG_DIR keeps its fixed path deliberately: it is an interface, set by
the workflow and read by the upload step, and it is created and cleared
rather than written through.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 28, 2026 14:46

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

- `ulimit -f` was allowed to fail silently. A shell that refuses to apply
  the limit left responses with no usable Content-Length free to fill the
  disk before the post-download size check ran. It now exits the subshell,
  so the leg fails and the completeness check reports it.
- testfx/sdk discarded the transfer exit status, so a timed-out or
  size-limited curl was accepted whenever the partial file happened to
  parse as a ZIP -- including a file left exactly at the cap, which the
  `-gt` check does not reject. The status is captured and the leg skipped.
- `{"records": null}` satisfied `has("records")` and marked the timeline
  readable; the extraction then yielded an empty missing-legs value that
  looked like verified completeness. Requires an actual array.
- The extraction directory was a fixed /tmp path, so the mktemp reasoning
  applied to it too. It is `mktemp -d`, cleaned per artifact and released
  after the loop.

Also corrects a guard comment that still described the `head -c` pipe the
download no longer uses.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 28, 2026 15:01
The counter is charged from the file left on disk, but the comment claimed
it recorded "the bytes that actually crossed the wire". Since `-o`
truncates before each retry, failed attempts are not counted, so the
comment overstated what the number means to anyone auditing the caps.

It is a disk and extraction budget. Network transfer is bounded by
DOWNLOAD_DEADLINE through the `timeout` wrapper, and every individual
attempt is capped at ZIP_CAP by `ulimit -f`.

Co-authored-by: Copilot <[email protected]>

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

.github/workflows/shared/build-failure-analysis-fetch.md:683

  • ZIP_BYTES is only the final attempt's file size because curl --retry -o rewinds/truncates the file between attempts. A transfer can therefore receive almost ZIP_CAP on each failed attempt and charge only the last attempt at line 683; with three retries the nominal 3 GB cumulative network budget can be exceeded severalfold. Enforce retries in an outer loop that charges each attempt before truncating/retrying (or remove internal retries), and derive every subsequent attempt's cap from the newly remaining allowance.
            # Charge the budget with the bytes retained on disk, including those of an
            # artifact about to be skipped. This is a disk and extraction budget, not a
            # meter of network egress: `-o` truncates before each retry, so failed

Copilot AI review requested due to automatic review settings August 28, 2026 15:13
Two ways the download guards were weaker than advertised.

bash's `ulimit -f` counts in 1024-byte units, not the POSIX 512-byte
block. Computing blocks as `(ZIP_CAP + 511) / 512` therefore asked for
twice the intended limit, so a single scratch file could reach nearly
4 GB against a 2 GB ZIP_CAP -- past the 3 GB cumulative cap on its own.
The post-download size check still rejected the file, but the backstop
that exists for responses with no usable Content-Length was not enforcing
what it claimed.

The wall-clock deadline bounded transfers only. Extraction is separately
bounded per artifact, so a run that spent most of its budget downloading
could still queue one extraction per remaining artifact and walk past
`timeout-minutes` without reaching the controlled no-op. Extraction now
reads the same deadline, stops when it is gone, and clamps its own
timeout to what is left. DOWNLOAD_DEADLINE is renamed FETCH_DEADLINE
because it now bounds the whole phase.

Co-authored-by: Copilot <[email protected]>

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

bash counts `ulimit -f` in 1024-byte units, but in POSIX mode it counts
512-byte blocks -- so the same arithmetic means two different caps
depending on how the runner's shell was invoked. Under POSIX mode the
1024-based value would halve the limit and truncate downloads that fit,
which drops a leg and suppresses the analysis. `set +o posix` pins it.

Artifact names come from Azure DevOps metadata and are echoed straight
into `::warning::`, where a crafted name could forge workflow commands in
the log. A sanitized copy already existed for this reason; these call
sites were still using the raw value.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 28, 2026 15:31

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

.github/workflows/shared/build-failure-analysis-fetch.md:592

  • FETCH_DEADLINE is not a hard bound for the fetch phase because several operations on the PR-controlled archive run outside timeout: unzip -l (line 704), unzip -Z1 (line 731), and the find/copy staging loop (lines 770-787). A ≤2 GB ZIP with a very large central directory or file count can therefore consume the remaining job time before the next deadline check and prevent the controlled emit_none path. Apply the remaining deadline to all archive inspection/staging work (and preferably cap entry/binlog counts) so the phase is actually bounded.
          FETCH_DEADLINE=$(( $(date +%s) + FETCH_BUDGET ))

.github/workflows/shared/build-failure-analysis-fetch.md:677

  • The PR description still says ulimit -f uses 512-byte blocks and can overshoot by less than 512 bytes, but this implementation explicitly selects Bash's non-POSIX 1024-byte units, so the rounding slack is less than 1024 bytes. Update the description to match the corrected implementation and validation claim.
              # bash counts `ulimit -f` in 1024-byte units, except in POSIX mode where
              # it counts 512-byte blocks. Pin the mode so this arithmetic means one
              # thing regardless of how the runner's shell was invoked.
              set +o posix
              ulimit -f $(( (ZIP_CAP + 1023) / 1024 )) || exit 1

@microsoft-github-policy-service microsoft-github-policy-service Bot removed the needs/attention Needs maintainer attention. label Aug 28, 2026

@Evangelink Amaury Levé (Evangelink) 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.

Re-reviewed the latest revision. The retry-output corruption, cumulative caps, hard fetch/extraction deadline, ulimit units and shell mode, transfer-status handling, timeline validation, scratch-path isolation, and artifact-name sanitization now fail closed as intended. Both generated lock files match the shared source. No blocking findings remain.

@Evangelink
Amaury Levé (Evangelink) merged commit e24c124 into microsoft:main Aug 28, 2026
33 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.

3 participants