Skip to content

chats viewer always shows 0 messages — generationSpan missing input/output #6

Description

@kenibarwick

Bug

npm run chats -- --view=N and chats-tui.ts always show 0 messages for every conversation, even successful ones. The summary list works (it reads from trace metadata), but the full conversation view is broken.

Root cause

In api/chat.js, the generationSpan is ended without logging input or output:

generationSpan?.end({
  metadata: { outputTokens, inputTokens, latencyMs, cost },
})

chats.ts reads conversation content from trace.observations[0].input and trace.observations[0].output, but these are never written, so observations are always empty.

Fix

Add input and output to all three generationSpan?.end() calls (precomputed path, streaming path, and error path):

generationSpan?.end({
  input: messages,
  output: fullOutput,
  metadata: { ... },
})

For the error path, use output: fullOutput || null since the output may be partial or empty.

Impact

The full conversation viewer (--view=N, TUI) is non-functional for all conversations. Only the one-line summary preview works.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions