Closed
click_publish.py 使用裸 `except:`,会吞掉 KeyboardInterrupt 且掩盖真实异常 #112
l17320999354Add on Oct 21Closed at Oct 27
Oct 21 Modify description of issue
grape_bot
Oct 21 Comments:
Oct 21 Comments:
[VOD Agent] 已审视并结构化 Issue #112(click_publish.py 裸 except 缺陷),并 A2A 交办 Issue Agent


Oct 21 Added label: bugspec-readytriaged
grape_bot
Oct 21 Comments:
Oct 21 Comments:
[issue agent] 深度可开发性分析完成,评级 ready,Spec 如下,已 A2A 交办 coding。
Spec:消除 click_publish.py 裸 except(Issue #112)
目标分支:main(仓库默认分支)
目标
消除 xiaohongshu_workflow/scripts/archive/click_publish.py(约 L90)的裸 except:,避免吞掉 KeyboardInterrupt/SystemExit 并丢失异常堆栈。
现状
脚本使用不带异常类型的裸 except:,连 KeyboardInterrupt、SystemExit 一并捕获且丢失堆栈:出错时无定位信息,Ctrl-C 可能无法中断脚本。
实现要点
- 定位
scripts/archive/click_publish.py中全部裸except:(不止 L90,需全文扫描)。 - 按实际调用链确定预期异常类型,改为显式捕获并绑定异常对象,如
except (ValueError, OSError) as e:。 - 异常处理中记录真实异常信息与堆栈(
logging.exception或traceback),替换自造提示。 - 不捕获
KeyboardInterrupt/SystemExit,保证 Ctrl-C 可正常中断。
验收标准
- 仓库历史无相关修复 commit,需求未实现,可进入开发。
优先级:P2 标签:bug / spec-ready / triaged


Oct 21 Associated pull request
grape_bot
Oct 21 Comments:
Oct 21 Comments:
[Coding Agent] ✅ 已按 Spec 完成 Issue #112 开发,请审查 PR #16。
改动摘要:
- 全文扫描
scripts/archive/click_publish.py,修复全部 2 处裸except:(ev()取值处、坐标解析处) - 改为显式类型捕获并
as e绑定:except (KeyError, TypeError)/except (ValueError, KeyError, TypeError) - 新增 logging 模块 logger,异常日志带
exc_info=True记录真实异常信息与完整堆栈 - 不捕获
KeyboardInterrupt/SystemExit,Ctrl-C 可正常中断 - 新增 AST 验收测试 5 例全部通过(
xiaohongshu_workflow/tests/test_click_publish_exceptions.py)


grape_bot
Oct 21 Comments:
Oct 21 Comments:
[QA Agent] PR #16 审查结论:通过;Critical/Required 问题 0 项,仅 2 条 Optional(仓库级 AGENTS.md/经验沉淀,不影响本 PR);无 A2A 交办


Oct 27 Close issue
Nov 2 Associated pull request
目标
消除
click_publish.py中的裸except:,避免吞掉KeyboardInterrupt/SystemExit并丢失异常堆栈,保证脚本可调试、可中断。现状
xiaohongshu_workflow/scripts/archive/click_publish.py(L90,按当前默认分支)使用不带异常类型的裸except:,会连同KeyboardInterrupt、SystemExit一起捕获,并吞掉完整异常堆栈。影响:出错时没有可定位的信息(或只剩一句自造提示),调试困难;Ctrl-C 也可能无法中断脚本。严重度:中。期望行为
except (ValueError, OSError) as e:e(含堆栈)打进日志,而不是只打印一句自造提示验收标准
优先级
P2(一般)
来源:Issue #112(静态分析工具报告,未修改任何仓库内容)
VOD 审视结构化