Fix/43: agent tool session now cleared - #1008
Open
ec6862 wants to merge 8 commits into
Open
Conversation
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
Fixes a session-state leak in the agent orchestrator. When the same user
requested a second review,
Orchestrator.run()loaded the previous review'sstored state and merged the new results onto it with
dict.update(). Any toolthat ran in an earlier review but not the current one (e.g.
skill_extractorwhen a résumé was removed) left stale output behind in the stored session, so
the user's re-review reflected a portfolio version that no longer existed. This
PR makes each review persist only its own results, so re-reviews start clean.
Issue
Closes #43
Changes
agent/orchestrator.py: Removed the load-and-merge of prior session state(
session_store.get(...)+session_state.update(results)). The currentreview's
resultsare now written directly withsession_store.set(profile_id, results), which overwrites the stored sessioninstead of accumulating stale tools.
tests/unit/test_orchestrator_session_reset.py: Added a regression testthat runs two reviews for one user against a shared store and asserts the
second review's stored session contains only its own tools.
Testing
make test-unit)make test-integration)make lint)make typecheck)The boxes above are left unchecked deliberately — see Notes for Reviewers. The
new regression test (
test_session_state_cleared_between_reviews) fails onmainand passes with this change. My changed files (orchestrator.pyand thetest) pass
ruff,black, andmypyindividuallyScreenshots / Demo
N/A — backend logic change, covered by the unit test above.
Notes for Reviewers
session_store.pyneeded no changes (itsset()already overwrites the key).make checkandmake test-unitdo not currently passon a clean checkout of this branch's base — there are ~175 pre-existing
rufferrors, ~5
mypyerrors, and 53 failing unit tests across unrelatedsubsystems (e.g.
pii_scrubber,review_service,bias_detector). Iconfirmed my change introduces zero new failures: same pre-existing set
before and after, plus one new passing test. Happy to scope broader cleanup
into a separate PR if desired.
profile_id(last-write-wins).This PR targets the sequential re-review case described in the issue.