Repository navigation
fix(web-ui): keep an admitted /compact out of the composer - #3588
Open
Raing5Days wants to merge 2 commits into
Open
Raing5Days wants to merge 2 commits into
Raing5Days wants to merge 2 commits into
Conversation
The desktop /compact entry point only settles after the compaction reaches a terminal state, so restoring the command text from the failure path put '/compact' back into the composer long after it was submitted - including when the compaction had already been applied and only its terminal bookkeeping failed. Treat the submitted command as committed: clear the composer through the submission contract (value, pending large pastes, machine queue, history cursor) and report a failure notification without refilling the composer. The outcome stays visible through the transcript turn and the compression card.
An early rejection (session busy, context not loaded, agent unavailable) never starts a maintenance turn, so handing /compact back for a retry is still correct. Once the host admitted the compaction its terminal outcome already lives in the transcript - and may have applied before its bookkeeping failed - so refilling the composer there resurrects the command minutes later. Gate the restore on a maintenance turn that appeared after the submission.
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.
Problem
Submitting
/compactput/compactback into the composer at the moment the compaction finished.submitCompactFromInputclears the composer and then awaits the desktopcompact_sessioncommand, which does not settle when the request is admitted:ConversationCoordinator::compact_session_manuallyawaits the terminal state of the maintenance turn. The failure path restored the submitted text, so the refill landed minutes later - including when the compaction had already been applied and only its terminal bookkeeping failed./usage,/initand/reloaduse the same failure-restore pattern but return immediately, which is why only/compactshows the symptom.Fix
queuedInputsync effect write the text back into the now-empty composer./compactonly when the host never admitted it. An early rejection (session busy, context not loaded, agent unavailable) creates no maintenance turn, so the text is still a retryable draft. Once amanual_compactionturn appeared after the submission, the outcome already lives in the transcript and the composer stays cleared.Verification
vitest runfor the composer-ownership contract, the draft-recovery rules and the image-intake contract: 3 files / 22 tests pass.tsc --noEmitonsrc/web-uipasses; ESLint reports no problems for the touched files./usagecontrol case reported in the issue.Notes
The desktop entry point stays blocking (its promise settles when the compaction ends). Making the Web UI observe the outcome through the turn events instead would be a separate change: it needs a non-blocking command path and a Product Operation Registry row.