Fix: Pro users with OAuth tokens incorrectly classified as free

#21

Bug

_normalize_personal_plan() in agent/core/hf_access.py fails to detect Pro users when authenticating via OAuth.

The whoami-v2 response for OAuth users includes "type": "user" and "isPro": true. The function iterates over keys ("plan", "type", "accountType") looking for a plan string. It finds "type": "user", sets plan_str = "user", and breaks.

Then the isPro check is gated behind if not plan_str, which is False because plan_str = "user". So isPro: true is never checked, and the function returns "free".

This causes resolve_jobs_namespace() to raise JobsAccessError("Hugging Face Jobs are available only to Pro users...") even for confirmed Pro users.

Fix

Check isPro before falling through to the plan string matching, so it takes priority regardless of what plan_str contains.

Impact

Every Pro user accessing the agent via the OAuth login flow (i.e., the normal browser login at smolagents-ml-intern.hf.space) is unable to run HF Jobs.

Marco333 changed pull request status to open

hey @Marco333 sorry about this. https://github.com/huggingface/ml-intern/pull/164
Deploying in an hour.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment