You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(api-proxy): add /reflect endpoint for dynamic provider and model discovery (#2253)
* Initial plan
* feat: add reflection endpoint to api-proxy sidecar
Add GET /reflect on port 10000 (management port) that returns the list
of configured API proxy endpoints along with the models supported by
each endpoint.
- fetchJson: helper to fetch and parse JSON responses from provider APIs
- extractModelIds: normalise OpenAI/Anthropic/Copilot {data:[{id}]} and
Gemini {models:[{name}]} formats into sorted string arrays
- cachedModels / resetModelCacheState: in-memory model cache populated
at startup, with reset helper for test isolation
- fetchStartupModels: fetches model lists from all configured providers
concurrently at startup (alongside validateApiKeys)
- reflectEndpoints: builds the reflection payload with per-endpoint
configured status, base_url, port, models_url and cached models
- handleManagementEndpoint: extended to serve GET /reflect
- onListenerReady: triggers fetchStartupModels in addition to validateApiKeys
- All new functions exported and covered by unit tests (306 passing)
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/36f4f63e-88fd-493f-a600-7fab58452dd6
* feat: improve reflection endpoint based on review feedback
- fetchJson: add debug-level logging for network errors and timeouts to
aid operator diagnostics during model discovery
- extractModelIds: extract GEMINI_MODEL_NAME_PREFIX constant and use
startsWith/slice for prefix stripping (clearer than regex)
- Add test for Gemini model names without the models/ prefix
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/36f4f63e-88fd-493f-a600-7fab58452dd6
* fix: address fetchJson hang and Copilot BYOK model-fetch issues
- fetchJson: add res.on('close') handler so the Promise always settles
when the upstream connection drops mid-body without emitting 'end'
or 'error', preventing modelFetchComplete from hanging indefinitely
- fetchStartupModels: gate Copilot /models fetch exclusively on
copilotGithubToken (GitHub OAuth); skip when only COPILOT_API_KEY
(BYOK) is present — consistent with validateApiKeys behaviour where
BYOK-only mode is documented as having no probe endpoint
- Tests: add cases for res.close mid-body drop and BYOK-only skip
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/cd6fa904-5c17-4a7e-bcd6-0f0f44061d0e
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
0 commit comments