Add a mock-isolated gateway latency report for main CI - #591
Conversation
Greptile SummaryThe PR adds a secret-free CI benchmark that compares a local OpenAI-compatible mock directly against the Experiential gateway and publishes a versioned latency report.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| .github/workflows/gateway-latency.yml | Adds the benchmark workflow with routine jobs on ubuntu-latest, explicit large-runner dispatch, read-only permissions, and full-SHA action pins. |
| exp/runtime/gateway/latency_measure.py | Adds the loopback mock, concurrent request sampler, gateway configuration and lifecycle helpers, and corrected launch-receipt engine detection. |
| exp/runtime/gateway/latency_report.py | Adds the versioned report schema, repeated direct-versus-gateway measurements, functional-failure enforcement, output rendering, and CLI entry point. |
| exp/runtime/gateway/latency_measure_test.py | Covers Rust and Python receipt parsing, delayed receipt publication, missing receipts, and the corrected timeout behavior. |
| exp/runtime/gateway/latency_report_test.py | Exercises report aggregation, rendering, configuration, output generation, and benchmark integration behavior. |
| docs/reference/gateway-latency.md | Documents the mock-isolated methodology, execution schedule, artifact contract, workflow behavior, and interpretation limits. |
Sequence Diagram
sequenceDiagram
participant CI as GitHub Actions
participant R as Latency reporter
participant M as Local mock
participant G as Experiential gateway
CI->>R: Run benchmark
R->>M: Start loopback mock
R->>G: Configure and start gateway
G->>M: Route latency alias
R->>M: Warm up and sample directly
R->>G: Warm up and sample through gateway
G->>M: Forward requests
R->>R: Compute gateway-minus-mock percentiles
R-->>CI: JSON artifact and Markdown summary
Reviews (8): Last reviewed commit: "Remove the third-party proxy comparison ..." | Re-trigger Greptile
|
Addressed both Greptile findings on |
|
@greptileai Please re-review |
Measure a local OpenAI-compatible mock directly and through the Experiential gateway, then publish gateway-added p50/p95/p99, throughput, and failure rate without calling paid providers. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
Run the mock-isolated report on main, pull requests, and workflow_dispatch. Publish a job summary and versioned JSON artifact without secrets or a hard latency threshold. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
TTFT clients close the SSE body after the first content token. The mock now ignores the resulting write error instead of dumping a traceback. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
HTTP readiness can beat the stdout pump thread. Parse rust versus python only after a ready receipt arrives, and pin third-party Actions to SHAs. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
Pin litellm[proxy]==1.97.0, measure mock-direct plus both proxies with one sampler, and rotate gateway order across repeats. Schema v2 records hardware, versions, and signed overhead. Functional failures fail CI; latency differences do not. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
Rich was wrapping Markdown rows at the default terminal width, which made the same-run comparison harder to read in the Actions log. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
The latency and python-package workflows already accept a manual start. Gate now matches so the full CI set can be re-run on a feature branch. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
HTTP readiness can beat the stdout pump. After the receipt wait times out, the report now records unknown instead of guessing python. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
Keep the mock-direct versus Experiential measurement, JSON artifact, workflow, badge, and hosted-runner matrix. Drop the extra proxy process, CLI flag, schema fields, CI install, and docs. Co-authored-by: Kion Fallah <kfallah@users.noreply.github.com>
e6a30a3 to
12c5721
Compare
|
@greptileai Please re-review |
Summary
Adds a lightweight, secret-free CI report that measures Experiential gateway-added latency against one local OpenAI-compatible mock. The same sampler, payload, warmup, concurrency, and request counts hit:
Reported overhead is the client-observed difference (gateway minus mock) for p50, p95, and p99. This is not end-to-end model latency. The static research writeup in
docs/research/rust-gateway-engine.mdis unchanged. README.md is not edited.Rebased onto current
main. The only conflict wasnative_engine_disconnect_test.py; this branch now keeps main's escalated-alias fallback coverage.Methodology
Streaming time-to-first-token is included because the mock emits the first content token immediately, so TTFT is a first-byte measurement rather than a model-generation race.
Routine PR and main pushes stay on
ubuntu-latest.workflow_dispatchusesgateway-benchmark-32coreso public PRs cannot consume the larger runner.Schema
exp.gateway.latency_reportv1. The JSON records commit SHA, runner OS, CPU count and model, Python, Experiential engine, every repeat, and signed overhead versus the mock baseline. Functional request failures fail the job. Latency differences do not.Sample result (ubuntu-latest)
Official job: https://github.com/experientiallabs/experiential/actions/runs/32597320092
Commit
45c59dac, GitHub-hosted ubuntu-latest, Linux 6.17 Azure, 4 x AMD EPYC 9V74, Python 3.12.3, Experiential rust, 0 failures. Representative run 1 of 3. Shared-runner tails are noisy: mock-direct p95 can include a one-second hitch, which makes gateway-added p95/p99 negative. Read p50 as the overhead signal.Non-stream (warmup 10, 40 requests, concurrency 8):
Streaming TTFT (warmup 5, 20 requests, concurrency 4):
Commands
Limitations
Badge (README approval needed)
The badge above is in this PR description only. A README insertion still needs explicit README approval:
Review
Rebased onto current
mainat12c57212. Greptile last scored the pre-rebase receipt-timeout fix at 5/5 (safe to merge); thatunknownengine path is unchanged. Please re-review the rebased tip.