Skip to content

fix(dispatch): 孤儿恢复重建失败回滚认领,消除任务滞留 dispatched 静默丢失 - #2198

Merged
DeliciousBuding merged 1 commit into
masterfrom
fix/orphan-recovery-rollback
Sep 1, 2026
Merged

fix(dispatch): 孤儿恢复重建失败回滚认领,消除任务滞留 dispatched 静默丢失#2198
DeliciousBuding merged 1 commit into
masterfrom
fix/orphan-recovery-rollback

Conversation

@DeliciousBuding

Copy link
Copy Markdown
Collaborator

缺陷(#2154 Ampere P2-1)

ClaimOrphanedTasks 先将任务 queued→dispatched 独立提交,随后 redeliverOrphanedTask 的三处上下文重建失败(task / trigger message / agent-instance 加载)裸 return,无状态回滚。任务遂滞留 dispatched 且无 outbox 行:

  • claim 谓词只认 status='queued' → sweeper 永不重新认领
  • outbox sweeper 无行可扫
  • 只能等 TTL scanner 超时 → 工作被静默丢失

修复

  • repository.RequeueClaimedOrphanTask:条件 CAS 回滚 dispatched→queued;已流转(running/done/failed)任务绝不被误改。
  • redeliverOrphanedTask 三处失败路径补 rollbackOrphanClaim(日志 + 计数)。
  • 新增指标 agenthub_dispatch_orphan_claim_rolled_back_total

证据

  • L0:单测 4 项,含缺陷回归(重建失败→回滚 queued→下轮可重新认领);make test 全绿(MAKE_TEST_EXIT=0,无 FAIL 行)
  • L1:真 PG16 集成 5/5(含新增回滚 + 防误改 2 项)
  • 6 项 verifier(doc-ssot / ci-gates / i18n-deadkeys / openapi-contract / migration-idempotency / i18n-terminology)+ git diff --check 全过
  • migrations 数不变(72)

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 05f30692-0fb8-456c-922a-2f83006a915e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- ClaimOrphanedTasks 已将任务 queued→dispatched 独立提交,但
  redeliverOrphanedTask 三处上下文重建失败(task/message/agent-instance
  加载)裸 return,任务滞留 dispatched 且无 outbox 行,claim 谓词只认
  queued,只能等 TTL 超时静默丢失(#2154 Ampere P2-1)。
- 新增 repository.RequeueClaimedOrphanTask:条件 CAS 回滚
  (dispatched→queued),已流转任务绝不被误改。
- 新增指标 agenthub_dispatch_orphan_claim_rolled_back_total。
- 单测 4 项(含缺陷回归:重建失败→回滚→下轮可重新认领)+ PG16 集成 2 项。

Co-authored-by: Cursor <cursor@vectorcontrol.tech>
@DeliciousBuding
DeliciousBuding force-pushed the fix/orphan-recovery-rollback branch from 117c703 to 80fb27d Compare September 1, 2026 22:47
@DeliciousBuding
DeliciousBuding merged commit 30b67ab into master Sep 1, 2026
39 checks passed
@DeliciousBuding
DeliciousBuding deleted the fix/orphan-recovery-rollback branch September 1, 2026 22:55
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