Skip to content

Conversation

@katzdave
Copy link
Collaborator

@katzdave katzdave commented Aug 19, 2025

Summary

This PR implements a user interface for configuring the auto-compact threshold in the Goose desktop application. The feature allows users to set and manage the message count threshold that triggers automatic conversation compaction.

Changes

Frontend (Desktop UI)

  • ChatInput Component: Added logic to fetch and manage auto-compact threshold from the backend configuration endpoint, including proper error handling and console logging for debugging
  • AlertBox Component: Implemented a comprehensive threshold configuration UI with:
    • Visual slider for threshold adjustment (range: 10-100 messages)
    • Real-time value display
    • Save/cancel functionality
    • Integration with backend API for persistence
    • Proper state management and error handling

Backend (Server)

  • Config Management Routes: Added new endpoints for auto-compact threshold configuration:
    • GET endpoint to retrieve current threshold value
    • PUT endpoint to update threshold with validation
    • Proper error handling and response formatting
  • OpenAPI Specification: Updated to include new configuration endpoints and data models

API Integration

  • Generated TypeScript SDK updates for new configuration endpoints
  • Added proper type definitions for threshold configuration requests/responses
  • Fixed API URL handling to use getApiUrl helper for proper endpoint resolution

Technical Implementation

The implementation follows a clean architecture pattern:

  1. Frontend State Management: Uses React hooks for local state management with proper synchronization to backend
  2. API Communication: RESTful endpoints with proper authentication via secret key headers
  3. Data Validation: Backend validates threshold values to ensure they're within acceptable ranges
  4. Error Handling: Comprehensive error handling at both frontend and backend levels

Files Modified

  • ui/desktop/src/components/ChatInput.tsx - Auto-compact threshold loading and management
  • ui/desktop/src/components/alerts/AlertBox.tsx - Threshold configuration UI implementation
  • ui/desktop/src/components/bottom_menu/BottomMenuAlertPopover.tsx - Integration point for alert settings
  • crates/goose-server/src/routes/config_management.rs - Backend configuration endpoints
  • crates/goose-server/src/openapi.rs - OpenAPI specification updates
  • ui/desktop/openapi.json - Generated OpenAPI JSON
  • ui/desktop/src/api/sdk.gen.ts - Generated TypeScript SDK
  • ui/desktop/src/api/types.gen.ts - Generated TypeScript types
  • ui/desktop/src/components/alerts/types.ts - Alert type definitions

Impact Analysis

  • User Experience: Provides users with direct control over conversation compaction behavior
  • Performance: No performance impact - configuration is loaded once on component mount
  • Backward Compatibility: Fully backward compatible - defaults are maintained if no threshold is configured
  • API: New endpoints are additive and don't affect existing functionality

Testing Considerations

  • Verify threshold slider updates correctly in UI
  • Confirm save functionality persists values to backend
  • Test edge cases (min/max values, network errors)
  • Validate proper error handling and user feedback
  • Ensure configuration persists across application restarts

Migration Steps

No migration required - feature is additive and uses default values if not configured.

Related Issues

This feature addresses user requests for more control over conversation management and automatic compaction behavior.

auto_compat_thresh_ui.mp4

@zanesq
Copy link
Collaborator

zanesq commented Aug 22, 2025

Still in progress?

@katzdave
Copy link
Collaborator Author

Yes will whip this back into shape after we merge Alex's compaction ui change.

