发布

  • [NA] [BE] Fix silently-dropped demo experiment items in prod (#6454)

    frostbyte_neo 发布于 2026-04-23 12:39:28 +00:00

    • [NA] [BE] Use sync REST for experiment items to fix silent drops in prod

    experiment.insert() goes through the SDK's async streamer queue — the actual
    POST only happens on client.flush(). In production, flush() can return True
    while silently dropping messages on timeout, leaving the experiment with 0
    items in the UI even though the "Seeded experiment" log fires.

    Switch to client.rest_client.experiments.create_experiment_items(...) which
    is a direct synchronous REST call that raises ApiError on non-2xx, guaranteeing
    the items land before we log success. All other writes in this flow already
    use the sync REST path.

    Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

    • [NA] [BE] Pin project_name on experiment items to avoid CH ingest race

    The backend's create-experiment-items handler resolves project_id via two
    paths (ExperimentItemService.java):

    1. If project_name is set — resolve via projectService.retrieveByNamesOrCreate
    2. Otherwise — look up each trace by trace_id and use the trace's project_id

    Path (2) races with ClickHouse ingestion of the traces we POSTed milliseconds
    earlier — in prod the trace lookup can return empty, leaving experiment_items
    with project_id=null and invisible in the project-filtered UI.

    Pin project_name explicitly so resolution is deterministic and independent of
    CH replica lag.

    Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com


    Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com

    下载附件