Conversation
|
|
||
| text = parse_text(result) | ||
| if not text.strip(): | ||
| token_counts = tokens_by_model(text) |
There was a problem hiding this comment.
Bug: When an S3 upload fails during transcription, the call to update_transcription omits the llm_tokens_by_encoding parameter, preventing the token count from being saved for the failed task.
Severity: MEDIUM
Suggested Fix
Modify the update_transcription call within the if s3_uri is None: block to include the llm_tokens_by_encoding=token_counts argument. This will ensure token counts are persisted consistently across all failure scenarios, aligning with the behavior of other error-handling paths.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: schedulers/transcription.py#L90
Potential issue: In the transcription scheduler, token counts are calculated and stored
in the `token_counts` variable. If the subsequent S3 upload fails, `s3_uri` will be
`None`, triggering a failure path. In this specific failure case, the call to
`update_transcription` on line 102 omits the `llm_tokens_by_encoding=token_counts`
argument. This contradicts the logic in other success and failure paths where the token
counts are correctly passed. As a result, when a transcription fails due to an S3 upload
issue, the token count information for that task is lost instead of being persisted with
the 'failed' status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
llm_tokens_by_modelcolumn aligns with other columns for readability.Description
utils/tokens.pysotokens_by_modelreturns zeros for every model whentext.strip()is empty and keepLLM_TOKEN_MODELS-based mapping.schedulers/transcription.pyto computetoken_counts = tokens_by_model(raw_text)using the rawparse_text(result)output and then replace emptytextwith the friendly fallback string before persisting results.llm_tokens_by_model=token_countson both successful and failed updates inupdate_transcriptioncalls.README.mdspacing for thellm_tokens_by_modelJSON column to align with other schema columns.Testing
Codex Task