You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a per-AI-agent setting to disable the accumulated conversation summary that is prepended to the system prompt as Conversation Context.
What changed
Added AIAgent.disableSummary with default false.
Added migration for the new field.
Exposed the flag through create/update schemas and AI agent service types.
Added a toggle in the AI agent configuration modal.
Prevented runners from prepending Conversation Context when the flag is enabled.
Prevented summary generation/enqueueing when the flag is enabled.
Keeps only the recent conversation history when summaries are disabled, matching the expected long-conversation trade-off.
Added tests for schema defaults, prompt behavior, and skipped summary job enqueueing.
Why
For lead-capture and similar workflows, each new inquiry should be treated independently. The existing accumulated summary can carry stale details from previous inquiries and make the agent treat them as current context.
@jpcoseani
Hey, thanks for this PR — the idea of letting an agent skip the accumulated conversation summary makes a lot of sense.
Right now, though, the PR is conflicting with main. PR #1046, merged about a day after this PR was opened, rewrote the same appendHistory() flow in packages/ai/src/server/services/ai-context-service.ts, so this branch needs to be synced carefully.
Could you help fix the following before this can be merged:
Rebase onto the latest main and resolve the conflicts carefully. In packages/ai/src/server/services/ai-context-service.ts, please don’t just pick one side over the other. We need to keep the nextSeq dedup mechanism and the MAX_CONVERSATION_HISTORY_HARD_CAP safety net from fix(ai-agent): fix bug ai gent slow reply #1046, while also adding the disableSummary behavior:
when disableSummary=true, keep only the latest MAX_CONVERSATION_HISTORY entries;
apply that before the hard-cap check;
keep nextSeq updating even when history is sliced;
Add the missing audit log check.hasOtherFieldChanges in packages/business/src/ai-agent/service.ts currently checks fields like isRichResponse; after adding this field, it should also check disableSummary. Otherwise, toggling only that setting won’t produce an audit log entry.
Regenerate the migration after rebasing. The current migration snapshot chains from capi_enrichment_columns, but main already has 20260826144212_add_messaging_ads_tables from that same parent. Please delete the old generated migration and regenerate it after rebasing so the snapshot chains from the latest migration: pnpm --filter @chatbotx.io/database make:migration add_ai_agent_disable_summary
Also, please preserve the small appendHistory regression test after resolving conflicts: seed history with exactly 100 entries, append one more with disableSummary=true, and assert the persisted history length stays at 100 rather than growing to the 150 hard cap.
Thanks — ping me when it’s ready and I’ll take another look!
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
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.
Summary
Adds a per-AI-agent setting to disable the accumulated conversation summary that is prepended to the system prompt as
Conversation Context.What changed
AIAgent.disableSummarywith defaultfalse.Conversation Contextwhen the flag is enabled.Why
For lead-capture and similar workflows, each new inquiry should be treated independently. The existing accumulated summary can carry stale details from previous inquiries and make the agent treat them as current context.