Define an atomic session lifecycle across storage and ACP caches
- 主要语言
- Rust
- 星标
- 54.2k
- 派生
- 6.2k
- 平均合并
- 3 天 4 小时
- 30 天内合并 PR
- 240
描述
**What problem would this solve?**
Session activation and teardown currently span three independently synchronized representations: the persisted session row, the `AgentManager` cache, and the ACP connection's active-session map. Session IDs can be reused after deletion, while agent construction and ACP registration can finish asynchronously after they began.
There is no single lifecycle contract that proves an agent being published still belongs to the current persisted row. Local fixes in one cache leave another publication boundary open, and cancellation or an uncertain delete result makes it unclear which in-memory state may safely be retained.
**What would a good outcome look like?**
Creation, activation, registration, teardown, and ID reuse obey one race-free lifecycle contract across persistence and every in-memory representation.
The design should specify:
- the immutable identity or generation that binds a persisted row to every cached or ACP-active agent
- how an activation proves that identity is still current at its final publication point
- how teardown fences new and in-flight creation before persistent mutation and remains active through all cache invalidation
- cancellation-safe cleanup when a request is dropped at any await point
- behavior after a confirmed delete failure versus an uncertain commit outcome
- how storage-only CLI operations and both agent-loop implementations participate without duplicating lifecycle rules
- compatibility and migration behavior for existing session IDs and persisted data
**Possible approaches**
- Make session IDs non-reusable so the public ID is also the durable lifecycle identity.
- Add an immutable row UUID or generation and propagate a lifecycle lease through agent construction and ACP registration.
- Introduce a transaction-scoped session lifecycle coordinator that owns persistence, manager-cache, and ACP-map publication/removal.
- Unify this identity with the authorization contract discussed in #11609 if one primitive can safely serve both concerns.
The accepted design should include deterministic creator/delete/recreate, delayed ACP registration, failed-delete, and cancellation interleavings.
**Additional context**
A focused synchronization attempt found that protecting only agent construction and the manager cache is insufficient: ACP registration is a later publication point, and restoring state by a reused ID cannot prove that it belongs to the same row. This needs an agreed cross-layer identity and transaction boundary before implementation continues.
- [x] I have verified this does not duplicate an existing feature request
Do not begin implementation until the issue reaches **Ready** on the [Goose Issues board](https://github.com/orgs/aaif-goose/projects/1).
贡献指南
调研方向
该 issue 描述了一个涉及 session persistence、caching 和 ACP registration 的横切设计问题。先检查 session storage layer、AgentManager cache,以及 ACP connection 的 active-session map。查找现有的 session ID handling 和 lifecycle management code。目标是定义统一的 contract,而不是实现某个具体 solution。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- backend, databases
- Issue 类型
- 重构
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100