Conversation
…fixes #467) The fix pipeline was only writing to audit_events. Two tables remained empty after every night-shift run: - session_outcomes: _emit_session_event only called emit_audit_event; record_session_outcome / record_session were never invoked. - runs: create_run / update_run_totals / complete_run were never called. - engine.py did not pass conn to FixPipeline, so even if the write code had existed it would have had no DB access. Fix: - Add conn parameter to FixPipeline.__init__; NightShiftEngine._process_fix now passes self._conn. - Add _record_session_to_db helper that builds a full SessionOutcomeRecord (all 18 columns) and calls engine.state.record_session + update_run_totals. - Add _try_complete_run helper (best-effort complete_run wrapper). - _emit_session_event now also calls _record_session_to_db after emitting the audit event. - process_issue calls create_run at start and _try_complete_run at every exit point. All DB writes are best-effort (exceptions logged and swallowed) consistent with the existing pattern. When conn=None the new code paths are no-ops, preserving backward compatibility. Five regression tests added covering: session_outcomes written per session, runs row lifecycle, correct run_id/archetype fields, conn=None no-op, and engine wiring.
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
The night-shift fix pipeline was only writing telemetry to
audit_events. After 9 fix pipelines and 37 sessions, bothruns(0 rows) andsession_outcomes(0 rows) remained empty.Three root causes fixed:
_emit_session_eventonly calledemit_audit_event;record_sessionwas never invoked.create_run/update_run_totals/complete_runwere never called.NightShiftEngine._process_fixnever passedconntoFixPipeline, so DB access was impossible.Closes #467
Changes
agent_fox/nightshift/fix_pipeline.pyconnparam;_record_session_to_dbhelper writes fullSessionOutcomeRecord(18 cols);_try_complete_runhelper;_emit_session_eventnow also writes tosession_outcomes;process_issuecallscreate_run/complete_runat lifecycle boundariesagent_fox/nightshift/engine.pyconn=self._conntoFixPipelinetests/unit/nightshift/test_fix_pipeline.pyTests
test_session_outcomes_written_for_each_session: record_session called ≥3× for triage+coder+reviewertest_runs_row_created_even_on_empty_body: create_run/complete_run called at all exit pathstest_session_outcome_has_run_id_and_archetype: all records carry correct run_id and archetypetest_no_db_writes_when_conn_is_none: backward compat — no DB calls when conn=Nonetest_engine_passes_conn_to_fix_pipeline: engine wiring verifiedVerification
Auto-generated by
af-fix.