fix(agent): populate userId in agent workflow chat task payloads

This commit is contained in:
yiling
2026-05-30 18:42:55 +08:00
parent 64bdccaa8a
commit 2362d050a4
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -907,6 +907,7 @@ describe('AssetService', () => {
expect(p1?.agent?.agentId).toBe(agent.id)
expect(p1?.agent?.sessionId).toBeUndefined()
expect(p1?.agent?.explicitMention).toBe(true)
expect(p1?.agent?.userId).toBe(user.id)
// Rule 2: user mentions agent in reply, and root is not an agent comment
const reply1 = await assetService.createComment({
@@ -925,6 +926,7 @@ describe('AssetService', () => {
expect(p2?.agent?.agentId).toBe(agent.id)
expect(p2?.agent?.sessionId).toBeUndefined()
expect(p2?.agent?.explicitMention).toBe(true)
expect(p2?.agent?.userId).toBe(user.id)
// Create a root user comment
const userRoot = await prisma.assetComment.create({
@@ -981,6 +983,7 @@ describe('AssetService', () => {
expect(p3a?.agent?.agentId).toBe(botUser.id)
expect(p3a?.agent?.sessionId).toBe('test-session-rule3')
expect(p3a?.agent?.explicitMention).toBe(false)
expect(p3a?.agent?.userId).toBe(user.id)
// Rule 3b: any user creates a reply directly to the agent comment, explicitly mentions agent
const reply3b = await assetService.createComment({
@@ -1008,6 +1011,7 @@ describe('AssetService', () => {
expect(p3b?.agent?.agentId).toBe(botUser.id)
expect(p3b?.agent?.sessionId).toBe('test-session-rule3')
expect(p3b?.agent?.explicitMention).toBe(true)
expect(p3b?.agent?.userId).toBe(user.id)
})
it('updates asset order correctly', async () => {
+2
View File
@@ -1280,6 +1280,7 @@ export class AssetService {
agentId: rootAgentId,
sessionId: rootSessionId || undefined,
explicitMention,
userId: req.userId,
},
},
},
@@ -1314,6 +1315,7 @@ export class AssetService {
userCommentId: comment.id,
agentId: agentId,
explicitMention: true,
userId: req.userId,
},
},
},