Skip to content

fix(BetterGI): 执行层运行也留下运行记录,避免整轮结果误显示为未开始运行 - #765

Open
TCddddd wants to merge 2 commits into
AUTO-MAS-Project:devfrom
TCddddd:fix/bettergi-execution-log-record
Open

TCddddd wants to merge 2 commits into
AUTO-MAS-Project:devfrom
TCddddd:fix/bettergi-execution-log-record

Conversation

@TCddddd

@TCddddd TCddddd commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

摘要

  • 修复经执行层(--startGroups 直连 BetterGI)完成战斗/自定义项后,整轮结果误显示为「未开始运行」的问题:任务实际已跑完并且被判成功,但 MAS 侧没有留下任何运行记录。
  • 连带修复因记录缺失而失效的三处:不写历史日志(history/ 下无 json/log)、不发「统计信息」通知、分步报告与掉落统计无数据可解析;执行层阶段崩溃时的异常写入与「运行异常」通知现在也能生效。
  • 覆盖 _run_plan_combat(战斗 4 项)与 _run_plan_custom(自定义项)两条执行层路径;原生一条龙随后仍会另开一条记录,结果形如「执行层 | 一条龙」两段。
  • 属用户可见变更,已按 changelog.d/ 规范登记碎片。

验证:py_compile 通过;pytest tests/task/test_bettergi_one_dragon_read_failure.py 4 passed;python scripts/changelog.py check 通过。实机验证待补——本机复现那次运行(2026-09-14 20:52,执行层跑完地脉花/首领讨伐/秘境,history/2026-09-14/新用户/ 为空)发生在本修复之前。

Summary by Sourcery

为 BetterGI 执行层运行补充完整的运行记录,确保结果、统计信息和异常状态能够正确落盘并展示。

Bug Fixes:

  • 修复 BetterGI 执行层完成战斗或自定义项后因缺少运行记录而显示为“未开始运行”的问题。
  • 恢复执行层运行的历史日志、统计通知、分步报告和掉落统计,并确保执行异常能够记录并触发异常通知。

Enhancements:

  • 统一执行层战斗与自定义项的运行记录及成功、失败状态管理。

Chores:

  • 新增 BetterGI 执行层运行记录问题的变更日志。
Original summary in English

Summary by Sourcery

为 BetterGI 执行层运行补充完整的运行记录,确保结果、统计信息和异常状态能够正确落盘并展示。

Bug Fixes:

  • 修复 BetterGI 执行层完成战斗或自定义项后因缺少运行记录而显示为“未开始运行”的问题。
  • 恢复执行层运行的历史日志、统计通知、分步报告和掉落统计,并确保执行异常能够记录并触发异常通知。

Enhancements:

  • 统一执行层战斗与自定义项的运行记录及成功、失败状态管理。

Chores:

  • 新增 BetterGI 执行层运行记录问题的变更日志。

路径 B 执行层(--startGroups)跑完战斗后不写 log_record,该用户这次运行在 MAS 侧
便没有任何记录:结果列显示「未开始运行」、不写历史日志(statistic_paths 为空使
「统计信息」通知整块跳过)、分步报告与掉落统计也拿不到数据。

改为执行层启动时新建 log_record 并把执行层日志写进去,收尾按成败写入状态
(成功用项目契约 "Success!",失败写具体原因);同时把 log_start_time / cur_user_log
指向它,让执行层阶段的 on_crash 异常写入与「运行异常」通知也能生效。
原生一条龙随后仍会另开一条记录,结果形如「执行层 | 一条龙」两段。

验证:py_compile 通过;pytest tests/task/test_bettergi_one_dragon_read_failure.py
通过(4 passed)。本机未做实机验证。
_run_plan_custom 与 _run_plan_combat 同形态:跑完 BetterGI 同样不写 log_record。
自定义项由执行层单独跑完、原生一条龙又无启用任务时,会出现同一组症状:
整轮结果显示「未开始运行」、不写历史日志、不发统计通知、掉落统计无数据。

按同一口径补上:启动时新建 log_record 并把执行层日志写进去,收尾按成败写入状态
(成功用项目契约 "Success!",失败写具体原因),并把 log_start_time / cur_user_log
指向它,使执行层阶段的 on_crash 异常写入与「运行异常」通知也能生效。
未物化出任何自定义配置组(没有自定义项要跑)时仍不建记录。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @TCddddd, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 18 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown

审查者指南

修复 BetterGI 通过 --startGroups 执行层完成任务后 MAS 缺少运行记录的问题:战斗和自定义项路径现在都会创建、更新并正确收尾 LogRecord,使整轮结果、历史日志、统计通知、分步报告、掉落统计及异常通知恢复正常;原生一条龙仍会随后使用独立记录。

BetterGI 执行层运行记录时序图

sequenceDiagram
    participant AutoProxy
    participant BetterGI
    participant LogMonitor
    participant LogRecord
    participant MAS

    AutoProxy->>LogRecord: create LogRecord()
    AutoProxy->>MAS: store cur_user_item.log_record
    AutoProxy->>BetterGI: execute --startGroups
    BetterGI-->>LogMonitor: emit execution logs
    LogMonitor->>AutoProxy: on_log(log_content)
    AutoProxy->>LogRecord: update content
    alt completion marker
        AutoProxy->>LogRecord: set status Success!
    else fatal log, process exit, timeout, or exception
        AutoProxy->>LogRecord: set failure status
    end
    MAS->>LogRecord: read run record
    MAS-->>MAS: write history, statistics, reports, and notifications
