Skip to content

Support optional bearer authentication in benchmark clients - #890

Merged
ashhart merged 1 commit into
ashhart:mainfrom
alenperic:feat/benchmark-bearer-auth
Oct 16, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
alenperic:feat/benchmark-bearer-auth

Conversation

@alenperic

Copy link
Copy Markdown
Contributor

What this changes

Adds optional bearer authentication to tools/bench_openai.py and tools/bench_concurrent.py through --api-key-env NAME, allowing benchmarks against authenticated OpenAI-compatible endpoints. Authentication is enabled only when the option is supplied, and the credential is read from the selected environment variable.

  • Passes authentication through warm-up, measured, concurrent, staggered, solo, and serial-reference requests.
  • Rejects missing, empty, or invalid credentials before sending requests.
  • Keeps credentials out of request bodies and URLs, redacts literal credentials from reports and response samples, and prevents exception messages from exposing them in CLI errors.
  • Uses an unredirected authorization header so redirects do not forward the bearer credential.
  • Adds nine regression tests, including local HTTP authentication and redirect checks.

Receipt

  • Commit: 0d3ad792fd4bc0774bfa714eadf0d943bdb0f209, based on c7137bb31a7dad924fb541a7068422127b9a94b2.
  • Environment: Tests passed locally on macOS and independently on Linux x86_64 with Python 3.12.14. The macOS Python version was not recorded in the supplied test output. Standard-library tests with fictional credentials and local HTTP fixtures; no GPU, MLX, PyTorch, or model checkpoint required.
  • Exactness: n/a. Native token generation, draft verification, cache behavior, and model arithmetic are unchanged.
  • Decode speed before and after: Not measured. This change adds client-side authentication and report sanitization; no inference performance improvement is claimed.
  • Prompt speed before and after: n/a. Server-side prompt processing is unchanged.
  • Tests run: python -m unittest discover -s tools/tests -v — 26 passed, 0 failed, 0 errors, 0 skipped, on both tested environments. The authentication regression cases fail against the parent implementation.
  • Diff checks: git diff --check and git diff --cached --check passed.
  • Lean checker: 1,375 files checked; baseline 527 findings, candidate 527 findings; zero added or removed findings. Both runs exit 1 due to inherited findings.
  • Not run, and why: Native host/golden suites, Metal M1–M5 and CUDA model checks, and live model benchmarks were not run because the changes are confined to Python benchmark clients. Local HTTP fixtures exercise authentication without requiring a deployed model.

Checklist

  • Lane rounds and serial/draft execution paths are unchanged.
  • Drafted/plain, resumed/fresh, and concurrent/solo model exactness checks — not run; native inference is unchanged.
  • No precision or reduction-order changes.
  • Prompt performance against the last release — not measured; server-side prompt processing is unchanged.
  • Tested and untested platforms are identified above.
  • Authentication regression cases fail before the change and pass afterward; tests require no optional dependencies.
  • Added comments/docstrings are single-line; no measurements or history were added to source.
  • Lean checker run; baseline and candidate findings recorded, with zero new findings.
  • The four changed files and outgoing commit metadata were reviewed; fixtures use fictional credentials, and author and committer use GitHub noreply.

@ashhart
ashhart merged commit b9289d6 into ashhart:main Oct 16, 2026
ashhart added a commit that referenced this pull request Oct 16, 2026
…rry one

reuse_served read the reply's 12-character token_sha, and two missing digests compared equal. It now reads
token_sha256, keeps it only when it is 64 hex digits, and fails a reply when either arm has none. A resumed reply
that is no sooner than the fresh one is listed on its own timing line instead of failing the equality check.
#890's auth fixtures answer with a full token_sha256 beside their short fingerprint, as the server does, so the
clients' #862/#863 digest checks see a valid reply.
ashhart added a commit that referenced this pull request Oct 16, 2026
…VIEW names the refused GLM pair requests rightly

One line each for #881, #882, #883, #889, #890, #709, #848, #892, #867, #868, #871 and #873, crediting their
authors. ZIG-PREVIEW said a two-Mac GLM pair refuses "temperature-1" requests; it refuses any temperature above 0
(backend.zig and engine.zig both test temperature > 0).
@ashhart

ashhart commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thank you, @alenperic, for adding bearer authentication and output redaction to the benchmark clients.

#890 is included in 1.0.12 as merge b9289d6, at 0d3ad79. The clients read the key from the variable named by --api-key-env, send it to the requested endpoint and refuse to forward it on redirects. They redact the configured key from client output.

The merge retains #862/#863's full digests. Our a83a85d adds matching token_sha256 values to the authentication fixtures.

The client tests pass under Python 3.12 on macOS and Linux. The concurrency checks used the updated clients and compared complete replies by full digest.

Posted by Ash's AI Assistant Synthena

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants