lmarena-core: SSE unit tests, deterministic non-JSON handling, and total retry time cap#16
Draft
Copilot wants to merge 5 commits into
Draft
lmarena-core: SSE unit tests, deterministic non-JSON handling, and total retry time cap#16Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
Agent-Logs-Url: https://github.com/crazyrob425/BlacklistedAIProxy/sessions/5ea31663-43b3-4405-8e09-017af06a0bb1 Co-authored-by: crazyrob425 <247058665+crazyrob425@users.noreply.github.com>
…SE buffer, deduplicate model list Agent-Logs-Url: https://github.com/crazyrob425/BlacklistedAIProxy/sessions/32516386-16e8-4157-88de-fd5edb308a1f Co-authored-by: crazyrob425 <247058665+crazyrob425@users.noreply.github.com>
…res' into copilot/update-sse-parsing-tests-and-retry-cap Co-authored-by: crazyrob425 <247058665+crazyrob425@users.noreply.github.com>
…ng for lmarena-core Agent-Logs-Url: https://github.com/crazyrob425/BlacklistedAIProxy/sessions/b55c35e7-0af2-434c-bcbc-d873e1f17bb9 Co-authored-by: crazyrob425 <247058665+crazyrob425@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update unit tests for SSE parsing and retry cap enhancement
lmarena-core: SSE unit tests, deterministic non-JSON handling, and total retry time cap
May 4, 2026
Owner
|
@copilot translate all text to us english |
Copilot stopped work on behalf of
crazyrob425 due to an error
May 12, 2026 02:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds test coverage and two behavioral improvements to the LMArena provider introduced in PR #15.
SSE parser extraction + tests (
parseSSEStream)Inline SSE buffer logic extracted from
generateContentStreaminto an exportedparseSSEStream(stream)generator, making it directly testable without needing to mock the full axios/HTTP stack.9 unit tests covering:
\n(flush path)[DONE]sentinel — both in-loop and flush pathdata:lines (keep-alives, pings) skipped deterministically atdebuglevel, never throwingTotal retry time cap (
REQUEST_MAX_RETRY_TIME_MS)_callApinow tracks wall-clock elapsed time across recursive retries and stops retrying onceelapsed >= REQUEST_MAX_RETRY_TIME_MS, regardless of how many attempts remain underREQUEST_MAX_RETRIES. The last error is always surfaced.REQUEST_MAX_RETRY_TIME_MS(default30000ms)retryStartTimethreaded through recursive calls via a 4th parameter (backward compatible, defaultsnull→Date.now()on first call)shouldSwitchCredentialConfig example
configs/config.json.exampleupdated to showREQUEST_MAX_RETRY_TIME_MS: 30000alongside the existing retry settings.Original prompt
Repo:
crazyrob425/BlacklistedAIProxyTarget PR: #15 (branch
copilot/research-combining-features->main).Apply the following improvements to the PR (update the existing PR branch):
Add unit tests covering SSE parsing behavior in
src/providers/lmarena/lmarena-core.js:[DONE]handlingdata:line is not JSON and should be skipped deterministicallyMake handling of non-JSON
data:lines deterministic/documented:Add a cap on total retry time (not just retry count) for
_callApiinLMArenaApiService:REQUEST_MAX_RETRIESandREQUEST_BASE_DELAYsettings.REQUEST_MAX_RETRY_TIME_MS), with a sane default.Constraints:
npm test/ existing test runner passes.Notes:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Explain these changes.
Assistant: This PR change adds a new model provider identifier to your shared constants.
What changed
In
src/utils/constants.js, inside theMODEL_PROVIDERenum/object, you added:LMARENA_BRIDGE: 'lmarena-bridge'So the object now recognizes a new provider key (
LMARENA_BRIDGE) that maps to the provider slug/string ('lmarena-bridge').What it means in practice
MODEL_PROVIDER.*comparisons…can now reference
MODEL_PROVIDER.LMARENA_BRIDGEas a first-class option.What it doesn’t do (yet)
This does not implement the provider—no wiring, no handler, no adapter, no routing logic—unless other files in the PR add that. This single-line change only makes the constant available so other code can select
"lmarena-bridge"without hardcoding the string.User: explain it n alayeman non programmer terms
Assistant: This PR basically adds a new “plug-in” option to your app so it can talk to a helper service called LMArenaBridge, which then gives access to a bunch of different AI models through one OpenAI-style doorway.
In normal-person terms:
What this update does
1) Adds a new AI “source” you can choose: LMArena Bridge
Before: your proxy knew about providers like OpenAI/Codex, Forward API, Grok custom, etc.
Now: it also knows about “LMArena Bridge” as another option in the list.
Think of it like adding a new streaming service to a smart TV menu.
2) Adds a list of model names that belong to that new source
It adds a catalog of model options under that provider, like:
So the system can show/validate “these are the models you can request when you’re using this provider”.
3) Adds the actual connector code that forwards requests to the bridge
A new file (
lmarena-core.js) acts like a translator + courier:http://localhost:8000)/health)So: your proxy doesn’t directly “become” those models—it hands the job off to the bridge.
4) Says “this provider speaks OpenAI-style”
Another small file (
lmarena-strategy.js) basically tells your routing system:Meaning it can reuse the same “OpenAI-shaped” request/response flow.
What you (as the operator) would need to do
To actually use it, you’d run that LMArenaBridge side service somewhere and set config values like:
LMARENA_BRIDGE_URL(required)LMARENA_BRIDGE_API_KEY(optional)LMARENA_MODEL_OVERRIDE(optional)No bridge running = this provider won’t work.
One-liner summary
You added a new “middleman” provider that lets your proxy access a big buffet of AI models via a single OpenAI-compati...
This pull request was created from Copilot chat.