Skip to content

arenabench: the balance preflight reads the operator's OPENROUTER_API_KEY, which may not be the SSM key the cloud trials spend #3308

Description

@macanderson

Problem

The cloud-run balance preflight (PR #TBD, arenabench/arenabench/balance.py) queries GET https://openrouter.ai/api/v1/credits with the OPENROUTER_API_KEY from the operator's shell. The trials themselves authenticate with the key exported from SSM (/arenabench/openrouter_api_key, see arenabench/arenabench/cloud.py::available_credentials). When those are different accounts, the preflight measures the wrong balance in either direction: it can wave through a run whose SSM account is empty, or refuse a run whose SSM account is funded.

Today the two keys are the same account in practice, and a wrong answer degrades to exactly the pre-preflight behavior (submit and lose the run) or to one --skip-balance-check, so this is a correctness gap in the check's coverage, not a regression.

Constraints discovered

  • available_credentials deliberately reads names only (WithDecryption=False): the secret must not transit the operator's machine. Decrypting the SSM key locally to run the credits call is therefore not an acceptable fix.
  • The preflight must keep failing OPEN (a broken check must not block a funded run) — see the module doc of balance.py.

Options a fix could weigh

  1. Run the credits call from inside the substrate (a tiny preflight Batch job or Lambda holding the SSM key) and refuse from there before the fan-out.
  2. Store a non-secret account fingerprint beside the SSM key (e.g. the key's OpenRouter label or a hash) and compare it against the local key's, warning on mismatch.
  3. At minimum: print which key source the check used, so the transcript records the assumption.

Done

Either the preflight demonstrably measures the account the trials will spend from, or the transcript states explicitly that it measured the local key and that the SSM key may differ. Tests in arenabench/tests/test_balance.py / test_cloud.py pinned accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:benchbench/ — SWE-bench & Arena harnesstriageUntyped request — convert by adding bug / feature / epic

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions