Add changes to get full content of Serial Console log#4507
Open
lubaihua33 wants to merge 1 commit into
Open
Conversation
🤖 AI Test SelectionNo test cases were selected for this PR. |
ee454b4 to
8438107
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the LISA AI log analysis workflow to handle large/verbose logs (notably serial_console.log) more reliably by adding file inspection tools, paging support for search, and output de-noising/metadata so the agent can reason about truncation and coverage.
Changes:
- Added
get_file_statsandread_text_file_tail, and registered them as agent tools to enable head/tail review. - Enhanced
read_text_fileto return structured metadata and to collapse long runs of consecutive duplicate lines. - Fixed
search_filesmatch line numbering to be 1-based and added pagination (match_offset/max_matches+pagination.has_more).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
pyproject.toml |
Updates dependency constraints and adds github-copilot-sdk to the ai optional dependency set. |
lisa/ai/prompts/default/log_search.txt |
Updates the agent prompt to explicitly use head+tail reads and to paginate search_files results. |
lisa/ai/default_flow.py |
Implements new file tools (stats, tail), adds pagination to search_files, and adds duplicate-line collapsing + richer metadata to reads. |
Comment on lines
407
to
409
| traceback_start = max(1, start_line_offset) | ||
| bounded_line_count = min(line_count, MAX_READ_LINE_COUNT) | ||
| traceback_end = traceback_start + bounded_line_count - 1 |
Comment on lines
+440
to
+443
| "effective_start_line": traceback_start, | ||
| "requested_line_count": line_count, | ||
| "effective_line_count": bounded_line_count, | ||
| "effective_end_line": traceback_end, |
Comment on lines
+494
to
+496
| start_line = collapsed_lines[0][0] | ||
| end_line = collapsed_lines[-1][0] | ||
| content = "\n".join(f"({i}): {t}" for i, t in collapsed_lines) |
Comment on lines
264
to
270
| file_extensions: Required file extension filter. Can be a single extension | ||
| (e.g., '.log') or multiple comma-separated extensions | ||
| max_matches: Maximum number of matches to return in this call (page size). | ||
| The actual returned size is capped for safety. | ||
| match_offset: Number of matches to skip (for pagination). 0-based. | ||
| (e.g., '.log,.txt,.out'). | ||
|
|
Comment on lines
407
to
409
| traceback_start = max(1, start_line_offset) | ||
| bounded_line_count = min(line_count, MAX_READ_LINE_COUNT) | ||
| traceback_end = traceback_start + bounded_line_count - 1 |
Comment on lines
+440
to
+443
| "effective_start_line": traceback_start, | ||
| "requested_line_count": line_count, | ||
| "effective_line_count": bounded_line_count, | ||
| "effective_end_line": traceback_end, |
Comment on lines
+494
to
+496
| start_line = collapsed_lines[0][0] | ||
| end_line = collapsed_lines[-1][0] | ||
| content = "\n".join(f"({i}): {t}" for i, t in collapsed_lines) |
Comment on lines
264
to
270
| file_extensions: Required file extension filter. Can be a single extension | ||
| (e.g., '.log') or multiple comma-separated extensions | ||
| max_matches: Maximum number of matches to return in this call (page size). | ||
| The actual returned size is capped for safety. | ||
| match_offset: Number of matches to skip (for pagination). 0-based. | ||
| (e.g., '.log,.txt,.out'). | ||
|
|
🤖 AI Test SelectionNo test cases were selected for this PR. |
8438107 to
cef679b
Compare
🤖 AI Test SelectionNo test cases were selected for this PR. |
LiliDeng
approved these changes
Jun 1, 2026
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.
Description
This PR improves the log analysis agent’s ability to read large/verbose logs more completely and reliably.
get_file_statsandread_text_file_tailso the agent can inspect both head and tail (root cause is often near EOF).read_text_fileto return structured metadata (effective ranges, truncation, duplicate-collapse stats) to make tool limits observable.search_files(match_offset + max_matches) to continue scanning beyond per-call caps.Related Issue
Type of Change
Checklist
Test Validation
python -m lisa.ai.log_agent eval
2026-05-29 02:39:40.205[INFO] === SUMMARY ===
2026-05-29 02:39:40.205[INFO] Test case 0 Similarity: 0.597978
2026-05-29 02:39:40.205[INFO] Test case 1 Similarity: 0.555844
2026-05-29 02:39:40.220[INFO] Test case 2 Similarity: 0.739928
2026-05-29 02:39:40.220[INFO] Test case 3 Similarity: 0.609710
2026-05-29 02:39:40.223[INFO] Test case 4 Similarity: 0.642781
2026-05-29 02:39:40.226[INFO] Test case 5 Similarity: 0.345781
2026-05-29 02:39:40.227[INFO] Test case 6 Similarity: 0.593808
2026-05-29 02:39:40.228[INFO] Test case 7 Similarity: 0.756404
2026-05-29 02:39:40.230[INFO] Test case 8 Similarity: 0.759833
2026-05-29 02:39:40.231[INFO] Test case 9 Similarity: 0.638409
2026-05-29 02:39:40.233[INFO] Test case 10 Similarity: 0.691454
2026-05-29 02:39:40.234[INFO] Test case 11 Similarity: 0.548641
2026-05-29 02:39:40.235[INFO] Test case 12 Similarity: 0.751358
2026-05-29 02:39:40.236[INFO] Test case 13 Similarity: 0.751052
2026-05-29 02:39:40.236[INFO] Test case 14 Similarity: 0.767606
2026-05-29 02:39:40.239[INFO] Test case 0 Processing time(s): 119.60
2026-05-29 02:39:40.240[INFO] Test case 1 Processing time(s): 181.19
2026-05-29 02:39:40.242[INFO] Test case 2 Processing time(s): 87.18
2026-05-29 02:39:40.243[INFO] Test case 3 Processing time(s): 86.51
2026-05-29 02:39:40.244[INFO] Test case 4 Processing time(s): 85.82
2026-05-29 02:39:40.246[INFO] Test case 5 Processing time(s): 132.73
2026-05-29 02:39:40.246[INFO] Test case 6 Processing time(s): 107.57
2026-05-29 02:39:40.248[INFO] Test case 7 Processing time(s): 111.86
2026-05-29 02:39:40.249[INFO] Test case 8 Processing time(s): 120.91
2026-05-29 02:39:40.250[INFO] Test case 9 Processing time(s): 99.04
2026-05-29 02:39:40.251[INFO] Test case 10 Processing time(s): 88.12
2026-05-29 02:39:40.252[INFO] Test case 11 Processing time(s): 109.14
2026-05-29 02:39:40.252[INFO] Test case 12 Processing time(s): 109.13
2026-05-29 02:39:40.253[INFO] Test case 13 Processing time(s): 112.52
2026-05-29 02:39:40.253[INFO] Test case 14 Processing time(s): 139.12
2026-05-29 02:39:40.254[INFO] Processing times - Average: 112.70s, Min: 85.82s, Max: 181.19s, Total: 1690.45s
2026-05-29 02:39:40.255[INFO] General deployment name: gpt-4.1, Software deployment name: gpt-5.2
2026-05-29 02:39:40.256[INFO] Average similarity: 0.650039, Best: 0.767606, Worst: 0.345781, Total test cases: 15