Repository navigation
fix(buffs): preserve attempt attributes and isolate mutable state in _derive_new_attempt - #2198
Merged
jmartin-tech merged 1 commit intoOct 7, 2026
Conversation
Collaborator
|
Expands on #2156, these should land together. |
…_derive_new_attempt When deriving new attempts in Buff._derive_new_attempt, reverse_translation_outputs and intent were omitted from the Attempt constructor call, causing derived attempts (such as from paraphrase or multilingual buffs) to lose their intent metadata and reverse translation outputs. Additionally, notes, probe_params, targets, and detector_results were passed by reference without copying. When new_attempt.notes['buff_creator'] was set, it mutated source_attempt.notes in-place. This commit: - Propagates intent and deepcopies reverse_translation_outputs to derived attempts. - Deepcopies notes, detector_results, targets, and probe_params to prevent mutating source attempts. - Adds regression unit tests covering attribute preservation and mutation isolation. Signed-off-by: bodapatisaikrishna <saikrishnabodapati@gmail.com>
bodapatisaikrishna
force-pushed
the
fix/buff-preserve-intent-attributes
branch
from
September 17, 2026 02:58
33ddfde to
00a2109
Compare
Contributor
Author
|
Thanks @jmartin-tech! Agreed completely. PR #2156 covers deep-copying I have rebased this branch onto current |
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.
Description
When deriving new attempts in
Buff._derive_new_attempt(),reverse_translation_outputsandintentwere omitted from theAttempt(...)constructor call. As a result:intent(such asIntentProbe,TAPIntent,GrandmaIntent,DirectIntent,DoNotAnswer, etc.) lost theirintentmetadata when processed by buffs (it reverted toNone).reverse_translation_outputslost their translation output mapping on derived attempts.In addition,
notes,probe_params,targets, anddetector_resultswere previously passed by reference directly into the newAttempt. WhenBuff._derive_new_attemptsetnew_attempt.notes["buff_creator"] = self.__class__.__name__, it mutated the dictionary belonging tosource_attempt.notes.Changes
intentand deepcopyreverse_translation_outputsinBuff._derive_new_attempt().notes,probe_params,targets,detector_results) to ensure complete isolation between source and derived attempts.tests/buffs/test_buffs.pyverifying that:intentandreverse_translation_outputsare preserved.Verification
pytest tests/buffs/test_buffs.pyand ensure tests pass:derived.intentmatchesorig.intent,derived.reverse_translation_outputsmatchesorig.reverse_translation_outputs.