Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
feat: added 2fa token parsing logic
Saurav Pandaf3fa86ea21d6
diff --git a/.github/workflows/eval.yaml b/.github/workflows/eval.yamlindex 51addc2c8..588ffb470 100644--- a/.github/workflows/eval.yaml+++ b/.github/workflows/eval.yaml@@ -253,14 +253,14 @@ jobs:PLANNER_MODEL="${{ github.event.client_payload.script_args.planner_model }}"RUN_ID="${{ github.event.client_payload.script_args.run_id }}"LAMINAR_EVAL_ID="${{ github.event.client_payload.script_args.laminar_eval_id }}"- GMAIL_2FA_TOKENS="${{ toJSON(github.event.client_payload.script_args.gmail_2fa_tokens) }}"+ # Pass raw GitHub Actions object to Python - no parsing in bash+ GMAIL_2FA_TOKENS_RAW='${{ github.event.client_payload.script_args.gmail_2fa_tokens }}'# Debug Gmail 2FA tokens variable assignmentecho "DEBUG: π§ GMAIL_2FA_TOKENS assignment debug:"echo "DEBUG: π§ Raw payload value: '${{ github.event.client_payload.script_args.gmail_2fa_tokens }}'"- echo "DEBUG: π§ toJSON result: '${{ toJSON(github.event.client_payload.script_args.gmail_2fa_tokens) }}'"- echo "DEBUG: π§ GMAIL_2FA_TOKENS variable value: '$GMAIL_2FA_TOKENS'"- echo "DEBUG: π§ GMAIL_2FA_TOKENS length: ${#GMAIL_2FA_TOKENS}"+ echo "DEBUG: π§ Final GMAIL_2FA_TOKENS_RAW variable: '$GMAIL_2FA_TOKENS_RAW'"+ echo "DEBUG: π§ Variable length: ${#GMAIL_2FA_TOKENS_RAW}"# Single task mode parametersTASK_ID="${{ github.event.client_payload.script_args.task_id }}"@@ -305,17 +305,17 @@ jobs:# Add Gmail 2FA parametersecho "DEBUG: π§ GMAIL_2FA_TOKENS conditional check:"- echo "DEBUG: π§ GMAIL_2FA_TOKENS value at check time: '$GMAIL_2FA_TOKENS'"- echo "DEBUG: π§ GMAIL_2FA_TOKENS length at check time: ${#GMAIL_2FA_TOKENS}"- echo "DEBUG: π§ GMAIL_2FA_TOKENS equals 'null': $([[ "$GMAIL_2FA_TOKENS" == "null" ]] && echo "true" || echo "false")"- echo "DEBUG: π§ GMAIL_2FA_TOKENS is empty: $([[ -z "$GMAIL_2FA_TOKENS" ]] && echo "true" || echo "false")"- echo "DEBUG: π§ GMAIL_2FA_TOKENS is non-empty: $([[ -n "$GMAIL_2FA_TOKENS" ]] && echo "true" || echo "false")"-- if [[ -n "$GMAIL_2FA_TOKENS" && "$GMAIL_2FA_TOKENS" != "null" ]]; then- echo "DEBUG: β GMAIL_2FA_TOKENS conditional passed - adding tokens to command"- CMD_ARGS+=("--gmail-2fa-tokens" "$GMAIL_2FA_TOKENS")+ echo "DEBUG: π§ GMAIL_2FA_TOKENS_RAW value at check time: '$GMAIL_2FA_TOKENS_RAW'"+ echo "DEBUG: π§ GMAIL_2FA_TOKENS_RAW length at check time: ${#GMAIL_2FA_TOKENS_RAW}"+ echo "DEBUG: π§ GMAIL_2FA_TOKENS_RAW equals 'null': $([[ "$GMAIL_2FA_TOKENS_RAW" == "null" ]] && echo "true" || echo "false")"+ echo "DEBUG: π§ GMAIL_2FA_TOKENS_RAW is empty: $([[ -z "$GMAIL_2FA_TOKENS_RAW" ]] && echo "true" || echo "false")"+ echo "DEBUG: π§ GMAIL_2FA_TOKENS_RAW is non-empty: $([[ -n "$GMAIL_2FA_TOKENS_RAW" ]] && echo "true" || echo "false")"++ if [[ -n "$GMAIL_2FA_TOKENS_RAW" && "$GMAIL_2FA_TOKENS_RAW" != "null" ]]; then+ echo "DEBUG: β GMAIL_2FA_TOKENS_RAW conditional passed - adding tokens to command"+ CMD_ARGS+=("--gmail-2fa-tokens" "$GMAIL_2FA_TOKENS_RAW")else- echo "DEBUG: β GMAIL_2FA_TOKENS conditional failed - tokens are empty, null, or not set, skipping"+ echo "DEBUG: β GMAIL_2FA_TOKENS_RAW conditional failed - tokens are empty, null, or not set, skipping"fi# Add single task mode parametersdiff --git a/eval/service.py b/eval/service.pyindex 2641df270..b72f06f3f 100644--- a/eval/service.py+++ b/eval/service.py@@ -2853,18 +2853,66 @@ if __name__ == '__main__':logger.info(f'π§ Total sys.argv length: {len(sys.argv)}')logger.info(f'π§ Arguments containing "gmail": {[arg for arg in sys.argv if "gmail" in arg.lower()]}')- # Parse Gmail 2FA tokens dictionary+ # Parse Gmail 2FA tokens - handle GitHub Actions raw object formatgmail_tokens_dict = Noneif args.gmail_2fa_tokens:- try:- gmail_tokens_dict = json.loads(args.gmail_2fa_tokens)- logger.info(f'π§ Gmail 2FA tokens received: {"YES" if gmail_tokens_dict else "NO"}')- if gmail_tokens_dict:- logger.info(f'π§ Gmail 2FA tokens count: {len(gmail_tokens_dict)}')- logger.info(f'π§ Gmail 2FA users: {list(gmail_tokens_dict.keys())}')- except json.JSONDecodeError as e:- logger.error(f'π§ Failed to parse Gmail 2FA tokens JSON: {e}')+ raw_tokens = args.gmail_2fa_tokens+ logger.info(f'π§ Raw Gmail 2FA tokens received: "{raw_tokens}"')++ # Check if GitHub Actions passed us something like "[object Object]" or similar+ if raw_tokens in ['[object Object]', 'null', '', '{}']:+ logger.info('π§ GitHub Actions passed placeholder value, no Gmail tokens available')gmail_tokens_dict = None+ else:+ try:+ # First try parsing as valid JSON (in case it's already proper JSON)+ gmail_tokens_dict = json.loads(raw_tokens)+ logger.info(f'π§ Successfully parsed as JSON - Gmail 2FA tokens count: {len(gmail_tokens_dict)}')+ logger.info(f'π§ Gmail 2FA users: {list(gmail_tokens_dict.keys())}')+ except json.JSONDecodeError:+ # If JSON parsing fails, try to parse GitHub Actions malformed toJSON format+ try:+ logger.info('π§ JSON parsing failed, attempting to parse GitHub Actions malformed format...')++ # Handle GitHub Actions toJSON format: { key: value, key2: value2 }+ if raw_tokens.strip() and raw_tokens.strip() not in ['null', '{}']:+ # Remove outer braces and parse line by line+ content = raw_tokens.strip().strip('{}').strip()++ if content:+ tokens = {}+ lines = [line.strip() for line in content.split('\n') if line.strip()]++ for line in lines:+ # Remove trailing comma if present+ line = line.rstrip(',')++ if ':' in line:+ # Split on first colon only+ key, value = line.split(':', 1)+ key = key.strip()+ value = value.strip()++ # Store the key-value pair+ tokens[key] = value++ if tokens:+ gmail_tokens_dict = tokens+ logger.info('π§ Successfully parsed malformed GitHub Actions format')+ logger.info(f'π§ Gmail 2FA tokens count: {len(gmail_tokens_dict)}')+ logger.info(f'π§ Gmail 2FA users: {list(gmail_tokens_dict.keys())}')+ else:+ logger.warning('π§ No tokens found in malformed format')+ gmail_tokens_dict = None+ else:+ logger.warning('π§ Empty content in malformed format')+ gmail_tokens_dict = None+ else:+ logger.info('π§ Raw tokens empty or null')+ gmail_tokens_dict = None+ except Exception as e:+ logger.error(f'π§ Failed to parse malformed GitHub Actions format: {type(e).__name__}: {e}')+ gmail_tokens_dict = Noneelse:logger.info('π§ Gmail 2FA tokens: None or empty')# Run tasks and evaluate