Skip to content

Conversation

@ethanndickson
Copy link
Member

Summary

The ORPC migration PR (#763) inadvertently deleted the auto-compaction trigger logic from ChatInput/index.tsx. This PR restores it.

What was deleted

When sending a message, the system should check if context usage has reached the threshold and automatically trigger compaction instead of sending the message directly. This logic was removed during the ORPC refactor.

What this PR restores

  • Check usagePercentage >= thresholdPercentage before regular message sends
  • Call executeCompaction() with the message as continueMessage
  • Show "Context threshold reached - auto-compacting..." toast
  • Proper error handling with input/image restoration on failure
  • Skip if already compacting (prevents double-compaction)
  • Skip if editing a message

What still worked (not deleted)

  • checkAutoCompaction() function
  • CompactionWarning UI banner
  • Auto-compaction settings UI
  • The autoCompactionCheck prop was still passed from AIView → ChatInput

Testing

  • make typecheck passes
  • make lint passes
  • Auto-compaction unit tests pass (23 tests)

Generated with mux

The ORPC migration PR (#763) inadvertently deleted the auto-compaction
trigger logic when sending messages. This restores:

- Check if usage >= threshold before sending regular messages
- Execute compaction with continueMessage instead of direct send
- Show 'Context threshold reached - auto-compacting...' toast
- Proper error handling with input/image restoration

The supporting infrastructure (checkAutoCompaction, CompactionWarning,
settings UI) remained intact - only the trigger logic was missing.

_Generated with `mux`_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant