Skip to content

[codex] Fix agent GenAI columns and chat refs#6899

Closed
bcsherma wants to merge 1 commit into
masterfrom
codex/fix-agent-genai-columns-chat
Closed

[codex] Fix agent GenAI columns and chat refs#6899
bcsherma wants to merge 1 commit into
masterfrom
codex/fix-agent-genai-columns-chat

Conversation

@bcsherma
Copy link
Copy Markdown
Member

@bcsherma bcsherma commented May 20, 2026

Description

Fixes the Agent spans/query and chat surfaces for GenAI spans.

  • Adds cache token fields to the default and chat/detail projections so cache read/write token values can be fetched back, not just used in stats histograms.
  • Extends the agent span schema/query allowlist to cover persisted GenAI typed columns plus raw_span_dump when explicitly requested.
  • Normalizes ref-like strings inside GenAI OTLP protobuf attributes at the external ingest boundary, so weave:///... refs are stored internally as weave-trace-internal:///... before ClickHouse insert.
  • Adds focused query-builder and converter regression tests.

Root cause:

  • Cache token columns and several typed GenAI fields existed in persisted spans/stats but were missing from the span list/detail projection path.
  • GenAI OTLP ingest converted the request project_id and wb_user_id, but did not walk refs embedded inside protobuf AnyValue attributes. Those external refs were stored directly in span fields such as content_refs. Later, the public response adapter correctly treated external refs in an internal response as invalid and raised InvalidInternalRef, surfacing as a 500.

Testing

  • uv run pytest tests/trace_server/test_trace_server_interface_util.py tests/trace_server/test_trace_server_converter.py tests/trace_server/query_builder/test_agent_query_builder.py
  • Verified new GenAI OTLP ingest stores seeded content_refs / object_refs as weave-trace-internal:///... in local ClickHouse.
  • Verified locally against tilt prod_weavetrace: /agents/traces/chat and /agents/conversations/chat returned 200 for newly seeded bcanfieldsherman/agents-lorem-ipsum rows.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@bcsherma bcsherma changed the title Fix agent genai columns and chat refs [codex] Fix agent GenAI columns and chat refs May 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../trace_server/query_builder/agent_query_builder.py 85.71% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@wandbot-3000
Copy link
Copy Markdown

wandbot-3000 Bot commented May 20, 2026

@bcsherma bcsherma force-pushed the codex/fix-agent-genai-columns-chat branch from ddfe87f to d5bbe6f Compare May 20, 2026 04:56
@bcsherma bcsherma force-pushed the codex/fix-agent-genai-columns-chat branch from d5bbe6f to eb9a436 Compare May 20, 2026 23:17
@bcsherma bcsherma closed this May 21, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant