Skip to content

[Bug] committed_metadata missing from the scope/collection reservations endpoint responses #201

@Prikis

Description

@Prikis

Description
Following up on the recent metadata persistence updates, committed_metadata is successfully saved and returned when querying a single reservation directly. However, the metadata fields are missing entirely from the items returned by the broader list/scope endpoint.

This creates an inconsistency where audit metadata can only be verified by polling individual IDs rather than viewing them in aggregate via the collection query.

Reproduction Commands & Observed Behavior

  1. Single Reservation Endpoint (Working as expected)
    When fetching the specific reservation via this request:
curl --location 'http://localhost:7878/v1/reservations/8e150f55-33f4-4f71-a7cf-780307f432e8' \
--header 'Content-Type: application/json' \
--header 'X-Cycles-API-Key: [REDACTED]' \
--data ''

The response includes the committed payload and the committed_metadata object perfectly:

{
    "reservation_id": "8e150f55-33f4-4f71-a7cf-780307f432e8",
    "status": "COMMITTED",
    "idempotency_key": "19ea0e9a-eacb-4428-8573-2c09e483b8e5",
    "subject": {
        "tenant": "scalerx",
        "workspace": "f44e2612-4071-4e43-9a00-75f500fbb5e5",
        "app": null,
        "workflow": null,
        "agent": null,
        "toolset": null,
        "dimensions": null
    },
    "action": {
        "kind": "REQUEST",
        "name": "runOpenAIRequestCycles",
        "tags": null
    },
    "reserved": {
        "unit": "CREDITS",
        "amount": 100
    },
    "created_at_ms": 1781868375997,
    "expires_at_ms": 1781868435997,
    "finalized_at_ms": 1781868381288,
    "scope_path": "tenant:scalerx/workspace:f44e2612-4071-4e43-9a00-75f500fbb5e5",
    "affected_scopes": [
        "tenant:scalerx",
        "tenant:scalerx/workspace:f44e2612-4071-4e43-9a00-75f500fbb5e5"
    ],
    "committed": {
        "unit": "CREDITS",
        "amount": 100
    },
    "committed_metadata": {
        "request_id": "myContextDataEntryHexIdThatIWillAddAsAParameterToThisMethod"
    }
}
  1. Scope / List Endpoint (Bug)
    When retrieving the list of reservations via the collection endpoint:
curl --location --request GET 'http://localhost:7878/v1/reservations?tenant=scalerx&from=2026-06-17T12%3A18%3A01.465Z&sort_by=created_at_ms&sort_dir=asc' \
--header 'Content-Type: application/json' \
--header 'X-Cycles-API-Key: [REDACTED]' \
--data '{}'

The exact same reservation entry (8e150f55-33f4-4f71-a7cf-780307f432e8) is returned inside the list array but completely drops the committed and committed_metadata blocks:

JSON
{
    "reservations": [
        {
            "reservation_id": "8e150f55-33f4-4f71-a7cf-780307f432e8",
            "status": "COMMITTED",
            "idempotency_key": "19ea0e9a-eacb-4428-8573-2c09e483b8e5",
            "subject": {
                "tenant": "scalerx",
                "workspace": "f44e2612-4071-4e43-9a00-75f500fbb5e5",
                "app": null,
                "workflow": null,
                "agent": null,
                "toolset": null,
                "dimensions": null
            },
            "action": {
                "kind": "REQUEST",
                "name": "runOpenAIRequestCycles",
                "tags": null
            },
            "reserved": {
                "unit": "CREDITS",
                "amount": 100
            },
            "created_at_ms": 1781868375997,
            "expires_at_ms": 1781868435997,
            "finalized_at_ms": 1781868381288,
            "scope_path": "tenant:scalerx/workspace:f44e2612-4071-4e43-9a00-75f500fbb5e5",
            "affected_scopes": [
                "tenant:scalerx",
                "tenant:scalerx/workspace:f44e2612-4071-4e43-9a00-75f500fbb5e5"
            ]
        }
    ]
}

Expected Behavior
The objects populated inside the collection endpoint GET /v1/reservations should map or include the same projection data as the individual query, ensuring that audit data fields (committed_metadata) are visible globally across reports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions