Skip to content

SDK: decode daemon stdlib-JSON timestamps and durations over HTTP #1631

Closed

Description

@samuv

Problem

The daemon HTTP surface marshals protobuf response structs with Go standard encoding/json. google.protobuf.Timestamp and google.protobuf.Duration therefore arrive as objects shaped like {seconds, nanos}. Protobuf-ES fromJson expects ProtoJSON strings such as an RFC 3339 timestamp or 1.5s duration.

The SDK currently passes these values directly to fromJson, causing ProtocolError responses against a real daemon for data containing these well-known types. Affected surfaces include session snapshots, schedules and fires, learning proposals, learned skills, and dream plans. The mismatch can occur in unary responses and streamed envelopes.

Direction

Normalize the two daemon wire shapes at the HTTP transport boundary before Protobuf-ES decoding. The normalization should be descriptor-guided rather than key-name guessing, handle nested messages, lists, and maps, preserve already-valid ProtoJSON strings, and avoid mutating the registered raw response.

Acceptance criteria

  • Valid stdlib-JSON Timestamp objects decode to the corresponding protobuf value.
  • Valid stdlib-JSON Duration objects decode to the corresponding protobuf value.
  • Normalization works recursively in nested messages, repeated fields, maps, unary responses, and streamed responses.
  • Existing ProtoJSON string representations continue to decode unchanged.
  • Malformed or out-of-range values still produce a typed protocol error rather than silent coercion.
  • Tests cover seconds as numbers and strings, nanos precision, negative durations, and raw JSON preservation.
  • Documentation and the SDK changelog describe the daemon response-format compatibility.

Activity

  1. added
    bug
    on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsdk

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions