Skip to content

fix: stabilize backend ci dependency install#835

Merged
ZhuLinsen merged 4 commits intomainfrom
fix/backend-ci-single-install
Mar 24, 2026
Merged

fix: stabilize backend ci dependency install#835
ZhuLinsen merged 4 commits intomainfrom
fix/backend-ci-single-install

Conversation

@ZhuLinsen
Copy link
Copy Markdown
Owner

PR Type

  • fix
  • feat
  • refactor
  • docs
  • chore
  • test

Background And Problem

backend-gate repeatedly failed in GitHub Actions before any repo checks ran. Recent attempts showed pip install -r requirements.txt completing successfully, then the workflow started a second pip install flake8 pytest invocation and the shell was terminated with exit code 143 during that second install phase.

Impact:

  • PR CI could fail nondeterministically before ./scripts/ci_gate.sh even started
  • Re-running the same workflow did not reliably recover because the failure point was inside the duplicated install path

Trigger:

  • .github/workflows/ci.yml installed backend runtime deps and CI tooling in separate pip commands

Scope Of Change

  • .github/workflows/ci.yml
  • requirements-ci.txt

Issue Link

No linked issue.
Motivation: unblock PR CI by removing the duplicated pip install path that repeatedly died with exit code 143.
Acceptance criteria:

  • backend CI installs Python dependencies through a single requirements entrypoint
  • pip cache keys cover both runtime and CI-only dependency manifests
  • local ./scripts/ci_gate.sh still passes end to end

Verification Commands And Results

./scripts/ci_gate.sh

Key output & conclusion:

  • 1139 passed, 104 subtests passed on the exploratory PR branch before extraction
  • 1123 passed, 104 subtests passed on this standalone branch based on current main
  • backend-gate: all checks passed

Compatibility And Risk

Low risk.

  • Runtime dependencies are unchanged; requirements-ci.txt simply centralizes backend CI tooling into the same install transaction
  • Future backend CI tooling additions must also be added to requirements-ci.txt

Rollback Plan

Revert commit 1cf2189 to restore the previous backend CI install flow.

EXTRACT_PROMPT Change (if applicable)

Not applicable.

Checklist

  • 本 PR 有明确动机和业务价值 / This PR has a clear motivation and value
  • 已提供可复现的验证命令与结果 / Reproducible verification commands and results are included
  • 已评估兼容性与风险 / Compatibility and risk have been assessed
  • 已提供回滚方案 / A rollback plan is provided
  • 若涉及用户可见变更,已同步更新相关文档与 docs/CHANGELOG.md;若未更新 README.md,已说明原因与文档落点 / If user-visible changes are included, the relevant docs and docs/CHANGELOG.md are updated; if README.md was not updated, the reason and documentation location are explained

Reason for not updating docs/README:

  • This PR only changes backend CI workflow behavior and does not change user-facing functionality or local runtime usage.

Copilot AI review requested due to automatic review settings March 24, 2026 13:03
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 24, 2026

🤖 自动审查报告

项目 结果
📊 变更文件 4 个
➕ 新增行数 82 行
➖ 删除行数 19 行
🔍 静态检查 ✅ 通过
🧠 AI 审查 ✅ 已完成

📁 修改的文件

  • 📝 .github/workflows/ci.yml (+23/-5)
  • 🆕 requirements-ci.txt (+6/-0)
  • 📝 requirements.txt (+2/-1)
  • 📝 scripts/ci_gate.sh (+51/-13)

🧠 AI 代码审查意见

审查结论

Not Ready

存在关键阻断项,需修复后方可合入。


审查结果

必要性

  • 通过
  • 理由: PR 明确指出了后端 CI 依赖安装反复失败的问题 (exit code 143),并给出了清晰的动机(解除 PR CI 阻塞)和验收标准。解决 CI 不稳定性具有重要的业务价值。

关联性

  • 通过
  • 证据: PR 描述中提供了明确的背景、问题、动机和验收标准,尽管没有关联 Issue,但信息完整,可接受。

类型

  • 建议类型: fix。与 PR 描述和内容相符,旨在修复 CI 流程中的稳定性问题。

描述完整性

  • 不完整/不准确
  • 缺失/不准确项:
    1. requirements-ci.txt 文件缺失: PR 描述在 Scope Of Change 中提到了 requirements-ci.txt,且 CI 配置 (.github/workflows/ci.yml) 现在明确依赖 pip install -r requirements-ci.txt。然而,在“修改文件列表”和代码 diff 中均未见到 requirements-ci.txt 文件被添加或修改。这会导致 CI 失败。
    2. 运行时依赖变更描述不准确: PR 描述在 Compatibility And Risk 中声称“Runtime dependencies are unchanged”,但代码 diff 显示 requirements.txtlitellm 依赖已从 PyPI 版本更改为 GitHub 仓库的特定标签版本。这是一项运行时依赖的实际变更,与描述不符。

