Skip to content

.NET: [Bug]: CosmosChatHistoryProvider.MessageTtlSeconds = null #6992

Description

@eguzchin-isoftwareiq

Description

from CosmosChatHistoryProvider.cs

/// <summary>
/// Gets or sets the Time-To-Live (TTL) in seconds for messages.
/// Default is 86400 seconds (24 hours). Set to null to disable TTL.
/// </summary>
public int? MessageTtlSeconds { get; set; } = 86400;

"Set to null to disable TTL." - does not work - ttl = null not allowed
Cosmos db exception -
The input ttl 'null' is invalid. Ensure to provide a nonzero positive integer less than or equal to '2147483647', or '-1' which means never expire."

https://learn.microsoft.com/en-us/cosmos-db/time-to-live

I think your fogot
[JsonProperty ( NullValueHandling = NullValueHandling.Ignore )]

for

[Newtonsoft.Json.JsonProperty("ttl")]
public int? Ttl { get; set; }

Code Sample

Error Messages / Stack Traces

Package Versions

"Microsoft.Agents.AI.CosmosNoSql" Version="1.13.0-preview.260703.1"

.NET Version

NET 8.0

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETUsage: [Issues, PRs], Target: .NetreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions