From cedba9bf8382ed52b4e2358f537a8bbf236e16d7 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Fri, 27 Mar 2026 22:56:39 -0700 Subject: [PATCH] Fix mcp ps uptime: parse StartedAt from podman ps JSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List() was not extracting the StartedAt field from podman's JSON output, so LiveCheck always returned zero timestamps and the CLI showed "-" for every container's uptime. podman ps --format json includes StartedAt as a Unix timestamp (int64). Parse it into ContainerInfo.Started so the existing LiveCheck → CLI uptime display chain works. Co-Authored-By: Claude Opus 4.6 (1M context) --- internal/runtime/podman.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/internal/runtime/podman.go b/internal/runtime/podman.go index a6996e5..846a5b4 100644 --- a/internal/runtime/podman.go +++ b/internal/runtime/podman.go @@ -215,10 +215,11 @@ func (p *Podman) ImageExists(ctx context.Context, image string) (bool, error) { // podmanPSEntry is a single entry from podman ps --format json. type podmanPSEntry struct { - Names []string `json:"Names"` - Image string `json:"Image"` - State string `json:"State"` - Command []string `json:"Command"` + Names []string `json:"Names"` + Image string `json:"Image"` + State string `json:"State"` + Command []string `json:"Command"` + StartedAt int64 `json:"StartedAt"` } // List returns information about all containers. @@ -240,12 +241,16 @@ func (p *Podman) List(ctx context.Context) ([]ContainerInfo, error) { if len(e.Names) > 0 { name = e.Names[0] } - infos = append(infos, ContainerInfo{ + info := ContainerInfo{ Name: name, Image: e.Image, State: e.State, Version: ExtractVersion(e.Image), - }) + } + if e.StartedAt > 0 { + info.Started = time.Unix(e.StartedAt, 0) + } + infos = append(infos, info) } return infos, nil