Loading

BetterGI 执行层与原生运行记录流程图

flowchart LR
    Start["BetterGI --startGroups"] --> Path{Execution path}
    Path --> Combat["_run_plan_combat"]
    Path --> Custom["_run_plan_custom"]
    Combat --> Record["Create and update LogRecord"]
    Custom --> Record
    Record --> Finish["Set status: Success! or failure reason"]
    Finish --> MAS["MAS result, history, statistics, reports"]
    Finish --> Native["Native one-dragon run"]
    Native --> Separate["Separate LogRecord"]
Loading

文件级变更

变更 详情 文件
为 BetterGI 执行层战斗路径建立并维护完整的运行记录。
  • 在执行层启动时创建 LogRecord,并设为当前记录。
  • 持续写入执行层日志内容,供历史日志、统计通知、分步报告和掉落统计消费。
  • 统一记录成功状态为 Success!,并为致命日志、进程退出、空闲超时及异常保存可读失败原因。
  • 处理配置组生成失败时写入记录内容和失败状态,避免失败原因被空日志覆盖。
app/task/BetterGI/AutoProxy.py
为 BetterGI 自定义项执行层补齐与战斗路径一致的运行记录和异常收尾机制。
  • 无自定义配置组时不创建空运行记录。
  • 为自定义项执行创建独立记录并同步当前记录引用。
  • 写入执行日志及成功或具体失败状态,支持异常通知和后续统计处理。
app/task/BetterGI/AutoProxy.py
登记用户可见的问题修复。
  • 新增 changelog 条目,说明执行层完成后恢复整轮结果、历史日志和统计报告生成。
changelog.d/fix-bettergi-execution-log-record.fix.md

提示和命令

与 Sourcery 交互

  • 触发新的审查: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 根据审查评论生成 GitHub issue: 回复审查评论,要求 Sourcery 根据该评论创建 issue。你也可以回复审查评论并使用 @sourcery-ai issue,根据该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任意位置写入 @sourcery-ai summary,即可在指定位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,随时(重新)生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这项功能非常有用。
  • 忽略所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想通过新的审查重新开始,这项功能尤其有用——别忘了评论 @sourcery-ai review 来触发新的审查!

自定义你的使用体验

访问你的控制面板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

修复 BetterGI 通过 --startGroups 执行层完成任务后 MAS 缺少运行记录的问题:战斗和自定义项路径现在都会创建、更新并正确收尾 LogRecord,使整轮结果、历史日志、统计通知、分步报告、掉落统计及异常通知恢复正常;原生一条龙仍会随后使用独立记录。

Sequence diagram for BetterGI execution-layer run recording

sequenceDiagram
    participant AutoProxy
    participant BetterGI
    participant LogMonitor
    participant LogRecord
    participant MAS

    AutoProxy->>LogRecord: create LogRecord()
    AutoProxy->>MAS: store cur_user_item.log_record
    AutoProxy->>BetterGI: execute --startGroups
    BetterGI-->>LogMonitor: emit execution logs
    LogMonitor->>AutoProxy: on_log(log_content)
    AutoProxy->>LogRecord: update content
    alt completion marker
        AutoProxy->>LogRecord: set status Success!
    else fatal log, process exit, timeout, or exception
        AutoProxy->>LogRecord: set failure status
    end
    MAS->>LogRecord: read run record
    MAS-->>MAS: write history, statistics, reports, and notifications
Loading

Flow diagram for BetterGI execution-layer and native run records

flowchart LR
    Start["BetterGI --startGroups"] --> Path{Execution path}
    Path --> Combat["_run_plan_combat"]
    Path --> Custom["_run_plan_custom"]
    Combat --> Record["Create and update LogRecord"]
    Custom --> Record
    Record --> Finish["Set status: Success! or failure reason"]
    Finish --> MAS["MAS result, history, statistics, reports"]
    Finish --> Native["Native one-dragon run"]
    Native --> Separate["Separate LogRecord"]
Loading

File-Level Changes

Change Details Files
为 BetterGI 执行层战斗路径建立并维护完整的运行记录。
  • 在执行层启动时创建 LogRecord,并设为当前记录。
  • 持续写入执行层日志内容,供历史日志、统计通知、分步报告和掉落统计消费。
  • 统一记录成功状态为 Success!,并为致命日志、进程退出、空闲超时及异常保存可读失败原因。
  • 处理配置组生成失败时写入记录内容和失败状态,避免失败原因被空日志覆盖。
app/task/BetterGI/AutoProxy.py
为 BetterGI 自定义项执行层补齐与战斗路径一致的运行记录和异常收尾机制。
  • 无自定义配置组时不创建空运行记录。
  • 为自定义项执行创建独立记录并同步当前记录引用。
  • 写入执行日志及成功或具体失败状态,支持异常通知和后续统计处理。
app/task/BetterGI/AutoProxy.py
登记用户可见的问题修复。
  • 新增 changelog 条目,说明执行层完成后恢复整轮结果、历史日志和统计报告生成。
changelog.d/fix-bettergi-execution-log-record.fix.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant