Fix: Always show autocompact threshold ui#5701
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the autocompact threshold UI would not render when alert.autoCompactThreshold was undefined. The fix ensures the UI is always visible by providing a default fallback value of 0.8 (80%).
Key changes:
- Added a default fallback value of 0.8 to
currentThresholdwhen bothloadedThresholdandalert.autoCompactThresholdare null/undefined - Removed the conditional wrapper that previously prevented the UI from rendering when
currentThresholdwas undefined
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| )} | ||
| } else if (e.key === 'Escape') { | ||
| setIsEditingThreshold(false); | ||
| const resetValue = Math.round(currentThreshold * 100); |
There was a problem hiding this comment.
The ternary check for currentThreshold was removed, but currentThreshold can now be 0.8 by default. If this is the intended behavior, consider that the previous code had a safety check (currentThreshold ? Math.round(currentThreshold * 100) : 80). Without it, if currentThreshold were somehow 0 or falsy, Math.round(currentThreshold * 100) would yield 0, which violates the min constraint of 1. However, since line 53 ensures currentThreshold is always at least 0.8, this is likely safe—but verify that loadedThreshold can never be 0.
| const resetValue = Math.round(currentThreshold * 100); | |
| const resetValue = currentThreshold ? Math.round(currentThreshold * 100) : 80; |
|
|
||
| const currentThreshold = loadedThreshold !== null ? loadedThreshold : alert.autoCompactThreshold; | ||
| const currentThreshold = | ||
| loadedThreshold !== null ? loadedThreshold : (alert.autoCompactThreshold ?? 0.8); |
There was a problem hiding this comment.
can we just make loadedThreshold not optional and initialize to 0.8? also delete autoCompactThreshold, it doesn't seem like we're using it (maybe we used to and that's how this broke?)
There was a problem hiding this comment.
Done. I am still keeping threshold value + loadedThreshold. This lets the value sync across multiple goose windows if it changes (pretty important since the auto-compact will trigger based on the config value).
…o dkatz/autocompact-ui-fix * 'dkatz/autocompact-ui-fix' of github.com:block/goose: Update ui/desktop/src/components/alerts/AlertBox.tsx
* 'main' of github.com:block/goose: Fix: Always show autocompact threshold ui (#5701) chore: Update governance to include Discord (#5690) Ollama improvements (#5609) feat: add Supabase MCP server to registry (#5629) Unlist VS Code extension tutorials from MCP and experimental sections (#5677) fix: make image processing work in github copilot provider (#5687) fix: do not take into account gitignore in developer mcp (#5688) docs: session storage migration (#5682) New maintainers (#5685) chore: Update governance (#5660) chore(release): release version 1.14.0 (minor) (#5676)
* main: (27 commits) hackathon banner (#5710) Fix documentation-only change detection for push events (#5712) Added transaction commits to multi sql functions in session_manager (#5693) fix: improve and simplify tool call chain rendering (#5704) Fix: Always show autocompact threshold ui (#5701) chore: Update governance to include Discord (#5690) Ollama improvements (#5609) feat: add Supabase MCP server to registry (#5629) Unlist VS Code extension tutorials from MCP and experimental sections (#5677) fix: make image processing work in github copilot provider (#5687) fix: do not take into account gitignore in developer mcp (#5688) docs: session storage migration (#5682) New maintainers (#5685) chore: Update governance (#5660) chore(release): release version 1.14.0 (minor) (#5676) fix : action icons overlap session title in chat history (#5684) Document recent goose PRs (#5683) docs: add GOOSE_PATH_ROOT environment variable documentation (#5678) feat: SessionManager integration for acp sessions (#5657) teach copilot our CI (#5672) ...
…eanup * 'main' of github.com:block/goose: (46 commits) Fix context progress bar not resetting after /clear command (#5652) docs: removing double announcements (#5714) docs: mcp sampling support (#5708) hackathon banner (#5710) Fix documentation-only change detection for push events (#5712) Added transaction commits to multi sql functions in session_manager (#5693) fix: improve and simplify tool call chain rendering (#5704) Fix: Always show autocompact threshold ui (#5701) chore: Update governance to include Discord (#5690) Ollama improvements (#5609) feat: add Supabase MCP server to registry (#5629) Unlist VS Code extension tutorials from MCP and experimental sections (#5677) fix: make image processing work in github copilot provider (#5687) fix: do not take into account gitignore in developer mcp (#5688) docs: session storage migration (#5682) New maintainers (#5685) chore: Update governance (#5660) chore(release): release version 1.14.0 (minor) (#5676) fix : action icons overlap session title in chat history (#5684) Document recent goose PRs (#5683) ...
* origin/main: (51 commits) Compaction resiliency improvements (#5618) docs: ask goose button (#5730) Update prompt injection detection metrics (due to errors exporting to datadog) (#5692) Spence/icon2 tokyo drift (#5728) docs: logs rotation and misc updates (#5727) docs: automatic ollama model detection (#5725) Fix context progress bar not resetting after /clear command (#5652) docs: removing double announcements (#5714) docs: mcp sampling support (#5708) hackathon banner (#5710) Fix documentation-only change detection for push events (#5712) Added transaction commits to multi sql functions in session_manager (#5693) fix: improve and simplify tool call chain rendering (#5704) Fix: Always show autocompact threshold ui (#5701) chore: Update governance to include Discord (#5690) Ollama improvements (#5609) feat: add Supabase MCP server to registry (#5629) Unlist VS Code extension tutorials from MCP and experimental sections (#5677) fix: make image processing work in github copilot provider (#5687) fix: do not take into account gitignore in developer mcp (#5688) ...
* main: (65 commits) Fix: Recipes respect the quiet flag (#5743) docs: update cli commands (#5744) Run smoke tests on a free runner (#5745) faster, cheaper (pick two): improve CI workflow and switch to free github runner (#5702) Compaction resiliency improvements (#5618) docs: ask goose button (#5730) Update prompt injection detection metrics (due to errors exporting to datadog) (#5692) Spence/icon2 tokyo drift (#5728) docs: logs rotation and misc updates (#5727) docs: automatic ollama model detection (#5725) Fix context progress bar not resetting after /clear command (#5652) docs: removing double announcements (#5714) docs: mcp sampling support (#5708) hackathon banner (#5710) Fix documentation-only change detection for push events (#5712) Added transaction commits to multi sql functions in session_manager (#5693) fix: improve and simplify tool call chain rendering (#5704) Fix: Always show autocompact threshold ui (#5701) chore: Update governance to include Discord (#5690) Ollama improvements (#5609) ...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Blair Allan <Blairallan@icloud.com>
This does duplicate the default threshold in the UI, but I think that's fine since it's so easy to change there (if it actually can render).