fix(hub): agent 会话记忆在配置变更/发版后丢失 + Feishu thread 400 (#19)

Co-authored-by: Hong Jiarong <me@jrhim.com>
Co-committed-by: Hong Jiarong <me@jrhim.com>
This commit is contained in:
2026-07-20 22:45:42 +08:00
committed by 洪佳荣
parent 5f668d71a2
commit 54b9fee22c
5 changed files with 85 additions and 21 deletions
@@ -43,7 +43,7 @@ describe("Organization Agent configuration management", () => {
provider: "openrouter",
roleId: "draft",
model: "anthropic/claude-sonnet-5",
metadata: {},
metadata: { claudeSessionId: "sdk-session-old", userResumable: true },
},
});
await configuration.setRoleSkills({
@@ -59,10 +59,12 @@ describe("Organization Agent configuration management", () => {
expect(role).toMatchObject({ label: "课程草稿", systemPrompt: "write carefully" });
expect(role.tools).toEqual(["read_file", "write_file", "cph_build"]);
expect(role.skillBindings.map((binding) => binding.skill.name)).toEqual(["outline", "typst"]);
// Execution-surface change invalidates the provider session cursor but
// keeps the Hub session alive so its transcript stays reachable.
await expect(prisma.agentSession.findUniqueOrThrow({ where: { id: "session-old-role-config" } }))
.resolves.toMatchObject({
archivedAt: expect.any(Date),
metadata: expect.objectContaining({ userResumable: false }),
archivedAt: null,
metadata: expect.objectContaining({ userResumable: false, claudeSessionId: undefined }),
});
});