Skip to content

[P1B][T09] 实现 Redis 统一租约与 Run/checkpoint 原子防旧 owner 提交 #7

Open

Description

@Aias00

目标

同一 owner/fence 保护运行进度与 checkpoint,消除独立 run lock 与 checkpoint lock 的分裂状态。

优先级与归属

范围与落地方案

  • 在新 opt-in adapter 中实现 claim/renew/release 与 run/checkpoint/journal/outbox 提交的能力契约。
  • Lua 校验 owner、fence、Redis 时间、run/checkpoint revision,并原子推进相关记录。
  • 复用现有租约语义而不假设旧 saver 已支持多记录事务;验证同 slot,部署不支持时启动拒绝。

前置依赖

验收条件

  • 两个 runId 同 session 只能由当前有效 owner 推进状态。
  • 过期旧 owner 的 heartbeat/release/run/checkpoint/journal/outbox 写入均被拒绝。
  • 模拟提交失败时没有半个 checkpoint 或半个 run 进度,也不调用 ownerless fallback。
  • crossSlotConfigFailsFast;说明异步 HA 回滚不是 consensus fencing,不承诺 RPO0。

非目标

  • 不重写历史 key 格式,不实现 global queue 跨 slot 事务,不实现外部系统事务。

兼容与验证约束

  • Java 17;新增路径显式启用,保留既有 API、默认行为、checkpoint/Store 格式及配置前缀。
  • Core 不引入 Redis/Extensions 依赖;存储实现归 Extensions,应用接线归可选运行层。
  • 首阶段无 MQ、整 Run Worker,不做节点分片,不承诺通用 exactly-once 或 Redis HA RPO0。
  • 先用模型无关单测/reference 验证本任务,再按范围运行现有 API/格式门禁;涉及 Redis 用真实存储测试,涉及接管用独立 JVM。

当前实现依据

分析基线:Core 6324f53、Extensions ed07835;AgentScope 参考 c95eb1f。本 Issue 是待完成任务,不代表能力已经实现。

Activity

  1. added theissue type on Oct 8, 2026
  2. added a commit that references this issue on Oct 18, 2026
  3. PoisonGodv commented on Oct 26, 2026

    @PoisonGodv
    Contributor

    Hi, I'd like to take T09, building on the Redis RunStore from T08 (#27).

    Rough plan:

    • Add a new opt-in adapter so the run lease (claim/renew/release) and checkpoint writes share one owner/fence. This replaces the separate run lock and checkpoint lock.
    • Use one Lua script per operation. Each script checks owner, fence, Redis TIME, and the run/checkpoint revision, then advances the run, checkpoint, journal and outbox together, or writes nothing.
    • Keep all keys of a session in one hash-tag slot and verify the slot at startup. A cross-slot or unsupported deployment fails fast (crossSlotConfigFailsFast). The existing RedisLeasedCheckpointSaver and its key format stay unchanged.
    • Tests against a real Redis via Testcontainers. Cover: two runIds in the same session, stale-owner heartbeat/release/run/checkpoint/journal/outbox writes being rejected, and an injected commit failure leaving no partial checkpoint or run progress with no ownerless fallback. The README will state that async HA failover is not consensus fencing and that RPO0 is not promised.

    Two questions before I start:

    1. refactor(persistence): target durable adapters at loop core #66 moved the Redis module onto argi-loop-core. Should T09 target the loop-core contracts, or is there a pending Core change for a unified lease/commit contract that I should wait for?
    2. Should the "independent JVM" takeover verification be part of this PR, or left to T13?

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority/important-soon高优先级:近期应安排处理的重要问题

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions