fix(engine): remove duplicate session_outcomes insertion (fixes #473)#477
Open
fix(engine): remove duplicate session_outcomes insertion (fixes #473)#477
Conversation
Two independent code paths were inserting rows into session_outcomes for every session: the sink-based path in session_lifecycle._record_session_to_sink (basic fields, cost=0, model=NULL) and the DB-based path in result_handler.SessionResultHandler.process (complete fields). Remove the redundant sink path — the result_handler path is the authoritative single source of truth.
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.
Summary
session_lifecycle._record_session_to_sink()— session outcomes are now written exclusively bySessionResultHandler.process()viastate.record_session(), eliminating the duplicate row per sessionrecord_session_to_sink()function fromreview_persistence.pyand deadsink_outcomeenrichment code fromsession_lifecycle.py_run_and_harvestno longer dispatchesrecord_session_outcometo sinksCloses #473
Changes
agent_fox/engine/session_lifecycle.py_record_session_to_sink()call/method, deadsink_outcomecode, unuseddataclassesimportagent_fox/engine/review_persistence.pyrecord_session_to_sink()function and unusedSessionOutcomeimporttests/unit/engine/test_session_lifecycle.pytests/unit/cli/test_code.pyTests
test_session_lifecycle.py::TestNoDuplicateSessionOutcomeWrite: verifies sink'srecord_session_outcomeis not called from_run_and_harvestVerification
Auto-generated by
af-fix.