bug: spec 文件读取把所有非 404 API 错误静默当作文件缺失

Open Beginner friendly
#378 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github, python
Domain
ci-cd, devtools

Research direction

Start with .github/scripts/write_spec_context.py around fetch_file_content and run_gh_json, then read resolve_spec_context and the implementation context resolver that reuses it. Check how the existing test_missing_file_returns_none handles API errors and distinguish a missing file from other failures. Done means non-404 API errors are surfaced instead of silently treated as missing, with tests covering both cases.

Written by the indexing model from the issue text.

Description

area:specs area:tests area:workflow bug repro:high triaged

问题位置

.github/scripts/write_spec_context.py:103

触发条件

存在 approved spec PR 或目录 spec 时,GitHub Contents API 对 gh api 返回 403、429、认证失败或 5xx 等非 404 错误。

实际影响

fetch_file_content 会返回 None,使 approved spec 被误判为不存在并回退到旧目录 spec 或空上下文;review 会跳过应有的 spec 一致性检查,implementation 也可能在没有 approved spec 的情况下继续。

核实依据

run_gh_json 使用 check=True,任何非成功 HTTP 状态都会抛出 CalledProcessError;第 101-104 行却把全部异常统一转换为文件缺失。resolve_spec_context 第 168-180 行因此静默降级,prepare_issue_implementation_context.resolve_implementation_spec_context 也复用同一逻辑且仅在存在未批准 PR 时 noop。test_missing_file_returns_none 用通用 CalledProcessError 固化了这一行为,未区分 404 与其他 API 故障。

扫描提交:e777f60106e401b086925270af317a4b36722be0;扫描日期:2026-12-02(北京时间);轮巡分片:62/90。

Dominant language
Python
Stars
171
Forks
24
Avg merge
3h 13m
Merged PRs (30d)
13

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Terry-Mao/AICodingFlow

All issues in Terry-Mao/AICodingFlow

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.