Skip to content

fix: clean leftover merge conflict markers on dev#7203

Closed
zhuanggenhua wants to merge 3 commits intoAstrBotDevs:devfrom
zhuanggenhua:fix/dev-merge-conflict-cleanup
Closed

fix: clean leftover merge conflict markers on dev#7203
zhuanggenhua wants to merge 3 commits intoAstrBotDevs:devfrom
zhuanggenhua:fix/dev-merge-conflict-cleanup

Conversation

@zhuanggenhua
Copy link
Copy Markdown

@zhuanggenhua zhuanggenhua commented Mar 30, 2026

dev 分支残留冲突修复留案(2026-03-30)

背景

  • 近期多个 PR 对 dev 分支的检查失败,表现为 Unit TestsSmoke Test 在 Python import 阶段直接报 SyntaxError
  • 失败日志显示 astrbot/dashboard/server.pyastrbot/core/provider/sources/gemini_source.py 中存在残留的 Git conflict markers。
  • 本次留案目标:记录冲突来源、两侧差异、合并原则、最终取舍与验证方式,避免只在对话里口头说明。

受影响文件

  1. astrbot/dashboard/server.py
  2. astrbot/core/provider/sources/gemini_source.py

冲突来源定位

  • dev 分支头包含残留冲突标记。
  • 重点可疑 merge 提交:
    • efa999c2merge: origin/master into dev
    • 1faeee37merge: pull latest master into dev
  • 其中 server.py 不只是残留标记,还混入了重复 run()、同步/异步签名错位、await 位置错误等二次损伤。

合并原则

  1. 必须留案:每个冲突文件都记录来源、两侧差异、合并理由。
  2. 优先合并两侧逻辑:能兼容就不回滚;仅在局部明显损坏且无法安全拼接时,才退回较稳的一侧。
  3. 最小修复范围:本次只修复阻塞 CI 的冲突与因冲突导致的语法/结构损坏,不顺手做无关重构。
  4. 保留可验证证据:至少保留语法校验与差异说明;后续补充 CI 运行结果。

文件一:astrbot/core/provider/sources/gemini_source.py

冲突形态

  • candidate.content 为空分支前残留 <<<<<<< HEAD
  • candidate.content.parts 为空分支前残留 <<<<<<< HEAD

两侧逻辑对比

  • 两边实质逻辑接近,核心差异不在业务行为,而在是否残留冲突文本。
  • 较新的版本使用 EmptyModelOutputError,错误语义更清晰。

最终合并结果

  • 保留 EmptyModelOutputError 分支处理。
  • 删除所有 conflict markers。
  • 不扩展其它 Gemini 行为变更。

合并理由

  • 两侧不存在明显互斥功能,属于“同一逻辑 + 脏标记”型冲突。
  • 选择保留更明确的异常类型,同时维持最小修改面。

文件二:astrbot/dashboard/server.py

冲突形态

  • 残留 <<<<<<< HEAD / >>>>>>> origin/master
  • 文件被错误拼接后出现:
    • 重复 run() 实现
    • 同步 def run(self) 与异步 async def run(self) 混杂
    • await serve(...) 落在同步函数上下文中
    • 两套 SSL 配置路径处理逻辑互相覆盖

两侧逻辑对比

dev 侧(旧 async 版本)保留的能力

  • async def run(self) + await serve(...)
  • IPv6 / 多 bind 处理:_build_bind()
  • WebUI + API / API Server 两种启动提示
  • 端口占用检查更细,按 host127.0.0.1 检查
  • _print_access_urls() 统一输出本地/网络访问地址
  • 通过 _resolve_dashboard_value() 支持配置值中的环境变量占位符

master 侧(被 merge 进来的版本)新增/增强的能力

  • _resolve_dashboard_ssl_config() 把 SSL 文件校验抽成独立方法
  • 支持 DASHBOARD_SSL_* / ASTRBOT_DASHBOARD_SSL_* 这类更明确的环境变量命名
  • 当 SSL 文件不存在时,采用 warning + 降级失效,而不是直接在运行期抛异常

最终合并结果

本次不再简单回滚为 dev 侧,而是采用合并版

  • dev 侧 async run / bind / 访问地址输出 为主干;
  • 引入并保留 master 侧 _resolve_dashboard_ssl_config() 思路;
  • 在该方法中同时兼容:
    • DASHBOARD_SSL_*
    • ASTRBOT_DASHBOARD_SSL_*
    • ASTRBOT_SSL_*
  • 继续保留 _resolve_dashboard_value(),确保 SSL 路径仍支持占位符展开;
  • run() 中不再手写三段证书路径解析,而是调用统一 helper 生成 resolved_ssl_config
  • ssl_enable 读取兼容:
    • DASHBOARD_SSL_ENABLE
    • ASTRBOT_DASHBOARD_SSL_ENABLE
    • ASTRBOT_SSL_ENABLE

合并理由

  • 用户要求“尽可能合并两者,而不是回滚”;该文件确实存在可兼容空间。
  • dev 侧主干更符合当前类的 async 结构与访问地址展示逻辑。
  • master 侧 SSL helper 属于结构化增强,值得吸收。
  • 将两边优势合并后,可以同时保住:
    • 当前 async/多 bind 运行方式
    • 新的 SSL 环境变量与降级策略

验证

已完成

  • 清理冲突标记后执行:
    • python -m py_compile astrbot/dashboard/server.py astrbot/core/provider/sources/gemini_source.py

待补充

  • 维护者批准 fork PR 的 GitHub Actions 后,补充:
    • Unit Tests
    • Smoke Test
      的实际结果
  • 如需完全对齐仓库开发规范,还应补跑:
    • uv run ruff format .
    • uv run ruff check .

PR / 分支信息

后续动作

  1. 将本留案摘要同步进 PR 描述,避免 reviewer 只能从 diff 猜原因。
  2. 待 Actions 获批后观察 CI 是否恢复。
  3. 若 CI 仍失败,再按新报错继续追加留案,而不是覆盖旧记录。

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 30, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot bot added area:core The bug / feature is about astrbot's core, backend area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. area:webui The bug / feature is about webui(dashboard) of astrbot. labels Mar 30, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes merge conflict markers and redundant code from gemini_source.py and server.py. It specifically cleans up duplicate method definitions and logic related to SSL configuration in the dashboard server. I have no feedback to provide.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Mar 30, 2026
@zhuanggenhua
Copy link
Copy Markdown
Author

Closing this PR because it was created against the wrong project during an assistant context-mixup. We will restart from the correct tabletop project.

@zhuanggenhua zhuanggenhua deleted the fix/dev-merge-conflict-cleanup branch March 31, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. area:webui The bug / feature is about webui(dashboard) of astrbot. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant