fix(session): preserve wait-for-user state after compaction#18941
fix(session): preserve wait-for-user state after compaction#18941Haohao-end wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR:
This PR is related because it also addresses session compaction behavior, specifically around how compaction recovery is handled. Since PR #18941 modifies the logic for when synthetic continuation messages are injected during compaction, and PR #18873 deals with preventing replaying compaction recovery as user prompts, there could be overlapping concerns around compaction state management. However, they appear to address different aspects of the compaction flow (continuation injection vs. replay handling), so they're likely complementary rather than duplicates. |
|
This PR is related to #18873, but it fixes a different part of the compaction flow.
So these two PRs are complementary, not duplicates. |
Issue for this PR
Closes #18794
Type of change
What does this PR do?
This fixes an unwanted continuation after
/compact.Before this change,
SessionCompaction.process()would inject a synthetic "continue" user message whenever compaction returnedcontinueand auto-compaction was enabled. That also happened when the previous assistant message had already naturally finished and should have been waiting for user input.I changed that logic so the synthetic continuation is only injected when compaction is actually resuming work:
This works because the decision is now based on the assistant state before compaction, instead of only looking at the compaction result itself.
How did you verify your code works?
I tested locally with:
cd packages/opencode && bun test test/session/compaction.test.ts --timeout 30000bun turbo typecheckI also added regression tests for these cases:
Screenshots / recordings
Not applicable.
Checklist