@@ -36,6 +36,10 @@ import { formatTaskCompleteMailBody } from "./task-result-mail.js";
3636/** Real git binary path — bypasses codex-tools wrapper that blocks commit/push */
3737const GIT_BIN = process . env . TPS_GIT_BIN ?? "/usr/bin/git" ;
3838
39+ function shouldSendTaskCompletion ( recipient : string , reviewNotify ?: string [ ] ) : boolean {
40+ return ! ( reviewNotify ?. includes ( recipient ) ) ;
41+ }
42+
3943/** Read OpenAI OAuth creds from ~/.tps/auth/openai.json (written by tps auth login openai). */
4044function readStoredOpenAICreds ( ) : StoredCredentials | null {
4145 const credPath = join ( homedir ( ) , ".tps" , "auth" , "openai.json" ) ;
@@ -713,7 +717,9 @@ export async function runCodexRuntime(config: CodexRuntimeConfig): Promise<void>
713717 } ) ;
714718 const summary = result . length > 500 ? result . slice ( 0 , 500 ) + "..." : result ;
715719 console . log ( `[${ agentId } ] Flair task complete. Result: ${ result . length } chars` ) ;
716- sendMail ( mailDir , agentId , event . authorId , formatTaskCompleteMailBody ( summary , "Task complete (via Flair)" ) ) ;
720+ if ( shouldSendTaskCompletion ( event . authorId , config . autoCommit ?. reviewNotify ) ) {
721+ sendMail ( mailDir , agentId , event . authorId , formatTaskCompleteMailBody ( summary , "Task complete (via Flair)" ) ) ;
722+ }
717723 try {
718724 await ( flair as any ) . request ( "POST" , "/OrgEvent" , {
719725 kind : "task.completed" , authorId : agentId , targetIds : [ event . authorId ] ,
@@ -814,7 +820,9 @@ export async function runCodexRuntime(config: CodexRuntimeConfig): Promise<void>
814820 } ) ;
815821 const summary = result . length > 500 ? result . slice ( 0 , 500 ) + "..." : result ;
816822 console . log ( `[${ agentId } ] Task complete. Result length: ${ result . length } ` ) ;
817- sendMail ( mailDir , agentId , msg . from , formatTaskCompleteMailBody ( summary ) ) ;
823+ if ( shouldSendTaskCompletion ( msg . from , config . autoCommit ?. reviewNotify ) ) {
824+ sendMail ( mailDir , agentId , msg . from , formatTaskCompleteMailBody ( summary ) ) ;
825+ }
818826 await publishTaskOutcomeEvent ( flair , agentId , {
819827 kind : "task.completed" ,
820828 summary : `Task ${ msg . id } completed by ${ agentId } ` ,
0 commit comments