Skip to content

ai-summary: ignore errors a test declared expected - #133

Merged
ppetrovicTT merged 4 commits into
mainfrom
ppetrovic/ai-summary-negative-test
Jun 19, 2026
Merged

ppetrovicTT merged 4 commits into
mainfrom
ppetrovic/ai-summary-negative-test

Conversation

@ppetrovicTT

Copy link
Copy Markdown
Contributor

Lines inside an [EXPECTED_ERROR BEGIN message="..."]...[END] bracket (emitted by the expect_error pytest fixture) that match the declared message are masked before crash detection AND section extraction. A deliberately provoked error (e.g. a negative test's TT_FATAL) no longer triggers a false CRASH, while a different error in the same block — or anything outside a bracket — still does.

Copilot AI review requested due to automatic review settings June 10, 2026 10:57
@ppetrovicTT
ppetrovicTT requested a review from a team as a code owner June 10, 2026 10:57

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

This PR updates the AI log extraction pipeline to suppress developer-declared expected error lines (via EXPECTED_ERROR log brackets) before downstream crash detection and error section extraction, reducing false “CRASHED” classifications for negative tests.

Changes:

  • Added parsing + masking for [EXPECTED_ERROR BEGIN ... message=...] ... [EXPECTED_ERROR END] blocks so declared expected error lines don’t influence crash detection or extracted error sections.
  • Refactored crash detection into clearer buckets (hard crash / collection crash / killed / TT_FATAL+TT_THROW / selected Python exceptions).
  • Applied expected-error masking early in extract_log() so it affects all later processing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +283 to +285
"""Line ranges of properly closed [EXPECTED_TT_ERROR BEGIN match=...]...[END]
blocks, paired with the declared match pattern. An unclosed block is ignored,
so its contents are never masked."""
Comment on lines +300 to +304
"""Return a copy of `lines` with developer-declared expected errors blanked out.
For each closed [EXPECTED_TT_ERROR BEGIN match='<pat>']...[END] bracket, the two
marker lines and any in-between line matching <pat> are replaced with "" — so they
are seen by neither crash detection nor section extraction. Everything else — a
different line in the block, or anything outside a bracket — is untouched."""
Comment on lines +310 to +311
masked[start] = "" # [EXPECTED_TT_ERROR BEGIN ...] marker
masked[end] = "" # [EXPECTED_TT_ERROR END] marker
Comment on lines +432 to +434
# Strip developer-declared expected errors (expect_tt_error brackets) up front, so
# they're excluded from EVERYTHING downstream — crash detection and the error
# sections handed to the LLM alike.
Comment on lines +450 to +452
# TT_THROW/TT_FATAL means tt-metal crashed, which cascades to vLLM timeout and test
# failures. (full_text already has expect_tt_error-declared errors masked out above.)
#
Comment on lines +432 to +436
# Strip developer-declared expected errors (expect_tt_error brackets) up front, so
# they're excluded from EVERYTHING downstream — crash detection and the error
# sections handed to the LLM alike.
lines = _mask_expected_errors(lines)

vmilosevic
vmilosevic previously approved these changes Jun 15, 2026
@ppetrovicTT
ppetrovicTT force-pushed the ppetrovic/ai-summary-negative-test branch from 127d1b9 to d0ac90d Compare June 19, 2026 10:37
Copilot AI review requested due to automatic review settings June 19, 2026 11:44
@ppetrovicTT
ppetrovicTT force-pushed the ppetrovic/ai-summary-negative-test branch from d0ac90d to 54294a7 Compare June 19, 2026 11:44

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.

⚠️ Not ready to approve

The current masking implementation can drop newlines (risking cross-line regex matches), and the new behavior around error section extraction isn’t fully asserted by the added tests.

Copilot's findings
  • Files reviewed: 4/4 changed files
  • Comments generated: 5

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment on lines +351 to +360
for start, block_end, pattern in ranges:
masked[start] = "" # [EXPECTED_ERROR BEGIN ...] marker
masked[block_end] = "" # [EXPECTED_ERROR END] marker
try:
pat = re.compile(pattern)
except re.error:
continue # malformed pattern → mask only the markers, treat content as real
for i in range(start + 1, block_end):
if pat.search(masked[i]):
masked[i] = ""
nonempty = [ln for ln in lines if ln.strip()]
completion_chunks = [(log_source.name, nonempty[:_MARKER_WINDOW], nonempty[-_MARKER_WINDOW:])]

# Strip developer-declared expected errors (expect_tt_error brackets) up front, so
Comment on lines +89 to +95
def test_declared_error_is_masked(self, tmp_path):
log = (
'[EXPECTED_ERROR BEGIN] RuntimeError message="must be BFLOAT8_B"\n'
"TT_FATAL global_tensor must be BFLOAT8_B or BFLOAT16, got Float32\n"
'[EXPECTED_ERROR END] RuntimeError message="must be BFLOAT8_B"\n'
)
assert not _extract(tmp_path, log).has_crash
Comment on lines +97 to +103
def test_undeclared_error_in_block_still_crashes(self, tmp_path):
log = (
'[EXPECTED_ERROR BEGIN] RuntimeError message="must be BFLOAT8_B"\n'
"TT_FATAL unrelated device hang\n"
'[EXPECTED_ERROR END] RuntimeError message="must be BFLOAT8_B"\n'
)
assert _extract(tmp_path, log).has_crash
Comment on lines 491 to 495
detection_patterns: dict | None = None,
expected_error_markers: dict | None = None,
) -> ExtractedLog:
"""
Extract important parts from a CI log.
ppetrovicTT and others added 2 commits June 19, 2026 14:36
Lines inside an [EXPECTED_ERROR BEGIN <Type> message="..."]...[END] bracket
(emitted by the expect_error pytest fixture) that match the declared message are
masked before crash detection AND section extraction. A deliberately provoked
error (e.g. a negative test's TT_FATAL) no longer triggers a false CRASH, while
a different error in the same block — or anything outside a bracket — still does.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A pytest SKIPPED result never ran, so a crash/timeout token quoted in its
skip reason (e.g. "Disabled by #44858: ... TT_FATAL ...") was flipping the
job to CRASHED. Blank lines matching ignored_line_patterns (analysis.yaml)
up front, alongside the expected-error masking.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ppetrovicTT
ppetrovicTT force-pushed the ppetrovic/ai-summary-negative-test branch from 54294a7 to d648faa Compare June 19, 2026 13:13
Two pre-detection passes (expected-error brackets, non-event lines) and the
window+timestamp gate are non-obvious; record the flow and the invariant.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 19, 2026 13:22

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.

✅ Ready to approve

The change is well-scoped, includes solid test coverage for the new masking behavior, and the remaining feedback is limited to small documentation/performance nits.

Note: this review does not count toward required approvals for merging.

Copilot's findings
  • Files reviewed: 6/6 changed files
  • Comments generated: 3

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread .github/actions/ai_summary/tool/ai_job_summary/extract.py Outdated
Comment on lines +309 to +313
def _default_expected_error_markers() -> dict:
"""Bundled expected_error_markers, for direct extract_log() calls without config."""
from .config import load_config

return load_config().get("expected_error_markers", {})
Comment on lines +316 to +320
def _default_ignored_line_patterns() -> list[str]:
"""Bundled ignored_line_patterns, for direct extract_log() calls without config."""
from .config import load_config

return load_config().get("ignored_line_patterns", [])
Copilot review: one leftover expect_tt_error comment (markers are expect_error),
and extract_log's Args omitted detection_patterns/expected_error_markers/
ignored_line_patterns.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ppetrovicTT
ppetrovicTT merged commit f78f784 into main Jun 19, 2026
3 checks passed
@ppetrovicTT
ppetrovicTT deleted the ppetrovic/ai-summary-negative-test branch June 19, 2026 13:51
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