* 'main' of github.com:block/goose:
  Align Dynamic Task Interface with Recipe Interface (#4311)
  docs: copilot auth and mcp-ui links (#4497)
  docs: July and August 2025 Community All-Stars Update (#4501)
  remove clicking outside to close recipe warning (#4502)
  lower min width to 450 for small screens
  Convert recipe create and import forms to use tanstack form and zod schema validation (#4499)
  Repo CI: use a writable location for Goose home directory (#4500)
  feat: Add functionality to delete session in history list view (#4480)
  fix: recipe deeplink "+" characters and folder change (#4471)
  Add session to agents (#4216)
  fix: need to send errors to appropriate stream (#4491)
  Add Docker support for Goose in CI/CD pipelines (#4434)
  Add visual indicator while recipe loads (#4447)
  Disable chat input while extensions load (#4417)
  chore(release): release version 1.7.0 (#4391)
* 'main' of github.com:block/goose:
  Fix databricks streaming errors  (#4506)
  docs: malware check for uvx and npx extensions (#4508)
  fix: auto-compact on context limit error (#3635)
  feat: multi model and multi provider config and auto switching (#4035)
@katzdave katzdave requested a review from alexhancock September 4, 2025 15:27
* 'main' of github.com:block/goose:
  docs: add ampersand to link (#4560)
  Add video link to README for user guidance (#4553)
  docs: social channels (#4552)
  feat: simplify navigation, make reload work (#4498)
  docs: new recipe warning (#4545)
  Add AGENTS.md for AI coding assistant support (#4539)
  docs: non-interactive compact now (#4543)
  fixed css classes and added some accessibility fixes (#4492)
  feat(acp): Read files (#4531)
  Add YouTube Short to Auto Visualiser Tutorial (#4536)
  Fix/settings page (#4520)
  update to RMCP 0.6.2 (#4523)
  docs: nested goosehints (#4528)
  feat: Agent Client Protocol implementation of goose (#4511)
  feat: make tests for rmcp based developer server consistent with former implementation (#4519)
  worlds simplest logging to see where things are blocked (#3888)
  docs: update quickstart and install topics (#4378)
  feat: Add configurable Bedrock retry parameters (#4316)
  remove localstorage getconfig fallbacks (#4432)
  chore(deps-dev): bump electron from 37.2.6 to 37.4.0 in /ui/desktop (#4516)
Copy link
Collaborator

@alexhancock alexhancock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! I tested it out and it's working well

@katzdave katzdave merged commit 3a4dd10 into main Sep 8, 2025
11 checks passed
@katzdave katzdave deleted the dkatz/threshold-ui branch September 8, 2025 19:10
katzdave added a commit that referenced this pull request Sep 8, 2025
…data

* 'main' of github.com:block/goose:
  feat: add auto-compact threshold configuration UI (#4178)
  Add container detection to developer extension (#4559)
tiensi added a commit to tiensi/goose that referenced this pull request Sep 8, 2025
* main: (43 commits)
  feat: add auto-compact threshold configuration UI (block#4178)
  Add container detection to developer extension (block#4559)
  docs: add ampersand to link (block#4560)
  Add video link to README for user guidance (block#4553)
  docs: social channels (block#4552)
  feat: simplify navigation, make reload work (block#4498)
  docs: new recipe warning (block#4545)
  Add AGENTS.md for AI coding assistant support (block#4539)
  docs: non-interactive compact now (block#4543)
  fixed css classes and added some accessibility fixes (block#4492)
  feat(acp): Read files (block#4531)
  Add YouTube Short to Auto Visualiser Tutorial (block#4536)
  Fix/settings page (block#4520)
  update to RMCP 0.6.2 (block#4523)
  docs: nested goosehints (block#4528)
  feat: Agent Client Protocol implementation of goose (block#4511)
  feat: make tests for rmcp based developer server consistent with former implementation (block#4519)
  worlds simplest logging to see where things are blocked (block#3888)
  docs: update quickstart and install topics (block#4378)
  feat: Add configurable Bedrock retry parameters (block#4316)
  ...
michaelneale added a commit that referenced this pull request Sep 9, 2025
* main:
  adding Vercel MCP (#4562)
  docs: reorganizing CLI commands (#4566)
  Desktop import yaml recipes (#4544)
  feat: add auto-compact threshold configuration UI (#4178)
This was referenced Sep 9, 2025
thebristolsound pushed a commit to thebristolsound/goose that referenced this pull request Sep 11, 2025
Signed-off-by: Matt Donovan <mattddonovan@protonmail.com>
HikaruEgashira pushed a commit to HikaruEgashira/goose that referenced this pull request Oct 3, 2025
Signed-off-by: HikaruEgashira <hikaru-egashira@c-fo.com>
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.

4 participants