11
This commit is contained in:
@@ -53,6 +53,8 @@ class WebhookCoordinator {
|
||||
private activePanel: KanbanWebviewPanel | undefined
|
||||
private initialized = false
|
||||
private eventSubscription?: { dispose: () => void }
|
||||
/** 同 issue 自动审查启动中不重入(opened 与 synchronize 常连发)。 */
|
||||
private reviewInFlight = new Set<number>()
|
||||
|
||||
/** Called once from extension.ts activate(). Idempotent. */
|
||||
init(ctx: ExtensionContext): void {
|
||||
@@ -1269,6 +1271,31 @@ class WebhookCoordinator {
|
||||
if (!this.ctx)
|
||||
return
|
||||
|
||||
if (this.reviewInFlight.has(issueNumber)) {
|
||||
logger.add({
|
||||
level: 'info',
|
||||
source: 'webhook',
|
||||
message: `自动审查 #${issueNumber} 已在进行中,忽略并发触发`,
|
||||
})
|
||||
return
|
||||
}
|
||||
this.reviewInFlight.add(issueNumber)
|
||||
try {
|
||||
await this.triggerReviewBody(issueNumber, prNumber, ctx)
|
||||
}
|
||||
finally {
|
||||
this.reviewInFlight.delete(issueNumber)
|
||||
}
|
||||
}
|
||||
|
||||
private async triggerReviewBody(
|
||||
issueNumber: number,
|
||||
prNumber: string,
|
||||
ctx: { host: string, owner: string, repo: string, token: string },
|
||||
): Promise<void> {
|
||||
if (!this.ctx)
|
||||
return
|
||||
|
||||
// Read current column from state JSON; if it's still 'in-progress',
|
||||
// auto-advance to 'review' so the kanban reflects "审查中" status. Skip if
|
||||
// already in review/done to avoid bouncing the card around.
|
||||
|
||||
Reference in New Issue
Block a user