@@ -35,7 +35,7 @@ func New(cfg *config.Config, workspaceManager *workspace.Manager) *Agent {
35
35
return nil
36
36
}
37
37
38
- // Initialize legacy GitHub client for backward compatibility
38
+ // Initialize GitHub client that uses the new manager internally
39
39
githubClient , err := ghclient .NewClient (cfg )
40
40
if err != nil {
41
41
log .Errorf ("Failed to create GitHub client: %v" , err )
@@ -128,14 +128,14 @@ func (a *Agent) GetAuthInfo() interface{} {
128
128
if a .githubManager == nil {
129
129
return map [string ]string {"status" : "not_initialized" }
130
130
}
131
-
131
+
132
132
authInfo := a .githubManager .GetAuthInfo ()
133
133
return map [string ]interface {}{
134
- "type" : authInfo .Type ,
135
- "user" : authInfo .User ,
136
- "permissions" : authInfo .Permissions ,
137
- "app_id" : authInfo .AppID ,
138
- "configured" : a .githubManager .DetectAuthMode (),
134
+ "type" : authInfo .Type ,
135
+ "user" : authInfo .User ,
136
+ "permissions" : authInfo .Permissions ,
137
+ "app_id" : authInfo .AppID ,
138
+ "configured" : a .githubManager .DetectAuthMode (),
139
139
}
140
140
}
141
141
@@ -171,7 +171,7 @@ func (a *Agent) ProcessIssueCommentWithAI(ctx context.Context, event *github.Iss
171
171
172
172
// 3. Create initial PR (before code generation)
173
173
log .Infof ("Creating initial PR" )
174
- pr , err := a .github .CreatePullRequest ( ws )
174
+ pr , err := a .github .CreatePullRequestWithContext ( ctx , ws )
175
175
if err != nil {
176
176
log .Errorf ("Failed to create PR: %v" , err )
177
177
return err
@@ -276,7 +276,7 @@ Brief description of changes
276
276
prBody += "<details><summary>Original Prompt</summary>\n \n " + codePrompt + "\n \n </details>"
277
277
278
278
log .Infof ("Updating PR body" )
279
- if err = a .github .UpdatePullRequest ( pr , prBody ); err != nil {
279
+ if err = a .github .UpdatePullRequestWithContext ( ctx , pr , prBody ); err != nil {
280
280
log .Errorf ("Failed to update PR body with execution result: %v" , err )
281
281
return err
282
282
}
@@ -409,7 +409,9 @@ func (a *Agent) processPRWithArgsAndAI(ctx context.Context, event *github.IssueC
409
409
410
410
// 3. 从 GitHub API 获取完整的 PR 信息
411
411
log .Infof ("Fetching PR information from GitHub API" )
412
- pr , err := a .github .GetPullRequest (repoOwner , repoName , event .Issue .GetNumber ())
412
+
413
+ // 使用GitHub client获取PR信息(内部自动使用新的认证系统)
414
+ pr , err := a .github .GetPullRequestWithContext (ctx , repoOwner , repoName , event .Issue .GetNumber ())
413
415
if err != nil {
414
416
log .Errorf ("Failed to get PR #%d: %v" , prNumber , err )
415
417
return fmt .Errorf ("failed to get PR information: %w" , err )
@@ -456,7 +458,7 @@ func (a *Agent) processPRWithArgsAndAI(ctx context.Context, event *github.IssueC
456
458
457
459
// 7. 获取所有PR评论历史用于构建上下文
458
460
log .Infof ("Fetching all PR comments for historical context" )
459
- allComments , err := a .github .GetAllPRComments ( pr )
461
+ allComments , err := a .github .GetAllPRCommentsWithContext ( ctx , pr )
460
462
if err != nil {
461
463
log .Warnf ("Failed to get PR comments for context: %v" , err )
462
464
// 不返回错误,使用简单的prompt
@@ -516,7 +518,9 @@ func (a *Agent) processPRWithArgsAndAI(ctx context.Context, event *github.IssueC
516
518
// 11. 评论到 PR
517
519
commentBody := string (output )
518
520
log .Infof ("Creating PR comment" )
519
- if err = a .github .CreatePullRequestComment (pr , commentBody ); err != nil {
521
+
522
+ // 使用GitHub client创建评论(内部自动使用新的认证系统)
523
+ if err := a .github .CreatePullRequestCommentWithContext (ctx , pr , commentBody ); err != nil {
520
524
log .Errorf ("Failed to create PR comment: %v" , err )
521
525
return fmt .Errorf ("failed to create PR comment: %w" , err )
522
526
}
@@ -746,7 +750,7 @@ func (a *Agent) ContinuePRFromReviewCommentWithAI(ctx context.Context, event *gi
746
750
747
751
// 6. 回复原始评论
748
752
commentBody := string (output )
749
- if err = a .github .ReplyToReviewComment ( pr , event .Comment .GetID (), commentBody ); err != nil {
753
+ if err = a .github .ReplyToReviewCommentWithContext ( ctx , pr , event .Comment .GetID (), commentBody ); err != nil {
750
754
log .Errorf ("failed to reply to review comment for continue: %v" , err )
751
755
return err
752
756
}
@@ -853,7 +857,7 @@ func (a *Agent) FixPRFromReviewCommentWithAI(ctx context.Context, event *github.
853
857
854
858
// 6. 回复原始评论
855
859
commentBody := string (output )
856
- if err = a .github .ReplyToReviewComment ( pr , event .Comment .GetID (), commentBody ); err != nil {
860
+ if err = a .github .ReplyToReviewCommentWithContext ( ctx , pr , event .Comment .GetID (), commentBody ); err != nil {
857
861
log .Errorf ("failed to reply to review comment for fix: %v" , err )
858
862
return err
859
863
}
@@ -890,7 +894,7 @@ func (a *Agent) ProcessPRFromReviewWithTriggerUserAndAI(ctx context.Context, eve
890
894
}
891
895
892
896
// 3. 获取指定 review 的所有 comments
893
- reviewComments , err := a .github .GetReviewComments ( pr , reviewID )
897
+ reviewComments , err := a .github .GetReviewCommentsWithContext ( ctx , pr , reviewID )
894
898
if err != nil {
895
899
log .Errorf ("Failed to get review comments: %v" , err )
896
900
return err
@@ -1004,7 +1008,8 @@ func (a *Agent) ProcessPRFromReviewWithTriggerUserAndAI(ctx context.Context, eve
1004
1008
}
1005
1009
}
1006
1010
1007
- if err = a .github .CreatePullRequestComment (pr , responseBody ); err != nil {
1011
+ // 使用GitHub client创建评论(内部自动使用新的认证系统)
1012
+ if err := a .github .CreatePullRequestCommentWithContext (ctx , pr , responseBody ); err != nil {
1008
1013
log .Errorf ("failed to create PR comment for batch processing result: %v" , err )
1009
1014
return err
1010
1015
}
0 commit comments