fix(session): stamp spawn timestamps in UTC#215
Conversation
Greptile SummaryThis PR fixes mixed-timezone timestamps in
Confidence Score: 5/5Safe to merge — the change is a two-line default clock fix with no effect on callers that inject their own clock. Both managers now default to UTC, matching every other write path. The fix is minimal, well-scoped, and directly verified by two new tests that assert Location() == time.UTC on every affected timestamp field. No logic beyond the clock default is touched. No files require special attention. The only remaining nit (stale godoc on New in session_manager/manager.go) was flagged in a previous review round. Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI as ao CLI
participant SM as session_manager.New
participant LC as lifecycle.New
participant Store as Store
Note over SM: clock = func() time.Time { return time.Now().UTC() }
Note over LC: clock = func() time.Time { return time.Now().UTC() }
CLI->>SM: Spawn(config)
SM->>Store: "CreateSession(rec) CreatedAt=clock()[UTC] UpdatedAt=clock()[UTC]"
SM->>LC: MarkSpawned(id, metadata)
LC->>Store: "UpdateSession(rec) LastActivityAt=clock()[UTC] UpdatedAt=clock()[UTC]"
CLI->>SM: Rename / Activity
SM->>Store: "UpdateSession(rec) UpdatedAt=time.Now().UTC()"
CLI->>CLI: ao session get → all timestamps end in Z
Reviews (3): Last reviewed commit: "fix(session): stamp session timestamps i..." | Re-trigger Greptile |
7d4484d to
2bd891e
Compare
Two clocks defaulted to local time.Now while the rest of the codebase writes UTC, so ao session get showed created and updated in different timezones: - session manager clock → spawn-stamped CreatedAt/UpdatedAt - lifecycle manager clock → activity-driven LastActivityAt/UpdatedAt A real spawn made this visible: createdAt came back UTC but updatedAt/ lastActivityAt were local once the agent reported activity. Default both clocks to UTC. Closes #214
2bd891e to
8fa06ec
Compare
Closes #214.
Problem
ao session getshowedcreatedandupdatedin different timezones. Two clocks defaulted to localtime.Nowwhile the rest of the codebase writes UTC:CreatedAt/UpdatedAtLastActivityAt/UpdatedAtA real spawn made the second one visible: after the first fix
createdAtcame back UTC, butupdatedAt/lastActivityAtwere still local (+05:30) the moment the agent reported activity.Change
Default both clocks to UTC, matching the codebase convention.
Test
TestSpawn_StampsUTCTimestamps(session manager): spawn-stampedCreatedAt/UpdatedAtare UTC.TestMarkSpawned_StampsUTCActivity(lifecycle): activity-drivenLastActivityAtis UTC.go build ./..., fullgo test ./...,gofmt, andgolangci-lintall clean.ao session getshowscreatedandupdatedboth ending inZ.