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 62f3e0c5982ec949d088f2fb08cf5afbe2ac44f1
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 f499fc2e25d..fb45beb0100 100644
--- a/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py
+++ b/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py
@@ -192,6 +192,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")
@@ -580,8 +585,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 6b89c8d124a..85c0c3539de 100644
--- a/dev/breeze/tests/test_fork_ci_reconcile.py
+++ b/dev/breeze/tests/test_fork_ci_reconcile.py
@@ -5053,6 +5053,26 @@ def 
test_monitor_interval_is_the_monitor_workflow_cadence():
         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"),

Reply via email to