@@ -8,8 +8,8 @@ import { COPILOT_ACCOUNTS, IComment } from '../common/comment';
88import { Disposable } from '../common/lifecycle' ;
99import Logger from '../common/logger' ;
1010import { Remote } from '../common/remote' ;
11- import { ClosedEvent , EventType , TimelineEvent } from '../common/timelineEvent' ;
12- import { formatError } from '../common/utils' ;
11+ import { ClosedEvent , CrossReferencedEvent , EventType , TimelineEvent } from '../common/timelineEvent' ;
12+ import { compareIgnoreCase , formatError } from '../common/utils' ;
1313import { OctokitCommon } from './common' ;
1414import { CopilotWorkingStatus , GitHubRepository } from './githubRepository' ;
1515import {
@@ -470,8 +470,23 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
470470 Logger . error ( 'Unexpected null repository when getting issue timeline events' , GitHubRepository . ID ) ;
471471 return [ ] ;
472472 }
473+
473474 const ret = data . repository . pullRequest . timelineItems . nodes ;
474475 const events = await parseCombinedTimelineEvents ( ret , await this . getCopilotTimelineEvents ( issueModel , true ) , this . githubRepository ) ;
476+
477+ const crossRefs = events . filter ( ( event ) : event is CrossReferencedEvent => {
478+ if ( ( event . event === EventType . CrossReferenced ) && ! event . source . isIssue ) {
479+ return ! this . githubRepository . getExistingPullRequestModel ( event . source . number ) && ( compareIgnoreCase ( event . source . owner , issueModel . remote . owner ) === 0 && compareIgnoreCase ( event . source . repo , issueModel . remote . repositoryName ) === 0 ) ;
480+ }
481+ return false ;
482+
483+ } ) ;
484+
485+ for ( const unseenPrs of crossRefs ) {
486+ // Kick off getting the new PRs so that the system knows about them (and refreshes the tree when they're found)
487+ this . githubRepository . getPullRequest ( unseenPrs . source . number ) ;
488+ }
489+
475490 issueModel . timelineEvents = events ;
476491 return events ;
477492 } catch ( e ) {
0 commit comments