Skip to content

fix(engine): remove duplicate session_outcomes insertion (fixes #473)#477

Open
mickume wants to merge 1 commit intodevelopfrom
fix/issue-473-duplicate-session-outcomes-rows
Open

fix(engine): remove duplicate session_outcomes insertion (fixes #473)#477
mickume wants to merge 1 commit intodevelopfrom
fix/issue-473-duplicate-session-outcomes-rows

Conversation

@mickume
Copy link
Copy Markdown
Contributor

@mickume mickume commented Apr 17, 2026

Summary

  • Removed the redundant sink-based session outcome recording path from session_lifecycle._record_session_to_sink() — session outcomes are now written exclusively by SessionResultHandler.process() via state.record_session(), eliminating the duplicate row per session
  • Removed the now-unused record_session_to_sink() function from review_persistence.py and dead sink_outcome enrichment code from session_lifecycle.py
  • Added regression test verifying _run_and_harvest no longer dispatches record_session_outcome to sinks

Closes #473

Changes

File Change
agent_fox/engine/session_lifecycle.py Removed _record_session_to_sink() call/method, dead sink_outcome code, unused dataclasses import
agent_fox/engine/review_persistence.py Removed record_session_to_sink() function and unused SessionOutcome import
tests/unit/engine/test_session_lifecycle.py Added regression test for single-write invariant
tests/unit/cli/test_code.py Removed obsolete test asserting removed behavior

Tests

  • test_session_lifecycle.py::TestNoDuplicateSessionOutcomeWrite: verifies sink's record_session_outcome is not called from _run_and_harvest

Verification

  • All existing tests pass: ✅ (4985 passed)
  • New tests pass: ✅
  • Linter / formatter: ✅
  • No regressions: ✅

Auto-generated by af-fix.

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.
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.

1 participant