@@ -167,6 +167,22 @@ function shouldImplicitlyReopenCommentForAgent(input: {
167167 return true ;
168168}
169169
170+ function isSelfAuthoredAssigneeComment ( input : {
171+ actorType : "agent" | "user" ;
172+ actorId : string ;
173+ assigneeAgentId : string | null | undefined ;
174+ runId : string | null ;
175+ executionRunId : string | null | undefined ;
176+ previousExecutionRunId ?: string | null | undefined ;
177+ } ) {
178+ if ( typeof input . assigneeAgentId !== "string" || input . assigneeAgentId . length === 0 ) return false ;
179+ if ( input . actorType === "agent" ) {
180+ return input . actorId === input . assigneeAgentId ;
181+ }
182+ return Boolean ( input . runId )
183+ && ( input . executionRunId === input . runId || input . previousExecutionRunId === input . runId ) ;
184+ }
185+
170186function diffExecutionParticipants (
171187 previousPolicy : NormalizedExecutionPolicy | null ,
172188 nextPolicy : NormalizedExecutionPolicy | null ,
@@ -1982,8 +1998,14 @@ export function issueRoutes(
19821998
19831999 if ( commentBody && comment ) {
19842000 const assigneeId = issue . assigneeAgentId ;
1985- const actorIsAgent = actor . actorType === "agent" ;
1986- const selfComment = actorIsAgent && actor . actorId === assigneeId ;
2001+ const selfComment = isSelfAuthoredAssigneeComment ( {
2002+ actorType : actor . actorType ,
2003+ actorId : actor . actorId ,
2004+ assigneeAgentId : assigneeId ,
2005+ runId : actor . runId ,
2006+ executionRunId : issue . executionRunId ,
2007+ previousExecutionRunId : existing . executionRunId ,
2008+ } ) ;
19872009 const skipAssigneeCommentWake = selfComment || isClosed ;
19882010
19892011 if ( assigneeId && ! assigneeChanged && ( reopened || ! skipAssigneeCommentWake ) ) {
@@ -2580,7 +2602,14 @@ export function issueRoutes(
25802602 const wakeups = new Map < string , Parameters < typeof heartbeat . wakeup > [ 1 ] > ( ) ;
25812603 const assigneeId = currentIssue . assigneeAgentId ;
25822604 const actorIsAgent = actor . actorType === "agent" ;
2583- const selfComment = actorIsAgent && actor . actorId === assigneeId ;
2605+ const selfComment = isSelfAuthoredAssigneeComment ( {
2606+ actorType : actor . actorType ,
2607+ actorId : actor . actorId ,
2608+ assigneeAgentId : assigneeId ,
2609+ runId : actor . runId ,
2610+ executionRunId : currentIssue . executionRunId ,
2611+ previousExecutionRunId : issue . executionRunId ,
2612+ } ) ;
25842613 const skipWake = selfComment || isClosed ;
25852614 if ( assigneeId && ( reopened || ! skipWake ) ) {
25862615 if ( reopened ) {
0 commit comments