Repository navigation
Precompute test-quarantine Part 1 gathering in pre-activation - #67167
Merged
wtgodbe merged 2 commits intoJun 11, 2026
Merged
Conversation
The daily test-quarantine workflow has failed for 9+ consecutive days by tripping the per-run effective-token cap (GH_AW_MAX_EFFECTIVE_TOKENS) while still gathering Part 1 failure data -- it died before creating any PR/issue. Effective tokens are ~10x raw input and every agent turn re-sends the whole conversation, so the in-loop AzDO/Helix gathering (build lists, resultsbyBuild, and multi-MB Helix console logs across ~200 builds) was the dominant cost. Move all Part 1 (Sources A/B/C) gathering into a deterministic "Aggregate Part 1 failures" pre-activation step, which runs outside the firewall at zero effective-token cost, and inject one compact JSON blob (part1_data, ~170 KB, validated against 30 days of real data) into the agent prompt. The agent now makes ZERO AzDO/Helix calls for Part 1 -- it only does judgment and output creation. This mirrors the existing "Verify Source B PRs" pre-activation pattern. Highlights: - Helix job id + work-item name come from the AzDO test-result-detail `comment` field (reliable) instead of fragile build-timeline parsing; individual tests also carry their real errorMessage/stackTrace. - A compact `builds` metadata map (def, startedUtc, finishedUtc, sourceVersion, pr) preserves the Step 1.2 Case B timing and Source B self-PR-exclusion checks without any agent AzDO call. - Source C downloads Helix console logs and extracts only [FAIL] blocks, probing multiple builds until one is found, bounded by a global download budget. - emit() guarantees the output stays under the 1 MB GITHUB_OUTPUT limit by shedding optional enrichment (never the per-test counts) and fails loud rather than letting GitHub silently truncate into corrupt JSON. Part 2 (passing-data + source mapping) is intentionally left in the agent loop and will be addressed separately. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Moves the expensive Part 1 (Sources A/B/C) Azure DevOps + Helix failure gathering out of the agent loop and into a deterministic pre-activation step, injecting a compact JSON blob into the agent prompt to avoid effective-token exhaustion in the daily test-quarantine workflow.
Changes:
- Adds a new pre-activation step (
Aggregate Part 1 failures) that gathers Source A/B failures, enriches with result details/Helix coordinates, and extracts Source C[FAIL]blocks from Helix console logs within bounded size/budget. - Injects the aggregated
part1_datainto the agent prompt and updates Part 1 instructions to require using the injected data (no AzDO/Helix calls in-loop). - Regenerates the gh-aw compiled workflow lock file to wire the new output through prompt rendering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/test-quarantine.md | Adds Part 1 pre-aggregation step + updates agent instructions to consume injected part1_data. |
| .github/workflows/test-quarantine.lock.yml | Regenerated compiled workflow to plumb part1_data output into the agent prompt environment. |
Comment on lines
+507
to
+520
| def helix_console_blocks(job_id, wi_name): | ||
| files, _ = fetch(f"{HELIX}/jobs/{job_id}/workitems/{urllib.parse.quote(wi_name)}/files") | ||
| seq = files if isinstance(files, list) else files.get("Files", files.get("files", [])) | ||
| link = None | ||
| for f in seq: | ||
| nm = f.get("Name") or f.get("name") or "" | ||
| if nm.startswith("console."): | ||
| link = f.get("Link") or f.get("link") | ||
| break | ||
| if not link: | ||
| return None, 0 | ||
| raw, _ = fetch(link, raw=True, timeout=180) | ||
| text = raw.decode("utf-8", "replace") | ||
| return extract_fail_blocks(text), len(text) |
Member
Author
There was a problem hiding this comment.
Good catch — fixed in 2c156cd to return len(raw) (the actual downloaded byte count) instead of len(text), so both the download budget and the reported log_bytes are byte-accurate.
The console-log size returned by helix_console_blocks() feeds the byte-denominated download budget and the reported log_bytes, but it used len(text) (a decoded character count). Use len(raw) so the budget and log_bytes are accurate. Co-authored-by: Copilot <[email protected]>
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.
Problem
The daily
test-quarantineagentic workflow has failed for 9+ consecutive days, each time tripping the per-run effective-token cap (GH_AW_MAX_EFFECTIVE_TOKENS) while still gathering Part 1 failure data — it dies before creating any quarantine PR/issue. Effective tokens are ~10× raw input and every agent turn re-sends the whole conversation, so the in-loop Azure DevOps/Helix gathering (build lists,resultsbyBuild, and multi-MB Helix console logs across ~200 builds) is the dominant cost.Fix
Move all Part 1 (Sources A/B/C) gathering into a deterministic
Aggregate Part 1 failurespre-activation step, which runs outside the firewall at zero effective-token cost, and inject one compact JSON blob (part1_data, ~170 KB, validated against 30 days of real data) into the agent prompt. The agent now makes zero AzDO/Helix calls for Part 1 — it only does judgment + output creation. This mirrors the existingVerify Source B PRspre-activation pattern.Highlights
commentfield instead of fragile build-timeline parsing; individual tests also carry their realerrorMessage/stackTrace.buildsmetadata map (def,startedUtc,finishedUtc,sourceVersion,pr) keeps the Step 1.2 Case B "failure after the unquarantine landed" timing check and the Source B "PR modified its own test" exclusion working without any agent AzDO call.[FAIL]blocks, probing multiple builds until one is found, bounded by a global download budget so a regression spell can't download gigabytes.emit()guarantees the blob stays under the 1 MBGITHUB_OUTPUTlimit by progressively shedding optional enrichment (never the per-test counts) and fails loud rather than letting GitHub silently truncate into corrupt JSON.Part 2 (passing-data + source mapping) is intentionally left in the agent loop and will be addressed separately.