Skip to content

fix(dgw): change AgentInfo.last_seen from epoch-ms integer to RFC 3339 date-time - #1968

Merged
Benoît Cortier (CBenoit) merged 2 commits into
masterfrom
copilot/change-agentinfo-last-seen-serialization
Sep 2, 2026
Merged

fix(dgw): change AgentInfo.last_seen from epoch-ms integer to RFC 3339 date-time#1968
Benoît Cortier (CBenoit) merged 2 commits into
masterfrom
copilot/change-agentinfo-last-seen-serialization

Conversation

Copilot AI commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The unpublished Agent Tunnel API exposed last_seen_ms: Option<u64> on AgentInfo, an implementation-unit-leaking encoding. Since the API/clients aren't published yet, this is the right time to switch to a semantic date-time boundary instead.

API model (devolutions-gateway/src/api/tunnel.rs)

  • Renamed last_seen_ms: Option<u64>last_seen: Option<time::OffsetDateTime>, serialized via time::serde::rfc3339::option (consistent with the existing MonitorResult::request_start_time convention).
  • Added last_seen_ms_to_datetime, a panic-free conversion from the registry's epoch-millisecond u64 to OffsetDateTime, returning None on overflow instead of panicking.
  • Internal agent_tunnel::registry::AgentInfo::last_seen_ms is unchanged — the registry still tracks milliseconds internally.
  • None is still returned for agents with no runtime/tunnel heartbeat (offline agents).
fn last_seen_ms_to_datetime(last_seen_ms: u64) -> Option<OffsetDateTime> {
    let nanos = i128::from(last_seen_ms).checked_mul(1_000_000)?;
    OffsetDateTime::from_unix_timestamp_nanos(nanos).ok()
}

Tests

  • Updated unit tests for populated/null last_seen.
  • Added coverage for zero timestamp and out-of-range (u64::MAX) conversion.
  • Updated the agent tunnel testsuite assertion (last_seen_mslast_seen).

Generated artifacts

Regenerated via the repository's existing generate-openapi and generate_clients scripts (no manual edits):

  • gateway-api.yaml: field is now type: string, format: date-time, nullable: true.
  • AsciiDoc reference doc updated.
  • .NET client: LastSeenMs (long?) → LastSeen (DateTime?), including removal of the now-obsolete minimum-value validation.
  • TypeScript client: last_seen_ms?: number | nulllast_seen?: string | null.

…ad of epoch-ms

Co-authored-by: CBenoit <3809077+CBenoit@users.noreply.github.com>
Copilot AI changed the title [WIP] Update AgentInfo to expose last heartbeat as RFC 3339 timestamp Change AgentInfo.last_seen from epoch-ms integer to RFC 3339 date-time Sep 2, 2026
@CBenoit
Benoît Cortier (CBenoit) marked this pull request as ready for review September 2, 2026 19:23
Copilot AI balanced review requested due to automatic review settings September 2, 2026 19:23

@CBenoit Benoît Cortier (CBenoit) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CBenoit Benoît Cortier (CBenoit) changed the title Change AgentInfo.last_seen from epoch-ms integer to RFC 3339 date-time fix(dgw): change AgentInfo.last_seen from epoch-ms integer to RFC 3339 date-time Sep 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The populated RFC 3339 JSON representation lacks direct test coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the unpublished Agent Tunnel API to expose last-seen timestamps as RFC 3339 date-times.

Changes:

  • Converts registry epoch milliseconds to OffsetDateTime.
  • Updates API tests and OpenAPI schema.
  • Regenerates TypeScript, .NET, and reference documentation.
File summaries
File Description
testsuite/tests/cli/agent/tunnel.rs Updates the null-field assertion.
devolutions-gateway/src/api/tunnel.rs Adds date-time conversion and API field.
devolutions-gateway/openapi/ts-angular-client/model/agentInfo.ts Updates the TypeScript model.
devolutions-gateway/openapi/gateway-api.yaml Declares the RFC 3339 field.
devolutions-gateway/openapi/dotnet-client/src/Devolutions.Gateway.Client/Model/AgentInfo.cs Updates the .NET model.
devolutions-gateway/openapi/dotnet-client/docs/AgentInfo.md Updates .NET model documentation.
devolutions-gateway/openapi/doc/index.adoc Updates API reference documentation.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread devolutions-gateway/src/api/tunnel.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CBenoit
Benoît Cortier (CBenoit) merged commit eeb5e71 into master Sep 2, 2026
44 checks passed
@CBenoit
Benoît Cortier (CBenoit) deleted the copilot/change-agentinfo-last-seen-serialization branch September 2, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants