Repository navigation
feat(context): condense context after idle time #2340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DavidWAbrahams
wants to merge
31
commits into
Zoo-Code-Org:main
Choose a base branch
from
DavidWAbrahams:feature/idle-condensing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c8e986c
feat(context): condense context after idle time
DavidWAbrahams 0ad4da0
clamp the to conext threshold sliders together
DavidWAbrahams 4c42cd1
nest idle condensing under auto condense and reword idle description
DavidWAbrahams 5e97895
Merge branch 'main' into feature/idle-condensing
DavidWAbrahams 6df461e
fix formatting and repair eslint-suppressions.json merge corruption
DavidWAbrahams 6710459
fix Task.spec.ts condense stub to resolve with CondenseContextResult
DavidWAbrahams 19952ce
test webview-ui idle-condense state and condense queueing for patch c…
DavidWAbrahams 93f0d4f
fix: address review findings on idle-condense clamping, inheritance, …
DavidWAbrahams bf6e469
Update webview-ui/src/components/settings/ContextManagementSettings.tsx
DavidWAbrahams 731f803
fix: type idle-condensing checkbox change event with checkbox target …
DavidWAbrahams 1b1fbeb
fix: slice long idle timer delays and reset countdown on every edit
DavidWAbrahams bf9d892
style: apply prettier formatting to idle-condense sources
DavidWAbrahams ae763be
test: define abort as own property in idle-condense task stub
DavidWAbrahams 2eecdb3
test: redefine abort instead of assigning in aborted-task test
DavidWAbrahams c617e45
Merge branch 'main' into feature/idle-condensing
DavidWAbrahams 3a7e6ef
test: cover idle-condensing patch gaps flagged by codecov
DavidWAbrahams c353db3
fix: re-arm idle countdown with newly saved delay
DavidWAbrahams 7137625
fix(context): address CodeRabbit review feedback for idle condensing
DavidWAbrahams 019af57
test(webview): regenerate idle condensing visual baselines
DavidWAbrahams bd5c1bd
fix(task): resolve condense profile thresholds from the task's own pr…
DavidWAbrahams 537eed3
fix(context): address idle-condense review findings (reset signals, v…
DavidWAbrahams e2e0740
test(webview): assert idleCondenseReset on setChatBoxMessage invoke path
DavidWAbrahams d2465cd
Merge branch 'main' into feature/idle-condensing
DavidWAbrahams 4f14bd2
Merge branch 'main' into feature/idle-condensing
DavidWAbrahams 23bde53
i18n: simplify idle condensing threshold and idle time descriptions
DavidWAbrahams 1496acc
test(webview): cover idleCondenseReset on programmatic input rewrites
DavidWAbrahams 93a0ae8
fix(condense): address pre-merge checks for idle condensing
DavidWAbrahams a42c4c0
Merge remote-tracking branch 'origin/main' into pr-2340-fix
DavidWAbrahams 4099c19
test(chat): pin execCommand absent so the idle-condense enhanced-prom…
DavidWAbrahams 5e3a5cf
test(task): adapt condense tests to durable overwrite seam and 5-arg …
DavidWAbrahams 59de054
fix(review): harden idle condense per coderabbit review
DavidWAbrahams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
91 changes: 91 additions & 0 deletions
91
src/core/context-management/__tests__/context-management.spec.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,7 @@ export async function estimateTokenCount( | |
| * (window minus reserved output); an unknown/unlimited reserve (maxTokens -1) falls back to the | ||
| * full window. Shared by `willManageContext` and `manageContext` so the two stay in lockstep. | ||
| */ | ||
| function computeContextPercent({ | ||
| export function computeContextPercent({ | ||
| prevContextTokens, | ||
| contextWindow, | ||
| maxTokens, | ||
|
|
@@ -174,6 +174,40 @@ export function truncateConversation(messages: ApiMessage[], fracToRemove: numbe | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Resolves the effective condense threshold percent for the current model | ||
| * profile, mirroring the semantics used by `willManageContext`/`manageContext`: | ||
| * a profile value of -1 inherits the global percent, a value within | ||
| * [MIN_CONDENSE_THRESHOLD, MAX_CONDENSE_THRESHOLD] overrides it, and any other | ||
| * value falls back to the global percent with a warning. | ||
| */ | ||
| export function computeEffectiveCondenseThreshold({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| globalPercent, | ||
| profileThresholds, | ||
| currentProfileId, | ||
| label = "threshold", | ||
| }: { | ||
| globalPercent: number | ||
| profileThresholds: Record<string, number> | ||
| currentProfileId: string | ||
| label?: string | ||
| }): number { | ||
| const profileThreshold = profileThresholds[currentProfileId] | ||
| if (profileThreshold === undefined) { | ||
| return globalPercent | ||
| } | ||
| if (profileThreshold === -1) { | ||
| return globalPercent | ||
| } | ||
| if (profileThreshold >= MIN_CONDENSE_THRESHOLD && profileThreshold <= MAX_CONDENSE_THRESHOLD) { | ||
| return profileThreshold | ||
| } | ||
| console.warn( | ||
| `Invalid profile ${label} ${profileThreshold} for profile "${currentProfileId}". Using global default of ${globalPercent}%`, | ||
| ) | ||
| return globalPercent | ||
| } | ||
|
|
||
| /** | ||
| * Options for checking if context management will likely run. | ||
| * A subset of ContextManagementOptions with only the fields needed for threshold calculation. | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can an imported settings file set values outside the allowed range, because this schema has no bounds?