Skip to content

fix(session): 在任务结果保存后写入归档完成标记 - #6153

Merged
qin-ctx merged 1 commit into
volcengine:mainfrom
qin-ptr:fix/session-done-after-result
Oct 16, 2026
Merged

qin-ctx merged 1 commit into
volcengine:mainfrom
qin-ptr:fix/session-done-after-result

Conversation

@qin-ptr

@qin-ptr qin-ptr commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Description

Session 抽取完成后,当前先写归档 .done,再保存任务结果。如果保存结果失败,同一个异常分支又会写 .failed.json,造成归档显示成功、任务显示失败。

将现有 .done 写入块移到 tracker.complete() 之后。当前队列工作仍未结清时,tracker.complete() 只登记结果,任务最终状态仍由队列确认流程收尾。

同一个“抽取完成后保存任务结果失败”的场景:

修改前 修改后
归档标记 .done 和 .failed.json 同时存在 仅 .failed.json
归档状态 completed failed
任务状态 failed failed

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

关联 #6078,修复任务结果登记失败导致归档双标记的路径。

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

仅移动 _run_memory_extraction 中现有完成标记的写入位置,让任务结果构造、保存都先于 .done。

Testing

  • I have added tests that prove my fix is effective or that my feature works

  • New and existing unit tests pass locally with my changes

  • I have tested this on the following platforms:

    • Linux
    • macOS
    • Windows
  • 现有 commit resume、task-work contract、SessionCommit processor 测试共 28 项通过。

  • 使用实际 Session、NamedQueue、任务中间件、TaskTracker 和 PersistentTaskStore,配合内存存储传输层做故障注入对照:旧顺序可重现双标记;新顺序下结果保存失败、.done 写入失败均只留下失败标记,任务最终失败;正常路径最终成功。

  • 验证写 .done 时和队列确认前,任务仍为 running,没有提前宣告完成。

  • Ruff check、format check 和 diff check 通过。未新增或修改测试文件。

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

不适用。

Additional Notes

Diff 为原有 14 行代码的位置移动,净增 0 行,没有新增分支或状态。

Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
@qin-ctx
qin-ctx merged commit 015aa74 into volcengine:main Oct 16, 2026
8 of 9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Oct 16, 2026
OnePerson2020 pushed a commit to OnePerson2020/OpenViking that referenced this pull request Oct 16, 2026
…ne#6153, upgrade notes for main 2026-10-16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OnePerson2020 pushed a commit to OnePerson2020/OpenViking that referenced this pull request Oct 16, 2026
…ine#6153)

Cherry-pick of volcengine#6153 (merged 2026-10-16, replaces our
closed volcengine#6080). A failure saving the task result used to leave .done next to a
failed task. .done still lands before the queue work is released, so
_can_run_archive's predecessor re-check is unaffected. Test fails on the
previous order. Drop on the next upgrade past volcengine#6153.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OnePerson2020 pushed a commit to OnePerson2020/OpenViking that referenced this pull request Oct 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OnePerson2020 pushed a commit to OnePerson2020/OpenViking that referenced this pull request Oct 16, 2026
Editing tests/session/test_session_commit.py pulled the whole file into the
deploy gate, where 3 of its tests (unchanged upstream) spend ~250 s each in
teardown next to the other gate files and test_commit_multiple_times then
times out (alone the file runs in 26 s). The regression test now lives in
test_session_done_marker.py; drop it with the volcengine#6153 cherry-pick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OnePerson2020 pushed a commit to OnePerson2020/OpenViking that referenced this pull request Oct 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qin-ctx added a commit that referenced this pull request Oct 16, 2026
Co-authored-by: qin-ptr <222410531+qin-ptr@users.noreply.github.com>
Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
(cherry picked from commit 015aa74)
qin-ctx added a commit that referenced this pull request Oct 19, 2026
Co-authored-by: qin-ptr <222410531+qin-ptr@users.noreply.github.com>
Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
(cherry picked from commit 015aa74)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants