Skip to content

fix: prevent duplicate turn uploads - #50

Open
johnbuccola wants to merge 2 commits into
langfuse:mainfrom
johnbuccola:jb/fix-duplicate-codex-traces
Open

fix: prevent duplicate turn uploads#50
johnbuccola wants to merge 2 commits into
langfuse:mainfrom
johnbuccola:jb/fix-duplicate-codex-traces

Conversation

@johnbuccola

Copy link
Copy Markdown

Problem

The Stop hook uploads a trailing in-progress turn without recording it in the sidecar. A later hook uploads the completed turn under a new trace ID, which duplicates usage. Concurrent Stop hooks can also race past the sidecar.

Fix

  • wait until a turn has a task_complete or turn_aborted event
  • serialize top-level uploads per rollout with a short-lived atomic lock
  • recover locks older than the hook timeout

Explicitly interrupted turns remain eligible because turn_aborted marks them completed.

Verification

  • 39 tests pass
  • formatting and TypeScript checks pass
  • committed bundle reproduces cleanly

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


John Buccola seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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