Skip to content

fix(agent): reset session state between reviews - #855

Open
HissanT wants to merge 12 commits into
ascherj:mainfrom
HissanT:fix/43-uncleared-session-state
Open

fix(agent): reset session state between reviews#855
HissanT wants to merge 12 commits into
ascherj:mainfrom
HissanT:fix/43-uncleared-session-state

Conversation

@HissanT

@HissanT HissanT commented Aug 5, 2026

Copy link
Copy Markdown

Summary

This PR fixes the stale agent session-state bug where a later review for the same profile could keep tool results from an earlier review. The orchestrator now starts each review run with a fresh in-memory context cache and saves only the current review's tool results to the session store.

Issue

Closes #43

Changes

  • Added focused unit coverage for review session boundaries in tests/unit/test_orchestrator_session_state.py.
  • Reset the orchestrator's in-memory ContextManager at the start of each review run.
  • Stopped loading and merging previous persisted session state into the current review.
  • Saved only the current review's tool results back to the session store.
  • Updated docs/JOURNAL.md with Week 9 check-ins and validation notes.

Testing

  • Unit tests pass (make test-unit) with documented pre-existing failures/no new failures
  • Integration tests pass (make test-integration)
  • Linter passes (make lint) on touched files; full repo has documented pre-existing failures
  • Type checker passes (make typecheck) with documented pre-existing failures/no new touched-file failures
  • New/updated tests cover the changes

Focused validation:

  • .venv\Scripts\pytest.exe tests\unit\test_orchestrator_session_state.py -v -m unit -> 2 passed
  • .venv\Scripts\ruff.exe check agent\orchestrator.py tests\unit\test_orchestrator_session_state.py -> passed
  • .venv\Scripts\black.exe --check agent\orchestrator.py tests\unit\test_orchestrator_session_state.py -> passed

Full-suite note:

  • make is not available in my local PowerShell environment, so I ran the matching virtualenv commands directly.
  • Before this fix, the full unit suite had 53 failures.
  • After this fix, the full unit suite still has 53 failures, while the 2 new orchestrator tests pass.
  • Full ruff, black, and mypy checks also had pre-existing failures across unrelated files.

Screenshots / Demo

Not applicable.

Notes for Reviewers

Please focus on agent/orchestrator.py and tests/unit/test_orchestrator_session_state.py. The intended behavior is that each new review gets fresh tool state, while memoization remains available inside the current run only.

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.

Agent session state is not cleared between reviews for the same user

1 participant