Skip to content

fix(session): 将任务登记移出 session 归档锁 - #6175

Merged
qin-ctx merged 1 commit into
volcengine:mainfrom
qin-ptr:fix/session-task-registration-main
Oct 16, 2026
Merged

qin-ctx merged 1 commit into
volcengine:mainfrom
qin-ptr:fix/session-task-registration-main

Conversation

@qin-ptr

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

Copy link
Copy Markdown
Contributor

Description

commit 在持有 session 锁时等待 TaskStore 查询和创建记录,会把任务存储延迟扩散到同一 session 的删除操作。

Before: 同一 session 的 commit 卡在 TaskStore.create 时,DELETE 因目录树锁冲突返回 409。

After: 先完成归档、入队和 ready 发布并解锁,再等待任务登记。相同场景下 DELETE 可以返回 200;commit 仍需等任务登记成功后才返回 accepted。

登记失败不回滚已发布的归档,错误 details 保留 task_id、archive_uri、archived=true 和 stage=task_tracker_create。

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

无关联 Issue。

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

  • 将请求侧任务登记移到 session 解锁后,复用现有错误映射保留归档结果。
  • 消费者先确认任务记录,再执行 Phase 2;登记失败不 ACK,普通处理异常继续记录为终止失败。
  • 改写现有契约测试并删除重复脚手架,覆盖锁释放、登记失败保留归档、消费者失败分类及队列取消。

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

55 项相关测试通过,覆盖 Phase 1 发布、SessionCommit 消费者、恢复执行、任务队列中间件和 NamedQueue 的异常/ACK 行为。相对 main,测试代码净减少 6 行;未新增测试文件、函数或参数化 Case。

Ruff、改动范围格式检查、git 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

已变基到 013e988bb 并解决测试冲突。#6136 改变的任务入队契约仍有独立问题:普通 session commit 可在入队阶段触发 TaskWorkRejected: work is missing owner metadata,新契约还要求任务记录预先存在。本 PR 保持显式任务登记的锁范围调整,不扩展修改任务入口与可靠投递协议。

先合入 main,再将 main 提交 cherry-pick 到 codex/v0.4.20-hotfix-work(回补 PR:#6173)。生产代码净增 13 行;队列入队仍在 session 锁内,本次不调整可靠投递协议。

@qin-ctx
qin-ctx marked this pull request as ready for review October 16, 2026 10:59
Keep task-store latency outside the session critical section. Register queued
commits before processing so registration failures preserve recovery work and
ordinary Phase-2 failures retain their terminal outcome.

Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
@qin-ptr
qin-ptr force-pushed the fix/session-task-registration-main branch from b7d00c5 to aa549c6 Compare October 16, 2026 11:02
@qin-ctx
qin-ctx merged commit 7c34e43 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
qin-ptr added a commit to qin-ptr/OpenViking that referenced this pull request Oct 16, 2026
…ne#6175)

Keep task-store latency outside the session critical section. Register queued
commits before processing so registration failures preserve recovery work and
ordinary Phase-2 failures retain their terminal outcome.

(cherry picked from commit 7c34e43)

Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
qin-ctx added a commit that referenced this pull request Oct 16, 2026
…6173)

Keep task-store latency outside the session critical section. Register queued
commits before processing so registration failures preserve recovery work and
ordinary Phase-2 failures retain their terminal outcome.

(cherry picked from commit 7c34e43)

Co-authored-by: qin-ptr <222410531+qin-ptr@users.noreply.github.com>
Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
qin-ctx added a commit that referenced this pull request Oct 19, 2026
Keep task-store latency outside the session critical section. Register queued
commits before processing so registration failures preserve recovery work and
ordinary Phase-2 failures retain their terminal outcome.

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 7c34e43)
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