Skip to content

Conversation

@xiaoyifan
Copy link
Collaborator

@xiaoyifan xiaoyifan commented Dec 17, 2025

Note

Add trail_id-based chat and traces endpoints with Langfuse tagging and Redis tracking, while keeping legacy rollout routes intact.

  • Routes (FastAPI):
    • Add trail chat completion endpoints: /trails/{trail_id}/chat/completions (+ v1 and project_id variants).
    • Add trail traces endpoints: /trails/{trail_id}/traces and /trails/{trail_id}/traces/pointwise (+ variants).
    • Preserve legacy rollout-based routes.
  • Tagging & Tracking:
    • Inject trail_id and insertion_id tags for trail requests; retain rollout tag set for legacy paths.
    • Generalize Redis tracking to a unified tracking_key (trail_id or rollout_id) for insertion IDs.
  • Langfuse integration:
    • Support trail-based filtering in trace list/detail with retry/backoff.
    • Use tracking_key in logs, completeness checks, and pointwise latest-trace fetch.
  • Models:
    • Extend ChatParams with optional trail_id.
  • Tests:
    • Add tests for trail routes registration, tag injection (trail vs rollout), and Redis key usage; verify health and legacy route presence.

Written by Cursor Bugbot for commit 911daca. This will update automatically on new commits. Configure here.

logger.info(f"Fetching traces for rollout_id '{rollout_id}', expecting {len(expected_ids)} insertion_ids")
if tracking_key:
expected_ids = get_insertion_ids(redis_client, tracking_key)
logger.info(f"Fetching traces for {tracking_label} '{tracking_key}', expecting {len(expected_ids)} insertion_ids")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing variable definitions in fetch_langfuse_traces function

The fetch_langfuse_traces function uses tracking_key and tracking_label variables (at lines 254, 256, 259, 263, 280, 336, 356, 373, 378, 382) but these are never defined in this function. The function only extracts rollout_id at line 226. The corresponding pointwise_fetch_langfuse_trace function was correctly updated to define both tracking_key and tracking_label from trail_id and rollout_id, but this definition block was not added to fetch_langfuse_traces. This will cause a NameError at runtime when accessing the trail traces endpoints.

Fix in Cursor Fix in Web

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants