You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add an opt-in indexed TRX projection for agents - #12671
↑ Earlier Release pack and packaged consumer cases passed, with a name-association mutation detected. ↑ Benchmark telemetry regression failed before the fix and passed afterward. ↓ Shipping tests were run on an earlier revision; in-flight cancellation, multi-module selection and shipped-projection token savings remain unverified.
Pull request
Summary
Add the opt-in agent-trx tool to project one selected TRX into a self-contained JSONL failure index with bounded excerpts and seekable, chunked diagnostic details. Default test output and exit behavior remain unchanged. Relates to #8827.
Design and decision record
Research, experiments, tradeoffs, and validation. The measured #7 + #10 prototype saved 11.1% versus #10 in a small source-free sample, but used a different artifact format and excerpt limit; savings for this implementation are not established. The benchmark sources are included for reproducibility.
Demonstration
Run Tests.exe agent-trx --input-trx report.trx --output-jsonl index.jsonl on a test application with the TRX extension registered. In a real packed net11.0 consumer, a captured six-result report produced three failure records, a 2,915-byte initial index and a 66,914-byte JSONL file; the source TRX was 66,259 bytes. Its header reported "reportOutcome": "Failed", "resultCount": 6, "failureCount": 3 and "detailsOffset": "00000000000000002915". JSONL is the intended nonvisual consumer surface, so a text transcript is more useful than a screenshot. TRX may already have truncated diagnostics; retain the original process exit and terminal log, and select each module's final report.
Validation and regression proof
On Windows, source based on 9892cae32dedef87f95cf16a8472274bcb67b231 with the implementation and tests included in this PR:
.\.dotnet\dotnet.exe test --project test\IntegrationTests\MSTest.Acceptance.IntegrationTests\MSTest.Acceptance.IntegrationTests.csproj -c Release --no-build --filter 'FullyQualifiedName~AgentTrxProjectionAcceptanceTests' -p:UsingDotNetTest=true -p:ArtifactsTestResultsDir=artifacts\TestResults\Release\agent-trx-acceptance --show-test-results all — exit 0; three passed, none skipped. These cover distinct failed rows and associated seekable details, a passing report, and missing/existing paths in a real packed consumer. Package and loaded DLL hashes matched; see the decision record for versions and provenance.
All-extension help and info cases passed on net462, net10.0 and net11.0. Benchmark self-tests passed, including grader, reliability, comparison and default-harness checks.
In-flight cancellation and independent multi-module selection were not exercised. No change to SDK terminal rendering is claimed; servicing and downstream rollout remain separate decisions.
Test-value evidence
For this PR's implementation, an isolated, buildable mutation replaced the indexed failure name with an empty string. Each state was repacked using .\build.cmd -pack -c Release -bl '/p:RestoreFallbackFolders=Q:\.tools\.nuget\packages' with a separate NuGet cache. The same packed acceptance selection (--filter 'FullyQualifiedName~AgentTrx_FailingRowsPreserveIdentityExcerptsAndSeekableDetails', otherwise the command above) passed 1/1, failed 1/1 at the expected row-alpha/row-beta versus empty-name assertion (exit 2), and passed 1/1 after restoration. Each consumer DLL matched its own package asset. This proves sensitivity to lost name association, not every possible defect; exact hashes and command variants are in the decision record.
Compared merge base 9892cae32dedef87f95cf16a8472274bcb67b231 with head f202e303ce3eaf2ce58f7b9e547b77b85041691b. Evidence applies to this head, not every intermediate commit.
Test-value evidence
Static analysis only; no tests were executed here.
Contract
Test / decisive assertion
Counterfactual
Status
Distinct rows with the same testId keep their own name, outcome, excerpt and byte-range details
AgentTrxToolTests.Index_PreservesDistinctRowsAndByteRangesWithUnicode and AgentTrx_FailingRowsPreserveIdentityExcerptsAndSeekableDetails assert per-row name/outcome/excerpt and contiguous detail ranges
Merging rows by testId or empty names would fail the name/executionId assertions
Static prediction: likely detected
512-byte UTF-8-safe excerpt and omittedBytes
Exact GetUtf8Prefix comparison plus omittedBytes assertions
Splitting a surrogate pair or miscounting bytes fails the equality assertions
Static prediction: likely detected
Details chunked below 12 KB and seekable
ReadDetail and the 12,000-byte window loop reassemble the XML and compare it with the original Output
Unchunked or misaligned records fail the part/last/size assertions
Static prediction: likely detected
Zero failures and completeness: unknown
Index_ZeroFailuresDoesNotClaimCompleteExecution and AgentTrx_PassingReportProducesHeaderWithoutFailures
Claiming completeness fails the header assertion
Static prediction: likely detected
Invalid input is atomic, with no output or tmp files
Six-case Index_InvalidInputDoesNotPublishOrLeaveTemporaryFiles plus Index_ExistingOutputAndCanceledRunDoNotReplaceFiles and AgentTrx_InvalidPathsDoNotCreateOrOverwriteOutput
Writing the output before validation fails the existence and tmp-file assertions
Static prediction: likely detected
Help/info for the registered tool
HelpInfoAllExtensionsTests wildcard expectation
Option or description drift fails the match
Static prediction: not executed here
Benchmark tooling, docs, resx/xlf
—
—
Not applicable: not product behavior, and no tests are claimed
The PR body reports a packed name-association mutation that was detected, along with 11 unit and 3 acceptance tests passing. I did not verify those records against this head, so they are not counted as executed proof here. In-flight cancellation and multi-module selection remain unexercised, as the PR itself notes.
Pseudo-mutation evidence below consists of static predictions, not executed mutation results.
Result
Quality
Test
Notes
Follow-up
Pass
A (90–100)
new AgentTrxProjectionAcceptanceTests.AgentTrx_FailingRowsPreserveIdentityExcerptsAndSeekableDetails
Real packed host; checks identity, excerpts, ranges and complete XML per row.
None.
Pass
A (90–100)
new AgentTrxToolTests.Index_PreservesDistinctRowsAndByteRangesWithUnicode
Row names, outcomes, excerpts and exact byte ranges are all asserted.
None.
Pass
B (80–89)
new AgentTrxProjectionAcceptanceTests.AgentTrx_InvalidPathsDoNotCreateOrOverwriteOutput
Both exit codes and unchanged files are asserted.
No change justified: the error text is not part of the claimed contract.
Pass
B (80–89)
new AgentTrxProjectionAcceptanceTests.AgentTrx_PassingReportProducesHeaderWithoutFailures
The header, with its single record, is asserted field by field.
No change justified.
Pass
B (80–89)
new AgentTrxToolTests.CommandLine_ValidatesInputAndOutputWithoutCreatingFiles
Validation results and the absence of the output file are asserted.
No change justified: IsValid is the contract; message text is out of scope.
Pass
B (80–89)
new AgentTrxToolTests.Index_EmptyTestNamePreservesOtherFailures
Both names are asserted, covering the empty-name edge case.
No change justified.
Pass
B (80–89)
new AgentTrxToolTests.Index_ExistingOutputAndCanceledRunDoNotReplaceFiles
Cancellation, exit 1, and unchanged output and input are asserted.
No change justified.
Pass
B (80–89)
new AgentTrxToolTests.Index_InvalidInputDoesNotPublishOrLeaveTemporaryFiles
Six data cases assert the exit code, the error and the lack of output or tmp files.
No change justified: the kind string branching is readable at this size.
Pass
B (80–89)
new AgentTrxToolTests.Index_ZeroFailuresDoesNotClaimCompleteExecution
Header counts, completeness and detailsOffset are asserted.
No change justified.
Pass
B (80–89)
mod HelpInfoAllExtensionsTests expectation block
A wildcard expectation for registered tools; it is a method-level expectation, not a new method.
No change justified: version and description text are intentionally wildcarded or exact as already used.
No inline comments were published: no supported improvement or unresolved doubt passed the publication gate. Existing-thread lookup returned no prior reviews.
<sub>This advisory review is heuristic and non-blocking.
Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>
🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto (Claude Sonnet 5.5) · ~59 AIC · ⌖ ~2 AIC · ⊞ 8.5K
The reason will be displayed to describe this comment to others. Learn more.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Scope: I read the shipping code in full: AgentTrxTool.cs, the TrxReportExtensions.cs registration, the JsonStringWriter additions, the internal API files, and the acceptance tests. I only skimmed the .xlf and benchmark files. I did not build or run anything.
Main finding (scope discipline, non-blocking): The shipping change is about 410 lines of AgentTrxTool.cs plus the tests. It sits in a PR of 72 files and about 6,200 added lines. Roughly 50 of those files are the eng/agent-output-benchmark/** harness: Node scripts and PowerShell, with their own self-tests, graders and capture pipelines. The PR description says the savings of this implementation are not established. A reviewer therefore cannot confirm that the shipped tool delivers its motivating benefit, because the harness that would show it is not tied to the shipped output.
Please split the benchmark harness and docs/decisions/agent-output-experiments.md into a separate PR, or a follow-up tracked by an issue.
That leaves this PR as the tool, its tests and its docs, and makes it much easier to review.
If the harness stays in, it needs an owner, CI coverage, and a statement of how it is kept in sync with the shipped JSONL format.
Secondary observations (no change required, worth a look):
Tool registration:AddTrxReportProvider now registers the agent-trx tool and its --input-trx and --output-jsonl options for every consumer of the TRX extension. The PR notes that default test output and exit behavior are unchanged, and the help and info acceptance expectations are updated. Please confirm the new options do not collide with the existing --report-trx* and trx-merge option names in the all-extensions case. The HelpInfoAllExtensionsTests change suggests this is covered.
Error messages: Parsing failures throw InvalidDataException with hard-coded English text, for example "Unsupported TRX outcome". AgentTrxToolProjectionFailed puts ex.Message into a localized string, so users get mixed-language output. Either move these messages to the .resx, or accept English-only diagnostics for this opt-in tool and say so.
Argument validation:ValidateOptionArgumentsAsync is a nested ternary that is hard to read. A switch or early returns would be clearer. It also checks that the output file does not exist, but not that its directory exists. A missing directory only surfaces later as DirectoryNotFoundException, which the tool does catch and report, so this is a UX nit and not a bug.
Exception handling:RunAsync catches only IOException, UnauthorizedAccessException, XmlException, InvalidDataException and ArgumentException. The "index length changed" InvalidOperationException would escape as an unhandled failure. It is a defensive invariant, so I suggest keeping it, but you could document that this is intentional.
Memory use: Each failing UnitTestResult is loaded fully as an XElement, and its whole Output is serialized to a byte array before chunking. This is fine for the stated use. Very large captured stdout in a failing row will spike memory, so a note in the docs or a size cap may be worthwhile.
Output size:JsonStringWriter is pretty-printing, and WriteLine strips the newlines but leaves the indentation spaces in every record. This is correct, because newlines inside strings are escaped, but it adds padding to every JSONL record. If byte efficiency matters for the tool's goal, a compact mode would help.
Test-value evidence: The PR supplies a packaged acceptance regression with a name-association mutation (1/1 passed, then 1/1 failed on the expected assertion, then passed again after restoration). The tests assert identities, excerpt bytes, offset arithmetic, and the byte-level contiguity of the detail ranges, which is strong. I did not independently re-execute it. The PR itself lists in-flight cancellation and multi-module selection as unexercised gaps. A unit-level cancellation test would be cheap to add.
No blocking correctness defects found in the shipping code. The UTF-8 boundary handling for excerpts and chunks and the two-pass fixed-width offset computation look correct. The temp-file and cleanup ownership is sound, and DtdProcessing.Prohibit with XmlResolver = null is appropriate for untrusted TRX input.
Adds the opt-in agent-trx workflow to Microsoft.Testing.Platform’s TRX extension, giving agents a failure index with bounded excerpts and seekable diagnostics without changing default test output.
Changes:
Registers the tool and adds JSON-writing support, API tracking, localized resources, and tool-info expectations.
Documents report selection, indexed retrieval, and diagnostic limitations.
Adds reproducible benchmark tooling for capture, retrieval, grading, telemetry, and comparisons.
Test-value evidence: The PR reports packaged acceptance tests and a detected name-association mutation for assessed revision f202e303ce3eaf2ce58f7b9e547b77b85041691b. Those runs were not independently verified here; cancellation, multi-module selection, and shipping-format token savings remain unverified.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Diagnostic range validation accepts offsets beyond the available bytes, returning misleading omission metadata instead of an invalid-range error.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Reject diagnostic offsets beyond the end of the data
eng/agent-output-benchmark/view.mjs:101
An offset past the end of a diagnostic passes this validation and produces impossible omission metadata. For example, a 10-byte diagnostic requested at offset 20 with length 5 returns an empty diagnostic with totalBytes: 10 and omittedBytes: 20. An agent paging through details can therefore receive a successful but misleading response instead of an invalid-range error. Reject offsets greater than bytes.length, as the source-free retrieval helper already does.
Compared merge base 9892cae32dedef87f95cf16a8472274bcb67b231 with head 217a89d1bec1cf05166fd32b397c2f19ca28f1e1. Evidence applies to this head, not every intermediate commit. Static review only: no builds or tests were run, and I did not check for an earlier report on this head.
Test-value evidence
Contract
Test and decisive assertion
Counterfactual
Status
The agent TRX index keeps distinct rows that share a testId, with a 512-byte excerpt, omittedBytes, and contiguous seekable detail ranges (including Unicode and escaped content).
AgentTrxToolTests.Index_PreservesDistinctRowsAndByteRangesWithUnicode. It asserts row names, excerpt, omittedBytes, offset/length contiguity to EOF, and exact round-tripped XML values.
Keying rows by testId alone, or cutting the excerpt mid-surrogate, would change the names, counts, excerpt and offsets.
Static prediction: caught. No executed red/green record available.
An empty test name does not drop other failures.
Index_EmptyTestNamePreservesOtherFailures asserts both row names.
Skipping rows with an empty name would remove the first row.
Static prediction: caught.
A report with zero failures is not claimed complete.
Index_ZeroFailuresDoesNotClaimCompleteExecution asserts a single header line, completeness of unknown, and detailsOffset equal to the file length.
Emitting complete, or extra lines, would fail.
Static prediction: caught.
Invalid input is rejected without publishing output or leaving temp files.
Index_InvalidInputDoesNotPublishOrLeaveTemporaryFiles, 6 data rows. Each asserts exit code 1, a single error message, no output file and no *.tmp.
Publishing before validation would fail.
Static prediction: caught.
An existing output file is not overwritten, and cancellation leaves files untouched.
Index_ExistingOutputAndCanceledRunDoNotReplaceFiles asserts the original content and input bytes.
Overwriting the output or leaving a temp file would fail.
Static prediction: caught.
Command-line validation of the input and output paths.
CommandLine_ValidatesInputAndOutputWithoutCreatingFiles asserts all four validation outcomes.
Inverting a check would fail.
Static prediction: caught.
End-to-end projection through the real packaged agent-trx tool.
The three AgentTrxProjectionAcceptanceTests methods assert identities, excerpt equality, per-record 12 KB windows, range contiguity, and invalid-path exit codes.
Oversized detail records or wrong ranges would fail.
Static prediction: caught. Needs a pack to execute.
The --help and --info expectations include the new option.
Not checked; only an expected-output string changed
n/a
Not available
Microsoft.Testing.Extensions.UnitTests
MethodLevel
0 (all cores)
Not available
Each changed test uses its own unique temp directory, and the shared asset fixture is only read. No process-wide state is mutated.
Per-test assessment
Pseudo-mutation evidence below consists of static predictions, not executed mutation results.
Result
Quality
Test
Notes
Follow-up
Pass
A (90–100)
new AgentTrxProjectionAcceptanceTests.AgentTrx_FailingRowsPreserveIdentityExcerptsAndSeekableDetails
Real-tool E2E with exact excerpt, 12 KB window and range assertions.
None.
Pass
A (90–100)
new AgentTrxToolTests.Index_PreservesDistinctRowsAndByteRangesWithUnicode
Exact per-row identity, excerpt and contiguous-range assertions.
None.
Pass
A (90–100)
new AgentTrxToolTests.Index_InvalidInputDoesNotPublishOrLeaveTemporaryFiles
6 data rows each assert exit code, error message, no output and no temp files.
None.
Pass
B (80–89)
new AgentTrxProjectionAcceptanceTests.AgentTrx_InvalidPathsDoNotCreateOrOverwriteOutput
Asserts exit codes and untouched files.
No change justified. Both invalid-path cases are covered, and the error text is intentionally not pinned.
Pass
B (80–89)
new AgentTrxProjectionAcceptanceTests.AgentTrx_PassingReportProducesHeaderWithoutFailures
Single header line with the expected counts and outcome.
No change justified.
Pass
B (80–89)
new AgentTrxToolTests.CommandLine_ValidatesInputAndOutputWithoutCreatingFiles
Four validation outcomes plus no file created.
No change justified.
Pass
B (80–89)
new AgentTrxToolTests.Index_EmptyTestNamePreservesOtherFailures
Asserts both row names.
No change justified. The test is narrow and complete for its contract.
Pass
B (80–89)
new AgentTrxToolTests.Index_ExistingOutputAndCanceledRunDoNotReplaceFiles
Asserts the exception type, output and input bytes, and no temp files.
No change justified.
Pass
B (80–89)
new AgentTrxToolTests.Index_ZeroFailuresDoesNotClaimCompleteExecution
Asserts line count, counts, completeness and offset.
No change justified.
Not applicable
—
mod HelpInfoAllExtensionsTests, RetryTrxRegistrationBehaviorTests
Changed ranges fall in expectation strings and local mock setup.
None.
No inline comments were published: I found no supported improvement or unresolved doubt to anchor.
<sub>This advisory review is heuristic and non-blocking.
Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>
🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto (Claude Sonnet 5.5) · ~60 AIC · ⌖ ~2 AIC · ⊞ 8.5K
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
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
217a89d1bec1cf05166fd32b397c2f19ca28f1e1↑ Benchmark telemetry regression failed before the fix and passed afterward.
↓ Shipping tests were run on an earlier revision; in-flight cancellation, multi-module selection and shipped-projection token savings remain unverified.
Pull request
Summary
Add the opt-in
agent-trxtool to project one selected TRX into a self-contained JSONL failure index with bounded excerpts and seekable, chunked diagnostic details. Default test output and exit behavior remain unchanged. Relates to #8827.Design and decision record
Research, experiments, tradeoffs, and validation. The measured #7 + #10 prototype saved 11.1% versus #10 in a small source-free sample, but used a different artifact format and excerpt limit; savings for this implementation are not established. The benchmark sources are included for reproducibility.
Demonstration
Run
Tests.exe agent-trx --input-trx report.trx --output-jsonl index.jsonlon a test application with the TRX extension registered. In a real packednet11.0consumer, a captured six-result report produced three failure records, a 2,915-byte initial index and a 66,914-byte JSONL file; the source TRX was 66,259 bytes. Its header reported"reportOutcome": "Failed","resultCount": 6,"failureCount": 3and"detailsOffset": "00000000000000002915". JSONL is the intended nonvisual consumer surface, so a text transcript is more useful than a screenshot. TRX may already have truncated diagnostics; retain the original process exit and terminal log, and select each module's final report.Validation and regression proof
On Windows, source based on
9892cae32dedef87f95cf16a8472274bcb67b231with the implementation and tests included in this PR:.\build.cmd -pack -c Release -bl— exit 0; package content and metadata validation passed..\.dotnet\dotnet.exe run --project test\UnitTests\Microsoft.Testing.Extensions.UnitTests\Microsoft.Testing.Extensions.UnitTests.csproj -f net10.0 -c Release --no-build --no-launch-profile -- --filter 'FullyQualifiedName~AgentTrxToolTests' --progress off— exit 0; 11 passed, none skipped..\.dotnet\dotnet.exe test --project test\IntegrationTests\MSTest.Acceptance.IntegrationTests\MSTest.Acceptance.IntegrationTests.csproj -c Release --no-build --filter 'FullyQualifiedName~AgentTrxProjectionAcceptanceTests' -p:UsingDotNetTest=true -p:ArtifactsTestResultsDir=artifacts\TestResults\Release\agent-trx-acceptance --show-test-results all— exit 0; three passed, none skipped. These cover distinct failed rows and associated seekable details, a passing report, and missing/existing paths in a real packed consumer. Package and loaded DLL hashes matched; see the decision record for versions and provenance.net462,net10.0andnet11.0. Benchmark self-tests passed, including grader, reliability, comparison and default-harness checks.In-flight cancellation and independent multi-module selection were not exercised. No change to SDK terminal rendering is claimed; servicing and downstream rollout remain separate decisions.
Test-value evidence
For this PR's implementation, an isolated, buildable mutation replaced the indexed failure name with an empty string. Each state was repacked using
.\build.cmd -pack -c Release -bl '/p:RestoreFallbackFolders=Q:\.tools\.nuget\packages'with a separate NuGet cache. The same packed acceptance selection (--filter 'FullyQualifiedName~AgentTrx_FailingRowsPreserveIdentityExcerptsAndSeekableDetails', otherwise the command above) passed 1/1, failed 1/1 at the expectedrow-alpha/row-betaversus empty-name assertion (exit 2), and passed 1/1 after restoration. Each consumer DLL matched its own package asset. This proves sensitivity to lost name association, not every possible defect; exact hashes and command variants are in the decision record.