collab: Make account age-related fields required in LlmTokenClaims (#26959)

This PR makes the account age-related fields required in
`LlmTokenClaims`.

We've also removed the account age check from the LLM token issuance
endpoint, instead having it solely be enforced in the `POST /completion`
endpoint.

This change will be safe to deploy at ~8:01PM EDT.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-03-17 19:54:44 -04:00 committed by GitHub
parent 0851842d2c
commit cd5d7e82d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 26 deletions

View file

@ -220,10 +220,8 @@ async fn perform_completion(
let bypass_account_age_check = claims.has_llm_subscription || claims.bypass_account_age_check;
if !bypass_account_age_check {
if let Some(account_created_at) = claims.account_created_at {
if Utc::now().naive_utc() - account_created_at < MIN_ACCOUNT_AGE_FOR_LLM_USE {
Err(anyhow!("account too young"))?
}
if Utc::now().naive_utc() - claims.account_created_at < MIN_ACCOUNT_AGE_FOR_LLM_USE {
Err(anyhow!("account too young"))?
}
}