风险级别

  • 关键风险:
    1. CI 流程中断: 由于 requirements-ci.txt 文件的缺失或内容不正确,新的 CI 流程将无法安装依赖,导致 CI 失败。
    2. 运行时依赖变更风险: litellm 依赖从 PyPI 版本切换到 GitHub 特定标签版本,虽然提供了原因,但其对运行时环境的兼容性和稳定性影响未在“Compatibility And Risk”中充分评估,且与 PR 核心目的(CI 稳定性)关联性不强,增加了不必要的风险。

必改项 (Blocking Issues)

  1. requirements-ci.txt 文件缺失或未在 PR 中体现

    • 定位: .github/workflows/ci.yml 中的 📦 Install dependencies 步骤,以及 PR 描述的 Scope Of Change
    • 影响: 新的 CI 工作流依赖 requirements-ci.txt 文件来安装 CI 工具(如 flake8, pytest)。若此文件不存在或未包含正确内容,CI 将会因文件找不到或缺少关键依赖而失败。
    • 要求: 请务必在 PR 中添加 requirements-ci.txt 文件,并确保其包含所有必要的后端 CI 工具依赖(例如 flake8pytest,以及其他可能的 CI 专用依赖),并更新 PR 的“修改文件列表”以反映此变更。
  2. requirements.txt 变更与 PR 描述矛盾,且可能引入额外风险

    • 定位: requirements.txt 文件,以及 PR 描述的 Compatibility And Risk 部分。
    • 影响: litellm 依赖的变更是一项运行时依赖更新,与 PR 标题“stabilize backend ci dependency install”的核心目的关联性较低。更重要的是,PR 描述中声称“Runtime dependencies are unchanged”与实际变更不符。此变更可能引入新的兼容性或运行时问题,但其风险未在描述中充分评估。
    • 要求:
      • 请修正 PR 描述中关于运行时依赖的说明,准确反映 litellm 的变更。
      • 强烈建议: 将 litellm 的更新从本 PR 中移除,并拆分到一个独立的 fixchore 类型 PR 中,以保持本 PR 关注点的单一性(CI 稳定性),并能更清晰地评估 litellm 更新本身的风险。如果决定保留在此 PR 中,请在描述中详细说明此特定变更的背景(PyPI 隔离的具体影响)、选择 GitHub 特定标签版本的原因,以及对运行时兼容性的评估结果。

建议项 (Suggestions)

  1. ci_gate.sh 子命令的文档说明:

    • 定位: .github/workflows/ci.yml 中新的 CI 步骤 (Python syntax check 等)。
    • 建议: ci.ymlci_gate.sh 的执行分解为多个独立的子命令(syntax, flake8, deterministic, offline-tests),这显著提高了 CI 流程的粒度。为了方便其他开发者理解和本地调试,建议在 scripts/ci_gate.sh 脚本内部添加简单的帮助信息(例如,当不带参数或带 --help 参数运行时显示用法),或者在相关文档中简要说明这些子命令的作用。
  2. 考虑 requirements-ci.txtrequirements.txt 的联动性:

    • 建议: 既然 CI 依赖现在集中到 requirements-ci.txt,并且 requirements.txt 仍然是后端运行时依赖的源头,可以考虑在 requirements-ci.txt 中通过 -r requirements.txt 的方式引用运行时依赖,避免重复定义,并确保 CI 环境包含所有运行时依赖。这是一种常见实践,可以减少维护成本。

💡 提示: 请确保代码已通过本地测试,并遵循项目代码规范。

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes the backend CI dependency installation by consolidating backend runtime + CI tooling installs into a single requirements entrypoint, avoiding a duplicated pip install path that was intermittently terminated in GitHub Actions.

Changes:

  • Add requirements-ci.txt to centralize backend CI dependencies (includes requirements.txt + flake8/pytest).
  • Update .github/workflows/ci.yml to install from requirements-ci.txt in a single pip invocation.
  • Expand actions/setup-python pip cache key inputs to include both requirements.txt and requirements-ci.txt.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
requirements-ci.txt New CI requirements entrypoint that includes runtime deps plus backend-gate lint/test tooling.
.github/workflows/ci.yml Switches backend-gate to a single install step and updates pip cache dependency paths.

@ZhuLinsen ZhuLinsen merged commit c00dff1 into main Mar 24, 2026
10 checks passed
zhouruikevin pushed a commit to zhouruikevin/daily_stock_analysis that referenced this pull request Mar 25, 2026
* fix: stabilize backend ci dependency install

* fix: split backend gate workflow phases

* fix: retry backend ci dependency install

* fix: install litellm from github source
Copilot AI pushed a commit to qingdaoqin/daily_stock_analysis that referenced this pull request Apr 10, 2026
* fix: stabilize backend ci dependency install

* fix: split backend gate workflow phases

* fix: retry backend ci dependency install

* fix: install litellm from github source
Co-authored-by: qingdaoqin <43225158+qingdaoqin@users.noreply.github.com>
yangshiyan pushed a commit to yangshiyan/daily_stock_analysis that referenced this pull request Apr 20, 2026
* fix: stabilize backend ci dependency install

* fix: split backend gate workflow phases

* fix: retry backend ci dependency install

* fix: install litellm from github source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants