From d5f9d6c4c978a115a60862463cb8420656852a6f Mon Sep 17 00:00:00 2001 From: KhanCold Date: Sat, 9 May 2026 23:04:36 +0800 Subject: [PATCH 1/3] fix(gateway): skip row-label column in Telegram table bullet rendering Fixes #22604. The _render_table_block_for_telegram() function was incorrectly including the first column (row-label) as a bullet item when rendering tables for Telegram output. Changed zip(headers, cells) to zip(headers[1:], cells[1:]) to skip the row-label column, matching the expected Telegram output format. --- gateway/platforms/telegram.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gateway/platforms/telegram.py b/gateway/platforms/telegram.py index 0ae2787debf84..00567341f80c7 100644 --- a/gateway/platforms/telegram.py +++ b/gateway/platforms/telegram.py @@ -190,8 +190,11 @@ def _render_table_block_for_telegram(table_block: list[str]) -> str: heading = next((cell for cell in cells if cell), f"Row {index}") rendered_rows.append(f"**{heading}**") + # Skip the first column (row-label) when rendering bullet items, + # matching the expected Telegram output format. rendered_rows.extend( - f"• {header}: {value}" for header, value in zip(headers, cells) + f"• {header}: {value}" + for header, value in zip(headers[1:], cells[1:]) ) return "\n\n".join(rendered_rows) From bc8133634c9d4515f1b0807bb56109b383f811ff Mon Sep 17 00:00:00 2001 From: KhanCold Date: Sun, 10 May 2026 00:15:32 +0800 Subject: [PATCH 2/3] fix(completion): correct zsh _arguments syntax for options with short and long forms The zsh completion script used invalid _arguments syntax: '(-h --help){{-h,--help}}[Show help and exit]' This caused: _arguments:comparguments:327: invalid argument: (-h --help){-h,--help}[Show help and exit] The issue is that () groups in _arguments must contain only single-letter short options, not long options. The space in (-h --help) makes it invalid. Fix: Replace all (-X --Y) groups with (-), which means the option can be used with any other option. The correct format is: '(-)'{-h,--help}'[Show help and exit]' This follows Zsh's official completion syntax guidelines and fixes tab completion for all Zsh users. Fixes #22686 --- hermes_cli/completion.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hermes_cli/completion.py b/hermes_cli/completion.py index 18de08cc90127..c8db282fc4fa3 100644 --- a/hermes_cli/completion.py +++ b/hermes_cli/completion.py @@ -216,9 +216,9 @@ def generate_zsh(parser: argparse.ArgumentParser) -> str: typeset -A opt_args _arguments -C \\ - '(-h --help){{-h,--help}}[Show help and exit]' \\ - '(-V --version){{-V,--version}}[Show version and exit]' \\ - '(-p --profile){{-p,--profile}}[Profile name]:profile:_hermes_profiles' \\ + '(-)'{-h,--help}'[Show help and exit]' \\ + '(-)'{-V,--version}'[Show version and exit]' \\ + '(-)'{-p,--profile}'[Profile name]:profile:_hermes_profiles' \\ '1:command:->commands' \\ '*::arg:->args' From 239380c5a4d19eecff6fd7fab9306b26733177c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E5=90=AF=E6=98=8E=EF=BC=88QimingShi=EF=BC=89?= Date: Sun, 10 May 2026 00:29:51 +0800 Subject: [PATCH 3/3] Revert telegram.py to main branch version --- gateway/platforms/telegram.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/gateway/platforms/telegram.py b/gateway/platforms/telegram.py index 00567341f80c7..e680db61e6745 100644 --- a/gateway/platforms/telegram.py +++ b/gateway/platforms/telegram.py @@ -180,21 +180,32 @@ def _render_table_block_for_telegram(table_block: list[str]) -> str: if len(headers) < 2: return "\n".join(table_block) + # Detect row-label column: present when data rows have one more cell + # than the header row (the row-label column carries no header). + first_data_row = _split_markdown_table_row(table_block[2]) if len(table_block) > 2 else [] + has_row_label_col = len(first_data_row) == len(headers) + 1 + rendered_rows: list[str] = [] for index, row in enumerate(table_block[2:], start=1): cells = _split_markdown_table_row(row) - if len(cells) < len(headers): - cells.extend([""] * (len(headers) - len(cells))) - elif len(cells) > len(headers): - cells = cells[: len(headers)] + if has_row_label_col: + # First cell is the row-label (heading); remaining cells align with headers. + heading = cells[0] if cells and cells[0] else f"Row {index}" + data_cells = cells[1:] + else: + # No row-label column: use first non-empty cell as heading. + heading = next((cell for cell in cells if cell), f"Row {index}") + data_cells = cells + + # Pad or trim data_cells to match headers length. + if len(data_cells) < len(headers): + data_cells.extend([""] * (len(headers) - len(data_cells))) + elif len(data_cells) > len(headers): + data_cells = data_cells[: len(headers)] - heading = next((cell for cell in cells if cell), f"Row {index}") rendered_rows.append(f"**{heading}**") - # Skip the first column (row-label) when rendering bullet items, - # matching the expected Telegram output format. rendered_rows.extend( - f"• {header}: {value}" - for header, value in zip(headers[1:], cells[1:]) + f"• {header}: {value}" for header, value in zip(headers, data_cells) ) return "\n\n".join(rendered_rows)