From 205efd40a14de0c216462d29bab6ee90580fba62 Mon Sep 17 00:00:00 2001 From: Benson Wong Date: Mon, 19 Jan 2026 17:37:00 -0800 Subject: [PATCH] proxy: extend /running endpoint with additional process data (#474) Extend the /running endpoint to return more details about running processes beyond just model and state. - add cmd field to show the command being executed - add proxy field to show the proxy URL - add ttl (UnloadAfter) for automatic unloading configuration - add name and description for model metadata - update tests to verify new fields are returned correctly fixes #471 --- proxy/proxymanager.go | 9 +++++++-- proxy/proxymanager_test.go | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/proxy/proxymanager.go b/proxy/proxymanager.go index cb13fb3d..9115d810 100644 --- a/proxy/proxymanager.go +++ b/proxy/proxymanager.go @@ -928,8 +928,13 @@ func (pm *ProxyManager) listRunningProcessesHandler(context *gin.Context) { for _, process := range processGroup.processes { if process.CurrentState() == StateReady { runningProcesses = append(runningProcesses, gin.H{ - "model": process.ID, - "state": process.state, + "model": process.ID, + "state": process.state, + "cmd": process.config.Cmd, + "proxy": process.config.Proxy, + "ttl": process.config.UnloadAfter, + "name": process.config.Name, + "description": process.config.Description, }) } } diff --git a/proxy/proxymanager_test.go b/proxy/proxymanager_test.go index 2f01a0ff..ff54ac4b 100644 --- a/proxy/proxymanager_test.go +++ b/proxy/proxymanager_test.go @@ -672,8 +672,13 @@ func TestProxyManager_RunningEndpoint(t *testing.T) { // Define a helper struct to parse the JSON response. type RunningResponse struct { Running []struct { - Model string `json:"model"` - State string `json:"state"` + Model string `json:"model"` + State string `json:"state"` + Cmd string `json:"cmd"` + Proxy string `json:"proxy"` + TTL int `json:"ttl"` + Name string `json:"name"` + Description string `json:"description"` } `json:"running"` } @@ -721,6 +726,11 @@ func TestProxyManager_RunningEndpoint(t *testing.T) { // Is the model loaded? assert.Equal(t, "ready", response.Running[0].State) + + // Verify extended fields are present + assert.NotEmpty(t, response.Running[0].Cmd, "cmd should be populated") + assert.NotEmpty(t, response.Running[0].Proxy, "proxy should be populated") + assert.Equal(t, 0, response.Running[0].TTL, "ttl should default to 0") }) }