Skip to content

fix: 修复 jumpback 和 anchor 混用时的问题#1163

Merged
MistEO merged 1 commit intomainfrom
fix/anchor
Mar 2, 2026
Merged

fix: 修复 jumpback 和 anchor 混用时的问题#1163
MistEO merged 1 commit intomainfrom
fix/anchor

Conversation

@MistEO
Copy link
Member

@MistEO MistEO commented Mar 1, 2026

fix #1162

Summary by Sourcery

调整流水线任务节点的处理方式,使其能够在与锚点(anchor)更新相互独立的情况下确定并传递回跳(jump-back)行为,从而修复在同时使用 jump_backanchor 时出现的不正确行为。

Bug Fixes:

  • 修复当在流水线节点中同时使用 jump_backanchor 配置时,对回跳行为处理不正确的问题。

Enhancements:

  • 通过 NodeDetail 结果传递 jump_back 状态,使下游处理能够感知并基于回跳决策进行相应处理。
Original summary in English

Summary by Sourcery

Adjust pipeline task node processing to determine and propagate jump-back behavior independently of anchor updates, fixing incorrect behavior when jump_back and anchor are used together.

Bug Fixes:

  • Fix incorrect jump-back handling when jump_back and anchor configurations are used together in pipeline nodes.

Enhancements:

  • Propagate jump_back status through NodeDetail results to make downstream processing aware of jump-back decisions.

Summary by Sourcery

通过将回跳(jump-back)解析与锚点(anchor)更新解耦,并通过节点执行结果传播回跳状态,修复在流水线任务与锚点一起使用时的不正确回跳处理问题。

Bug 修复:

  • 当同时使用 jump_back 和锚点配置时,纠正流水线节点的回跳行为。

增强功能:

  • 通过 NodeDetail 传播 jump_back 状态,使下游的流水线处理能够对回跳决策作出响应。
Original summary in English

Summary by Sourcery

Fix incorrect jump-back handling in pipeline tasks when used together with anchors by decoupling jump-back resolution from anchor updates and propagating jump-back state via node execution results.

Bug Fixes:

  • Correct jump-back behavior in pipeline nodes when both jump_back and anchor configurations are used simultaneously.

Enhancements:

  • Propagate jump_back status through NodeDetail so downstream pipeline processing can react to jump-back decisions.

@MistEO MistEO marked this pull request as ready for review March 1, 2026 09:06
Copilot AI review requested due to automatic review settings March 1, 2026 09:06
Copy link
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 - 我发现了 1 个问题,并给出了一些整体反馈:

  • NodeDetail 上新增的 jump_back 字段没有包含在 MEO_TOJSON 宏调用中,因此它的值不会被序列化;建议将其添加到该宏(以及对应的反序列化逻辑中,如果适用),以保持结果 schema 的一致性。
  • 基于 nextget_pipeline_data 来解析 jump_back 的逻辑现在位于 run_next 中,而 run 只消费传递过来的标志位;如果在其他地方也需要这段解析逻辑,建议将其提取到一个小的辅助函数中,以避免未来行为出现偏差。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `jump_back` field on `NodeDetail` is not included in the `MEO_TOJSON` macro call, so its value will not be serialized; consider adding it there (and to any corresponding deserialization, if applicable) to keep the result schema consistent.
- The logic to resolve `jump_back` based on `next` and `get_pipeline_data` now lives in `run_next` while `run` only consumes the propagated flag; if this resolution is needed elsewhere, consider extracting it into a small helper to avoid future drift in behavior.

## Individual Comments

### Comment 1
<location path="source/include/Common/TaskResultTypes.h" line_range="47-49" />
<code_context>
     MaaRecoId reco_id = MaaInvalidId;
     MaaActId action_id = MaaInvalidId;
     bool completed = false;
+    bool jump_back = false;

     MEO_TOJSON(node_id, name, reco_id, action_id, completed);
 };
</code_context>
<issue_to_address>
**issue (bug_risk):** Include `jump_back` in the serialization macro to keep JSON in sync with the struct

`jump_back` was added to `NodeDetail` but not to `MEO_TOJSON(...)`, so it won’t be included in JSON and the wire format will diverge from the struct. Please add `jump_back` to the macro arguments so JSON-based consumers stay consistent with the in-memory representation.
</issue_to_address>

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈持续改进代码评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The new jump_back field on NodeDetail is not included in the MEO_TOJSON macro call, so its value will not be serialized; consider adding it there (and to any corresponding deserialization, if applicable) to keep the result schema consistent.
  • The logic to resolve jump_back based on next and get_pipeline_data now lives in run_next while run only consumes the propagated flag; if this resolution is needed elsewhere, consider extracting it into a small helper to avoid future drift in behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `jump_back` field on `NodeDetail` is not included in the `MEO_TOJSON` macro call, so its value will not be serialized; consider adding it there (and to any corresponding deserialization, if applicable) to keep the result schema consistent.
- The logic to resolve `jump_back` based on `next` and `get_pipeline_data` now lives in `run_next` while `run` only consumes the propagated flag; if this resolution is needed elsewhere, consider extracting it into a small helper to avoid future drift in behavior.

## Individual Comments

### Comment 1
<location path="source/include/Common/TaskResultTypes.h" line_range="47-49" />
<code_context>
     MaaRecoId reco_id = MaaInvalidId;
     MaaActId action_id = MaaInvalidId;
     bool completed = false;
+    bool jump_back = false;

     MEO_TOJSON(node_id, name, reco_id, action_id, completed);
 };
</code_context>
<issue_to_address>
**issue (bug_risk):** Include `jump_back` in the serialization macro to keep JSON in sync with the struct

`jump_back` was added to `NodeDetail` but not to `MEO_TOJSON(...)`, so it won’t be included in JSON and the wire format will diverge from the struct. Please add `jump_back` to the macro arguments so JSON-based consumers stay consistent with the in-memory representation.
</issue_to_address>

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.

Copy link
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 fixes a bug (issue #1162) where using jump_back and anchor together in a pipeline node produced incorrect behavior. The root cause was that the old run() code re-resolved anchor references (to detect jump_back) after run_next() had already updated the anchor map — meaning the anchor lookup used stale/updated values, causing the wrong node to be matched as the jump-back source.

Changes:

  • jump_back detection is moved into run_next() and evaluated before the action (and before anchors are updated), ensuring the correct pre-update anchor state is used.
  • The jump_back result is propagated through NodeDetail so the caller (run()) can use it without repeating anchor lookups.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
source/include/Common/TaskResultTypes.h Adds jump_back field to NodeDetail struct to carry the jump-back decision from run_next() to its caller.
source/MaaFramework/Task/PipelineTask.cpp Moves jump_back resolution into run_next() before action execution/anchor update; simplifies run() to use node_detail.jump_back directly.

@MistEO MistEO merged commit 1807bf5 into main Mar 2, 2026
23 checks passed
@MistEO MistEO deleted the fix/anchor branch March 2, 2026 07:37
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.

anchor+jumpback无法按预期运行

2 participants