fix(desktop): route /compress through session.rpc (superseded) - #53664
Closed
PINKIIILQWQ wants to merge 3 commits into
Closed
fix(desktop): route /compress through session.rpc (superseded)#53664PINKIIILQWQ wants to merge 3 commits into
PINKIIILQWQ wants to merge 3 commits into
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.
What does this PR do?
Fixes Desktop
/compresstaking the generic slash exec path, where compression can complete on the backend but the UI does not show an immediate "compressing" state and can still render the misleading fallback error:not a quick/plugin/skill command: compressRoot cause:
/compresswas registered as a generic exec slash command even though Desktop needs to call the dedicatedsession.compressRPC and handle its structured response. For large conversations, compression can also run longer than the Desktop gateway client's default request timer, so a successful backend compression can be followed by a frontend-onlyrequest timed out: session.compresserror.The command is now handled as a Desktop action. The handler renders an inline compression-in-progress message before awaiting
session.compress, disables the frontend JSON-RPC timer for that long-running RPC, applies the returned compressed transcript/title/usage when available, and renders the final manual-compression summary without falling through tocommand.dispatch.This keeps the fix narrow while preserving the root-cause direction from #44462, whose patch no longer applies cleanly to current
main. Broader context-usage hydration edge cases are intentionally left to a separate follow-up.Related Issue
Fixes #44456
Related: #44462
Type of Change
Changes Made
apps/desktop/src/lib/desktop-slash-commands.ts/compressas a Desktop action instead of an exec command.apps/desktop/src/app/session/hooks/use-prompt-actions.tscompressaction handler that callssession.compresswith optionalfocus_topic.compressing context...status immediately after the command is accepted.messagesto the active transcript.info.usagewhen the compression RPC returns it.slash.execerror when generic fallback errors are only unknown-command noise.apps/desktop/src/app/types.tsSessionCompressResponsefields returned bysession.compress.apps/desktop/src/app/session/hooks/use-prompt-actions.test.tsxsession.compressrouting, context usage application from the RPC response, transcript sync, focus-topic passthrough, busy errors, and absence of fallbacknot a quick/plugin/skill commandnoise.apps/desktop/src/lib/desktop-slash-commands.test.ts/compressresolves to the Desktop action surface.How to Test
npm --workspace apps/desktop run test:ui -- src/app/session/hooks/use-prompt-actions.test.tsx src/lib/desktop-slash-commands.test.tsnpm --workspace apps/desktop run typecheckgit diff --checkgit merge-tree --write-tree upstream-https/main HEADObserved results:
git diff --checkpassed.mainpassed.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Not attached. This change is covered by focused Desktop unit tests and typecheck.