fix(session): defer auto-compaction until the next model input - #38901
fix(session): defer auto-compaction until the next model input#38901wishiweresaitama wants to merge 1 commit into
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR:
This PR (38901) appears to be addressing a refinement to compaction behavior that was previously tackled in PR #37584. Both PRs deal with controlling when compaction occurs relative to model input and avoiding unnecessary compaction cycles. However, PR #38901 is the current PR (the one being checked), so it's not a duplicate of itself. The PR #37584 is a related but distinct fix that addresses a similar problem area. |
Issue for this PR
Closes #
Type of change
What does this PR do?
Automatic compaction was being scheduled immediately after an assistant step exceeded the context threshold. This could trigger compaction after a final subagent response even when no further model input was needed.
This PR removes the post-
step-finishoverflow check fromSessionProcessor. The existing check inSessionPromptnow handles compaction before the next model request.As a result, the completed response is returned without starting unnecessary compaction. If the user sends another message, or the parent agent needs another model call, the context is compacted before that request.
The related processor test was updated, and a regression test was added for the next-user-message case.
How did you verify your code works?
Added regression coverage for both parts of the behavior:
Tests:
Screenshots / recordings
Not applicable.
Checklist