From 38e6326321627fa05c973f7e1ca01f05f63a04f5 Mon Sep 17 00:00:00 2001 From: Peter Zhang <18501667167@qq.com> Date: Mon, 8 Jun 2026 21:58:34 +0800 Subject: [PATCH] =?UTF-8?q?test:=20agent=5Fpoller=20get=5Fissue=20?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=20=E2=80=94=20=E8=AF=84=E8=AE=BA=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=20+=20UTF-8=20=E7=BC=96=E7=A0=81=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?-=20Closes=20#126?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- scripts/agent_poller.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/agent_poller.py b/scripts/agent_poller.py index 232f69b..7c9b311 100644 --- a/scripts/agent_poller.py +++ b/scripts/agent_poller.py @@ -21,6 +21,13 @@ import sys import urllib.request import urllib.error +# Fix Windows GBK encoding: emoji and Chinese characters from Gitea API +# crash print() under the default Windows code page. +try: + sys.stdout.reconfigure(encoding='utf-8') +except Exception: + pass + def _load_gitea_config(): """Load Gitea URL, repo, and token from ~/.gitea/config.yaml or env vars.""" config_path = os.path.expanduser("~/.gitea/config.yaml") @@ -173,7 +180,7 @@ def blocked_check(): print(f"Checked {len(all_blocked)} blocked issue(s): still blocked.") -def get_issue(num): +def get_issue(num, with_comments=True): i = _req("GET", f"/issues/{num}") print(f"## #{i['number']}: {i['title']}") print(f"State: {i['state']}") @@ -181,6 +188,16 @@ def get_issue(num): print(f"Labels: {', '.join(labels) if labels else 'none'}") print() print(i.get("body", "(no description)")) + if with_comments: + comments = _req_safe("GET", f"/issues/{num}/comments") + if comments: + print(f"\n--- Comments ({len(comments)}) ---") + for c in comments: + user = c.get("user", {}).get("login", "unknown") + created = c.get("created_at", "")[:16] + body = c.get("body", "") + print(f"\n[{user}] {created}") + print(body) return i -- 2.52.0