fix(reset): clear session-scoped tables on reset (fixes #501)#502
Open
fix(reset): clear session-scoped tables on reset (fixes #501)#502
Conversation
…it death-loop (fixes #501) After a block_limit run, reset --hard left stale data in runs, session_outcomes, review_findings, verification_results, drift_findings, and blocking_history tables. The stale runs.status='block_limit' caused load_state_from_db() to load a terminal status, making the engine loop exit immediately on every subsequent run — a self-perpetuating death-loop. Add _clear_session_tables() and call it from all four reset paths (reset_all, reset_task, reset_spec, _perform_hard_reset).
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
After a
block_limitrun,reset --hardleft stale data in six session-scoped DB tables. The staleruns.status='block_limit'causedload_state_from_db()to load a terminal status, making the engine loop exit immediately on every subsequentagent-fox codeinvocation — a self-perpetuating death-loop with no CLI recovery path.Closes #501
Changes
agent_fox/engine/reset.py_clear_session_tables()helper that DELETEs rows fromruns,session_outcomes,review_findings,verification_results,drift_findings,blocking_history. Called from all four reset paths:reset_all,reset_task,reset_spec,_perform_hard_reset. For scoped resets, spec-specific tables are filtered by spec_name;runsis always fully cleared.tests/unit/engine/test_reset.pyTests
TestHardResetClearsSessionTables(6 tests): each session table cleared byhard_reset_allTestSoftResetClearsSessionTables(4 tests):reset_allandreset_taskclear blocking stateTestResetSpecClearsSessionTables(1 test): spec-scoped cleanup preserves other specs' dataVerification
Auto-generated by
af-fix.