Skip to content

fix(desktop): route /compress through session.rpc (superseded) - #53664

Closed
PINKIIILQWQ wants to merge 3 commits into
NousResearch:mainfrom
PINKIIILQWQ:codex/desktop-compress-route
Closed

fix(desktop): route /compress through session.rpc (superseded)#53664
PINKIIILQWQ wants to merge 3 commits into
NousResearch:mainfrom
PINKIIILQWQ:codex/desktop-compress-route

Conversation

@PINKIIILQWQ

@PINKIIILQWQ PINKIIILQWQ commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes Desktop /compress taking 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: compress

Root cause: /compress was registered as a generic exec slash command even though Desktop needs to call the dedicated session.compress RPC 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-only request timed out: session.compress error.

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 to command.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

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • apps/desktop/src/lib/desktop-slash-commands.ts
    • Registers /compress as a Desktop action instead of an exec command.
  • apps/desktop/src/app/session/hooks/use-prompt-actions.ts
    • Adds a compress action handler that calls session.compress with optional focus_topic.
    • Disables the frontend JSON-RPC timeout for the long-running compression RPC.
    • Shows an inline compressing context... status immediately after the command is accepted.
    • Applies returned compression messages to the active transcript.
    • Applies returned info.usage when the compression RPC returns it.
    • Preserves the original slash.exec error when generic fallback errors are only unknown-command noise.
  • apps/desktop/src/app/types.ts
    • Adds the SessionCompressResponse fields returned by session.compress.
  • apps/desktop/src/app/session/hooks/use-prompt-actions.test.tsx
    • Covers immediate compression feedback, timeout-free session.compress routing, context usage application from the RPC response, transcript sync, focus-topic passthrough, busy errors, and absence of fallback not a quick/plugin/skill command noise.
  • apps/desktop/src/lib/desktop-slash-commands.test.ts
    • Guards that /compress resolves to the Desktop action surface.

How to Test

  1. npm --workspace apps/desktop run test:ui -- src/app/session/hooks/use-prompt-actions.test.tsx src/lib/desktop-slash-commands.test.ts
  2. npm --workspace apps/desktop run typecheck
  3. git diff --check
  4. git merge-tree --write-tree upstream-https/main HEAD

Observed results:

  • 2 vitest files passed, 55 tests passed.
  • Desktop typecheck passed.
  • git diff --check passed.
  • Merge-tree check against latest upstream main passed.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS local checkout, automated vitest/typecheck only

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Not attached. This change is covered by focused Desktop unit tests and typecheck.

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Jun 27, 2026
@PINKIIILQWQ PINKIIILQWQ changed the title fix(desktop): make /compress show progress and refresh usage fix(desktop): route /compress through session.rpc (superseded) Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Desktop /compress returns "not a quick/plugin/skill command: compress" — TUI command.dispatch doesn't redirect built-ins to slash.exec

2 participants