diff --git a/background.js b/background.js index 25cb903..63ee547 100644 --- a/background.js +++ b/background.js @@ -7758,7 +7758,7 @@ function isPhoneSmsPlatformRateLimitFailure(error) { function isPlusCheckoutNonFreeTrialFailure(error) { const message = getErrorMessage(error); - return /PLUS_CHECKOUT_NON_FREE_TRIAL::|今日应付金额不是\s*0|没有免费试用资格/i.test(message); + return /PLUS_CHECKOUT_NON_FREE_TRIAL::|今日应付金额不是\s*0|没有免费试用资格|该账号已经开通过\s*ChatGPT\s*订阅套餐,不能重复订阅(?:。)?(?:(\s*checkout_order\s*)|\(\s*checkout_order\s*\))?/i.test(message); } function isGpcTaskEndedFailure(error) { diff --git a/tests/auto-run-step6-restart.test.js b/tests/auto-run-step6-restart.test.js index 2a87a35..70ea3f8 100644 --- a/tests/auto-run-step6-restart.test.js +++ b/tests/auto-run-step6-restart.test.js @@ -781,3 +781,31 @@ test('auto-run does not restart GPC checkout when Plus account has no free-trial assert.deepStrictEqual(result.events.steps, [6, 7]); assert.equal(result.events.invalidations.length, 0); }); + +test('auto-run does not restart GPC checkout when account already has a ChatGPT subscription', async () => { + const plusGpcSteps = { + 6: { key: 'plus-checkout-create' }, + 7: { key: 'plus-checkout-billing' }, + 10: { key: 'oauth-login' }, + }; + const harness = createHarness({ + startStep: 6, + failureStep: 7, + failureBudget: 1, + failureMessage: 'GPC_TASK_ENDED::该账号已经开通过ChatGPT订阅套餐,不能重复订阅。(checkout_order)', + stepDefinitions: plusGpcSteps, + finalOAuthChainStartStep: 10, + customState: { + stepStatuses: { 3: 'completed' }, + plusPaymentMethod: 'gpc-helper', + plusCheckoutSource: 'gpc-helper', + }, + }); + + const result = await harness.runAndCaptureError(); + + assert.ok(result?.error); + assert.deepStrictEqual(result.events.steps, [6, 7]); + assert.equal(result.events.invalidations.length, 0); + assert.ok(!result.events.logs.some(({ message }) => /回到步骤 6 重新创建 GPC 任务/.test(message))); +});