fix: 统一 AgentRun threadId 连续性

This commit is contained in:
Codex
2026-06-02 10:15:58 +08:00
parent a6f7581b96
commit 2cce4c2777
7 changed files with 60 additions and 44 deletions
@@ -107,6 +107,7 @@ HWLAB v0.2 原有 Code Agent 已经验证了 profile、session、workspace 和 S
- P0 允许 `sessionRef=null`,表示不持久化 backend session 文件。
- 面向 HWLAB v0.2 原有长会话能力,SessionRef 是承接 Code Agent thread 复用的核心字段:需要支持 `conversationId/sessionId/threadId` 到 backend session identity 的稳定映射。
- thread 复用只认标准 `threadId`:单个 command 显式提供 `payload.threadId` 时优先使用,否则使用 `SessionRef.threadId`。协议字段、events、result 和 session record 都以该字段为唯一 thread identity;缺失标准 `threadId` 就按新 thread 启动并在 result/sessionRef 中回写标准字段。
- 一旦启用 session,必须只保存 backend session/cache,不保存 API KEY、`auth.json``config.toml` 或完整 `CODEX_HOME`
- session 文件目录必须和 profile credential、Git workspace 分开。
- runner 启动时,有 SessionRef 则执行 `thread/resume`,没有 SessionRef 则执行 `thread/start`;profile 切换不得复用另一 profile 的 session。