Skip to content

Commit 317463a

Browse files
committed
fix(execution): drop the unreachable billing-account admission code
A workspace without a billing account fails inside payer resolution and takes the retryable attribution-error path; the branch that tagged BILLING_ACCOUNT_REQUIRED only ran for an attribution with no actor, which system attribution never produces. The branch goes back to its staging form and the deterministic set keeps the usage limit and suspended accounts.
1 parent 0cedd07 commit 317463a

4 files changed

Lines changed: 10 additions & 20 deletions

File tree

‎apps/sim/lib/core/admission/rejection.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
export const ADMISSION_REJECTION_CODE = {
1212
USAGE_LIMIT_EXCEEDED: 'USAGE_LIMIT_EXCEEDED',
1313
ACCOUNT_SUSPENDED: 'ACCOUNT_SUSPENDED',
14-
BILLING_ACCOUNT_REQUIRED: 'BILLING_ACCOUNT_REQUIRED',
1514
} as const
1615

1716
const DETERMINISTIC_ADMISSION_REJECTION_CODES: ReadonlySet<string> = new Set(

‎apps/sim/lib/execution/preprocessing.test.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,16 +1023,6 @@ describe('preprocessExecution admission rejection codes and blocked-run log thro
10231023
arrange: () => mockGetActivelyBannedUserIds.mockResolvedValue(['billed-account-1']),
10241024
expected: { statusCode: 403, code: ADMISSION_REJECTION_CODE.ACCOUNT_SUSPENDED },
10251025
},
1026-
{
1027-
gate: 'billing account',
1028-
arrange: () =>
1029-
mockResolveSystemBillingAttribution.mockImplementation((workspaceId: string) => ({
1030-
...ORGANIZATION_ATTRIBUTION,
1031-
actorUserId: '',
1032-
workspaceId,
1033-
})),
1034-
expected: { statusCode: 500, code: ADMISSION_REJECTION_CODE.BILLING_ACCOUNT_REQUIRED },
1035-
},
10361026
])('tags a $gate refusal with its stable code', async ({ arrange, expected }) => {
10371027
arrange()
10381028
const result = await refuse('workflow-1')

‎apps/sim/lib/execution/preprocessing.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,7 @@ export async function preprocessExecution(
579579
workspaceId,
580580
})
581581

582-
const failure: PreprocessExecutionError = {
583-
message: 'Unable to resolve billing account',
584-
statusCode: 500,
585-
code: ADMISSION_REJECTION_CODE.BILLING_ACCOUNT_REQUIRED,
586-
}
587-
await recordGateFailure(failure, {
582+
await recordPreprocessingError({
588583
workflowId,
589584
executionId,
590585
triggerType,
@@ -596,7 +591,13 @@ export async function preprocessExecution(
596591
triggerData,
597592
})
598593

599-
return { success: false, error: failure }
594+
return {
595+
success: false,
596+
error: {
597+
message: 'Unable to resolve billing account',
598+
statusCode: 500,
599+
},
600+
}
600601
}
601602

602603
if (!billingAttribution) {

‎apps/sim/lib/webhooks/polling/admission-refusals.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const logger = createLogger('PollAdmissionRefusals')
77

88
/**
99
* How long a workspace's polls are skipped after execution admission refused a
10-
* polled event for a reason that holds until a person acts (usage limit,
11-
* suspended account, missing billing account). Polling resumes on its own after
10+
* polled event for a reason that holds until a person acts (usage limit or a
11+
* suspended account). Polling resumes on its own after
1212
* this window, so a raised limit takes effect within it.
1313
*/
1414
const POLL_ADMISSION_REFUSAL_TTL_SECONDS = 5 * 60

0 commit comments

Comments
 (0)