ag-ui-protocol / ag-ui-protocol/ag-ui

Rust ag-ui-core: ThreadId/RunId/MessageId reject non-UUID string IDs

Đang mở
#2,195 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug SDK
Ngôn ngữ chính
Python
Star
15.9k
Fork
1.4k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
163

Mô tả

## Summary

In the Rust `ag-ui-core`, the ID newtypes (`ThreadId`, `RunId`, `MessageId`, `AgentId`) are strict `Uuid` wrappers: both `FromStr` and the derived `Deserialize` hard-fail on any string that isn't a syntactically valid UUID. But the AG-UI protocol (and the TypeScript `@ag-ui/core`) treat these IDs as **plain strings**. So any agent/server whose thread/run/message IDs are not bare UUIDs cannot interoperate through the Rust SDK.

## Reproduction (verified against `ag-ui-core = "0.1.0"`)

Parsing a non-UUID ID as a `ThreadId` fails both ways:

```rust
use ag_ui_core::types::ids::ThreadId;
use std::str::FromStr;

// LangGraph-style run id, or any composite id
ThreadId::from_str("lc_run--1234"); // Err(uuid::Error)
serde_json::from_str::("\"mytool:host:9c1b...\""); // Err: "UUID parsing failed: invalid length"
```

## Impact

Any server that emits non-UUID thread/run IDs — LangGraph (`lc_run--…`), or tools that use composite/namespaced IDs — cannot round-trip `RUN_STARTED`/`RUN_FINISHED`/`TEXT_MESSAGE_*` events through the Rust SDK, because every such event carries a typed `ThreadId`/`MessageId`. The TS SDK has no such restriction.

## Note

A fix authored by @MikeSchirtzinger already exists on the server-crate branch (#972), but it's entangled in that large, unmerged PR. I'm opening a **focused, standalone PR** that extracts just the `ids.rs` fix (round-trip fidelity for arbitrary strings) rebased onto current `main`, so it can land independently. Credit for the fix is Mike's; the PR only decouples it.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.