Skip to content

fix(session): 回补任务登记锁范围修复 (#6175) - #6173

Merged
qin-ctx merged 1 commit into
volcengine:codex/v0.4.20-hotfix-workfrom
qin-ptr:fix/session-task-registration-lock
Oct 16, 2026
Merged

qin-ctx merged 1 commit into
volcengine:codex/v0.4.20-hotfix-workfrom
qin-ptr:fix/session-task-registration-lock

Conversation

@qin-ptr

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

Copy link
Copy Markdown
Contributor

Description

从已合入 main 的 #6175 回补提交 7c34e43c53757d35644ce8d2eb31c4c99e057749。

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

17 项聚焦测试通过,包含 test_fail_task、test_phase1_publishes_and_unlocks_before_task_registration、test_session_commit_resume.py 和 test_session_commit_processor_identity.py。仅修改已有测试,未新增测试文件、函数或参数化 Case;相对回补基线,测试代码净增 0 行。

真实存储与 native 锁复现确认:TaskStore 查询或创建阻塞期间删除成功;登记失败保留 ready 归档和队列消息。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

回补到 codex/v0.4.20-hotfix-work,适配旧分支的队列回调接口;消费者失败契约由已有 TaskTracker 测试覆盖。生产代码净增 13 行、测试净增 0 行;队列入队仍在 session 锁内,本次不调整可靠投递协议。

…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-ptr
qin-ptr force-pushed the fix/session-task-registration-lock branch from 61245c8 to 7bfc0a3 Compare October 16, 2026 11:18
@qin-ptr qin-ptr changed the title fix(session): 将任务登记移出 session 归档锁 fix(session): 回补任务登记锁范围修复 (#6175) Oct 16, 2026
@qin-ctx
qin-ctx merged commit 0cb907c into volcengine:codex/v0.4.20-hotfix-work Oct 16, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Oct 16, 2026
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