Repository navigation
Conversation
Changing a dataset's agent model resets the lock of its QA/auto training jobs so they are retried with the new model. The reset was fired without await and before the dataset update transaction ran, so a worker could pick a released job while the dataset still pointed at the old model, and a failed reset became an unhandled rejection. Run the reset after mongoSessionRun commits, and await it. Claude-Session: https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq
Collaborator
|
This is a catch-all mechanism that does not require strict await and meets expectations. The new version has removed this update and will no longer automatically refresh and retry |
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.
Problem
POST /api/core/dataset/updateresets the lock of the dataset's QA/auto training jobs when the agent model changes, so that they are retried with the new model. However, the reset (updateTraining) has two problems:mongoSessionRun(onUpdate)writes the newagentModelId. The QA worker reads the dataset's agent model when it picks a job (generateQA.ts,getDatasetModelReference(data.dataset, 'agent')), so a worker can pick a released job while the dataset still points at the old model.updateManyfails, the error becomes an unhandled rejection instead of failing the request.Fix
Move the reset after
mongoSessionRunandawaitit. The jobs are released only once the new model is committed. If the update transaction throws, they are not released at all.Test
test/api/core/dataset/update.test.tsgets a new case, "releases QA training jobs only after the new agent model is stored". It spies onMongoDatasetTraining.updateManyand records the dataset's storedagentModelIdat the moment the reset runs.expected [ 'original-agent' ] to deeply equal [ '<new model id>' ].npx vitest run -c vitest.config.ts test/api/core/dataset/inprojects/app: 37 files, 194 tests pass.https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq