[codex] Add context compaction controls and background cleanup - #564
[codex] Add context compaction controls and background cleanup#564aj47 wants to merge 2 commits into
Conversation
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| if (messageCount <= COMPACTION_MESSAGE_THRESHOLD) { | ||
| const messageThreshold = getConfiguredConversationCompactionMessageThreshold() | ||
| const tokenThreshold = await getConversationCompactionTokenThreshold() | ||
| const tokenCount = tokenThreshold |
There was a problem hiding this comment.
The tokenThreshold ? … : 0 and !tokenThreshold checks treat 0/NaN as “unset”, so an invalid mcpContextTargetRatio could silently bypass token-based compaction. Since getActiveContextTargetTokens() derives from config, this can make compaction behavior hard to predict for user-edited configs.
Severity: low
🤖 Was this useful? React with 👍 or 👎
| </div> | ||
| </div> | ||
| <Slider | ||
| value={[ |
There was a problem hiding this comment.
If cfg.mcpContextTargetRatio is outside the allowed 10–95% range, the numeric draft can show an out-of-range value while the slider falls back to MCP_CONTEXT_TARGET_RATIO_PERCENT_DEFAULT, so the two controls can disagree.
Severity: low
🤖 Was this useful? React with 👍 or 👎
| <Control | ||
| label={ | ||
| <ControlLabel | ||
| label="Context Compaction" |
There was a problem hiding this comment.
This adds new compaction controls to the desktop settings UI; per the renderer cross-platform reminder, is there a corresponding mobile remote-settings surface that should expose these for paired-desktop configuration as well?
Severity: low
🤖 Was this useful? React with 👍 or 👎
Summary
Root Cause
The live agent follow-up path loaded conversation history through a method that could synchronously compact old history. For long conversations, that could trigger serial LLM summarization calls before the new prompt was handled, making the UI sit on “thinking” for tens of seconds.
Validation
CI=1 pnpm --filter @dotagents/desktop test -- conversation-service.lazy-load.test.tsnode --test apps/desktop/tests/settings-general-context-compaction.test.mjsCI=1 pnpm --filter @dotagents/desktop typecheckCI=1 pnpm typecheckNotes
apps/mobile/src/store/sessions.ts,apps/mobile/src/store/sessions.storage.test.ts, andapps/desktop/heroic.