This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch fork-ci-note-error-text in repository https://gitbox.apache.org/repos/asf/airflow.git
commit b5cb493b8f550c3f7a6b58a329ce3aca42cfa719 Author: Jarek Potiuk <[email protected]> AuthorDate: Mon Nov 16 03:36:06 2026 +0900 Keep the cause of retried and timed-out GitHub calls in Slack notes Only "failed:" messages had the gh arguments removed, so for a retried, rate-limited or timed-out call the arguments could use up the note's 200 characters and leave out what went wrong. Generated-by: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NyQq9U7i5HhjDgrQ9qd3gq --- .../src/airflow_breeze/utils/fork_ci_reconcile.py | 10 ++++++++-- dev/breeze/tests/test_fork_ci_reconcile.py | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py b/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py index 026b456ed15..cb56eacdf37 100644 --- a/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py +++ b/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py @@ -204,6 +204,11 @@ SLACK_MAX_BLOCKS = 50 SLACK_ITEM_LIMIT = 500 # The error text a Slack item quotes; the full error is in the run log. ERROR_TEXT_LIMIT = 200 +# How GitHubClient ends a failed `gh` call's message, after the call's arguments. +GH_FAILURE = re.compile( + r" (?:failed: |(?=still failing after \d+ attempts: )|(?=still rate limited after \d+ attempts)" + r"|(?=timed out after \d+s))" +) # Events whose runs use the workflow files of the pull request's merge commit, so a pull request # can change what they run. pull_request_target and issue_comment use the base branch's files. MERGE_REF_EVENTS = ("pull_request", "pull_request_review", "pull_request_review_comment") @@ -602,8 +607,9 @@ def describe_error(e: Exception) -> str: its item is still posted once. """ message = str(e).strip() - if message.startswith("gh ") and " failed: " in message: - message = message.split(" failed: ", 1)[1] + failure = GH_FAILURE.search(message) if message.startswith("gh ") else None + if failure: + message = message[failure.end() :] first_line = message.splitlines()[0].strip() if message else "" text = f"{type(e).__name__}: {first_line}" if first_line else type(e).__name__ return text if len(text) <= ERROR_TEXT_LIMIT else f"{text[: ERROR_TEXT_LIMIT - 1]}…" diff --git a/dev/breeze/tests/test_fork_ci_reconcile.py b/dev/breeze/tests/test_fork_ci_reconcile.py index 4b270b86f4f..17084130127 100644 --- a/dev/breeze/tests/test_fork_ci_reconcile.py +++ b/dev/breeze/tests/test_fork_ci_reconcile.py @@ -5534,6 +5534,26 @@ def test_run_reconcile_compares_the_merge_the_fork_run_tested(mock_classify, moc pytest.param( GitHubError("GraphQL errors: [x]"), "GitHubError: GraphQL errors: [x]", id="other-message" ), + pytest.param( + GitHubError( + "gh api repos/apache/airflow/commits/" + + "a" * 40 + + "/check-runs?check_name=CI+passed&per_page=100" + " --paginate still failing after 4 attempts: HTTP 502: Bad Gateway" + ), + "GitHubError: still failing after 4 attempts: HTTP 502: Bad Gateway", + id="retries-exhausted", + ), + pytest.param( + GitHubError("gh api graphql -f query=q still rate limited after 3 attempts"), + "GitHubError: still rate limited after 3 attempts", + id="rate-limited", + ), + pytest.param( + GitHubError("gh api repos/apache/airflow/pulls/1 timed out after 60s"), + "GitHubError: timed out after 60s", + id="timed-out", + ), pytest.param(KeyError("sha"), "KeyError: 'sha'", id="other-exception"), pytest.param(RuntimeError(), "RuntimeError", id="no-message"), pytest.param(GitHubError("x" * 300), "GitHubError: " + "x" * 186 + "…", id="shortened"),
