Skip to content

perf(xtask): add request-credential perf fixtures (ENG-1066) - #351

Merged
lg2m merged 5 commits into
docs/eng-1066-ledger-ap0-ap4from
perf/eng-1066-ap4b-credential-fixtures
Oct 18, 2026
Merged

lg2m merged 5 commits into
docs/eng-1066-ledger-ap0-ap4from
perf/eng-1066-ap4b-credential-fixtures

Conversation

@lg2m

@lg2m lg2m commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

AP4b: request-credential perf fixtures

Spec: docs/plans/auth-providers.md (AP4b) Linear: ENG-1066 Stacked on: #350

This adds benchmarks and budget rows only. Runtime behaviour doesn't change. AP4b lands before AP5 and AP6 change the credential path, so both of those slices can record their baseline and candidate with the same metric inventory and fixture version: validate_metric_contracts rejects reports whose metric inventories differ.

What changed

  • xtask/src/perf/credentials.rs (new) adds three H0 metrics. They run against an in-memory keyring and a loopback server, so they measure QQ's credential path, not a real keyring or a network:
    • xai_request_credential_resolution_ns: one RequestCredentialProvider::credential call for a stored, unexpired xAI OAuth credential, through CredentialStore with an in-memory KeyringBackend. The token is valid for a day, so no sample triggers a refresh.
    • xai_request_credential_concurrent_resolution_ns: eight concurrent calls on one provider, timed from start to the last completion. AP5 needs this one: before AP5, Codex holds its cache lock across the whole load, so concurrent warm requests run one at a time.
    • request_time_authorized_stream_ns: one Chat Completions request compiled with HttpAuth::RequestTimeBearer, timed from Provider::stream to the terminal event, against a keep-alive loopback server. A correctness check fails the recording unless every request carried the stored bearer token.
  • benchmarks/perf/budgets-v1.json: budget rows for the three metrics (20%, 20% and 15% maximum regression), and fixture_version goes from 5 to 6. Version 5 reports can no longer be compared; the runbook and benchmarks/perf/README.md say so.
  • xtask/src/legacy-sleeps.txt: two existing sleep baselines are updated to their new line numbers after the wiring moved them down. No sleep was added (73/73).

How verified

cargo xtask check

Head b29fdd477d11 vs origin/main; 9 changed file(s); scope: qq, xtask.

Gate Result Tests Time Command
fmt pass 1.6s cargo fmt --all -- --check
lint pass 2.2s cargo xtask lint
clippy pass 20.5s cargo clippy --color never -p qq -p xtask --all-targets --all-features -- -D warnings
test pass 440/440 passed, 2 skipped 50.2s cargo nextest run --color never --profile default -p qq -p xtask

All gates passed in 74.6s.

  • perf::tests::credential_fixtures_resolve_the_stored_bearer_without_refresh runs all three workloads and checks their names, sample counts and correctness checks. To confirm the bearer check is real, I temporarily changed the expected value: the check failed with "0 of 6 requests carried the stored bearer".
  • In a 5-sample local run, request_time_authorized_stream_ns had a median of about 0.5 ms.
  • A full local cargo xtask perf baseline smoke recording is still running. I'll add its receipt to the ledger when it finishes.

Compatibility

  • PROTOCOL, DESCRIPTOR and store schema are unchanged. The perf fixture version goes from 5 to 6.

@lg2m

lg2m commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T07:07:23.179688Z 256f0cc Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b29fdd477d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/plans/progress/auth-providers.md Resolved
Comment thread xtask/src/perf/credentials.rs Resolved
Comment thread xtask/src/perf/credentials.rs Resolved
@lg2m
lg2m added this pull request to stack #352 October 18, 2026 03:17
lg2m added 5 commits October 17, 2026 20:31
Slice AP4b. Three deterministic H0 metrics land before AP5/AP6 change
the credential path, so both slices record baseline and candidate with
the same metric inventory and fixture version:

- xai_request_credential_resolution_ns and
  xai_request_credential_concurrent_resolution_ns: one, and eight
  concurrent, RequestCredentialProvider::credential calls for a stored,
  unexpired xAI OAuth credential through CredentialStore with an
  in-memory keyring;
- request_time_authorized_stream_ns: one Chat Completions request
  compiled with HttpAuth::RequestTimeBearer, Provider::stream to the
  terminal event, against a keep-alive loopback that checks each request
  carried the stored bearer.

Budget rows are added and the fixture version goes 5 -> 6, so version 5
reports are no longer comparable; the runbook and perf README say so.
The AP4b workload wiring shifts two existing perf.rs test sleeps by 12
lines; their legacy entries follow them. No sleep is added (73/73).
…(ENG-1066)

Review of b29fdd4 (#351):
- CredentialStore::offline installs token clients that refuse every
  exchange, refresh and device call without network I/O and count them;
  both credential workloads use it and fail their correctness check if a
  sample ever calls one, so a refresh regression cannot reach xAI.
- The keep-alive loopback is now a task on the caller's runtime with a
  bounded connection set; the workload stops it and awaits every
  connection before returning, and Drop aborts it on an early return, so
  no listener, socket or thread outlives the workload.
@lg2m
lg2m force-pushed the perf/eng-1066-ap4b-credential-fixtures branch from f42ce31 to 256f0cc Compare October 18, 2026 07:03
@lg2m

lg2m commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review
Rebased onto #350's head. 8180225 and 256f0cc fix all three findings: offline token clients asserted at 0 calls; the loopback is a self-contained runtime task, shut down and awaited; a 30-sample baseline receipt is in the ledger. All threads replied and resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 256f0cce00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lg2m
lg2m merged commit 2f585b0 into main Oct 18, 2026
6 checks passed
@lg2m
lg2m deleted the perf/eng-1066-ap4b-credential-fixtures branch October 18, 2026 07:20
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.

1 participant