Signal log truncation and retry with larger tail on step miss - #4452
Signal log truncation and retry with larger tail on step miss#4452sahilnyk wants to merge 4 commits into
Conversation
Signed-off-by: sahilnyk <contactsahilpnayak@gmail.com>
Greptile code reviewThis repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md. Run a review — add a PR comment with: Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5. Optional: automate with the greploop skill. |
Greptile SummaryAdds truncation metadata and a one-shot larger-tail retry when a requested GitHub Actions step is missed after log truncation, and fixes ungrouped-only logs so step_number no longer pretends to match a fake section.
Confidence Score: 5/5Safe to merge; the prior character-vs-line retry sizing issue is addressed and no blocking failures remain. Retry now estimates line count from the returned tail’s character density before calling tail_lines, with floor and cap; ungrouped-only and truncation paths are covered by tests.
|
| Filename | Overview |
|---|---|
| integrations/github/tools/actions.py | Truncation signaling, char-to-line retry sizing, shared fetch helper, and ungrouped-log section fix. |
| tests/tools/test_github_actions_tool.py | Regression coverage for ungrouped step_number, truncation fields, and retry-on-miss. |
Reviews (2): Last reviewed commit: "Fix retry tail_lines to estimate lines, ..." | Re-trigger Greptile
Signed-off-by: sahilnyk <contactsahilpnayak@gmail.com>
|
@larsspinetta12 pls review |
|
@greptile review again |
|
@sahilnyk
Two small things to fix below:
Inline issue 2 — silent retry failure --> On the if retry_error is None: block: @ me in a comment here when those are done! |
Signed-off-by: sahilnyk <contactsahilpnayak@gmail.com>
|
@larsspinetta12 added those, please review! |
There was a problem hiding this comment.
Nice fix — returning [] for the ungrouped case is the right root cause, and surfacing retry_error is a good touch.
One real issue: truncated will false-positive. _extract_log_text strips the tail but original_length is unstripped, so any complete log ending in a newline reports truncated=True — and when the step isn't found, that fires a wasted second fetch. Compare against the unstripped length instead.
Also: original_length isn't referenced anywhere else in the repo — can you confirm the pinned github-mcp-server version actually returns it? Otherwise the retry silently no-ops. A test for the missing-field case would pin that down.
lastly fix merge conflict
Signed-off-by: sahilnyk <contactsahilpnayak@gmail.com>
|
@Davidson3556 Addressed your suggestions and fixed them, please review again. |
Fixes #4425
Describe the changes you have made in this PR -
integrations/github/tools/actions.pyonly, per the issue's scope:Truncation signal:
get_github_actions_step_lognow returnstruncated,returned_length, andoriginal_lengthso the agent can tell when the 500-line tail cut off part of the job log.Retry on step miss: when a requested
step_name/step_numberfalls back tomatch_strategy="full-log"and the log was truncated, it re-fetches once with a biggertail_lines, sized from the log's own reportedoriginal_length(capped at 20000), instead of settling for a partial log.Fixed the ungrouped-only log bug: a log with zero
##[group]markers was fabricating a fake single "full-log" section that got miscounted as step 1, sostep_number=1wrongly reportedmatch_strategy="step_number". Root-cause fix:_extract_log_sectionsnow returns[]for that case and letsextract_step_log's real full-log fallback handle it.Demo/Screenshot for feature changes and bug fixes -
ruff check,ruff format --check, andmypyall pass.tests/tools/test_github_actions_tool.py: 38/38 passed (35 existing + 3 new regression tests, one per fix above).Broader
tests/tools -k github: 218 passed.Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
Read the linked issue 2719 thread first: a contributor there flagged that
get_job_logs's response exposes the total log length for a follow-up fetch, and a maintainer comment confirmed thestep_numberbounds bug was fixed in PR 2755, but only for logs with real group blocks, not the zero-groups case this issue calls out. Tracedextract_step_logand_extract_log_sectionsto confirm that gap.First pass hardcoded a flat retry
tail_linesguess. Fixed it to use the log's ownoriginal_length(capped) instead, since that is what the issue asks for. Extracted one_fetch_job_loghelper so the retry does not duplicate the initial fetch. No behavior change outside the truncated-plus-step-missing case.Checklist before requesting a review