From 7f84ac7960f0d401caae32675567c62d08b1a22c Mon Sep 17 00:00:00 2001 From: Jon Langevin Date: Tue, 14 Jul 2026 09:03:00 -0400 Subject: [PATCH] fix(protocol): decode agent creation time --- protocol/client_test.go | 5 ++++- protocol/types.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/protocol/client_test.go b/protocol/client_test.go index 19b1b43..8eb9b55 100644 --- a/protocol/client_test.go +++ b/protocol/client_test.go @@ -198,7 +198,7 @@ func TestClientListsAgentsAndLeasesWithBearerAuth(t *testing.T) { } switch r.URL.Path { case "/v1/agents": - _, _ = w.Write([]byte(`{"agents":[{"id":"agent-1","org_id":"org-1","pool_id":"pool-1","status":"online","capabilities":{"os":"linux","arch":"amd64","runtime_backend_reports":[{"protocol_version":"compute.v1alpha1","backend_id":"podman-rootless","family":"podman","tool":"podman","version":"5.0.0","status":"supported","isolation_mode":"user-namespace","runtime_profiles":["sandboxed-oci-v1"]}]},"last_seen_at":"2026-07-11T12:00:00Z"}],"summary":{"total":1,"active":1,"stale":0,"offline":0,"registered":1,"historical":0}}`)) + _, _ = w.Write([]byte(`{"agents":[{"id":"agent-1","org_id":"org-1","pool_id":"pool-1","status":"online","capabilities":{"os":"linux","arch":"amd64","runtime_backend_reports":[{"protocol_version":"compute.v1alpha1","backend_id":"podman-rootless","family":"podman","tool":"podman","version":"5.0.0","status":"supported","isolation_mode":"user-namespace","runtime_profiles":["sandboxed-oci-v1"]}]},"last_seen_at":"2026-07-11T12:00:00Z","created_at":"2026-07-01T10:30:00Z"}],"summary":{"total":1,"active":1,"stale":0,"offline":0,"registered":1,"historical":0}}`)) case "/v1/leases": _, _ = w.Write([]byte(`{"leases":[{"id":"lease-1","task_id":"task-1","worker_id":"agent-1","pool_id":"pool-1","executor":{"provider":"provider-1","version":"v1"},"capability_snapshot":{"os":"linux","arch":"amd64"},"provider_artifact_specs":[{"name":"product_json","required":true,"content_type":"application/json","max_bytes":4096}],"leased_at":"2026-07-11T11:59:00Z","expires_at":"2026-07-11T12:01:00Z"}]}`)) default: @@ -218,6 +218,9 @@ func TestClientListsAgentsAndLeasesWithBearerAuth(t *testing.T) { if len(agents) != 1 || agents[0].ID != "agent-1" || agents[0].Status != protocol.AgentOnline { t.Fatalf("agents = %+v", agents) } + if want := time.Date(2026, 7, 1, 10, 30, 0, 0, time.UTC); !agents[0].CreatedAt.Equal(want) { + t.Fatalf("created_at = %s, want %s", agents[0].CreatedAt, want) + } if reports := agents[0].Capabilities.RuntimeBackendReports; len(reports) != 1 || reports[0].BackendID != "podman-rootless" { t.Fatalf("runtime backend reports = %+v", reports) } diff --git a/protocol/types.go b/protocol/types.go index 179dee8..9bdeb6e 100644 --- a/protocol/types.go +++ b/protocol/types.go @@ -3919,6 +3919,7 @@ type Agent struct { ComponentVersions []AgentComponentVersion `json:"component_versions,omitempty"` SupervisorProfiles []AgentSupervisorProfileStatus `json:"supervisor_profiles,omitempty"` LastSeenAt time.Time `json:"last_seen_at,omitempty"` + CreatedAt time.Time `json:"created_at,omitempty"` } type AgentNetworkProfile struct {