fix(trace messages): send ids (plural) to match backend field name#88
Merged
Merged
Conversation
The backend BatchTraceMessagesRequestBody struct uses json:"ids" but the CLI was sending body["id"] (singular), causing the trace ID filter to be silently dropped by JSON unmarshaling — every --trace-ids call returned unfiltered traces instead of the requested ones. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Andy Young (ayoung19)
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The `trace messages` command was sending `body["id"]` (singular) when filtering by trace IDs, but the backend `BatchTraceMessagesRequestBody` struct expects `"ids"` (plural, `json:"ids"`). This caused the trace ID filter to be silently dropped — the backend unmarshaled the field to its zero value (nil slice) and returned all traces instead of the requested ones.
In `internal/cmd/message.go`:
```go
// Before (broken): backend ignores this field, returns unfiltered results
body["id"] = ids
// After (fixed): matches json:"ids" on BatchTraceMessagesRequestBody.Ids
body["ids"] = ids
```
The backend `POST /v2/traces/messages` reads from `body.Ids` (JSON field `"ids"`). With the singular key, every `--trace-ids` invocation silently returned unfiltered results rather than the specified traces. This is the specific failure mode causing the issues-agent's phase 1b screener to get wrong data when it calls `langsmith trace messages --trace-ids`.
Test Plan
Release Note
Fix `langsmith trace messages --trace-ids` filter being silently ignored due to wrong JSON field name (`id` → `ids`).