Skip to content

fix(core): initialize titleGenerator in __setDefaultMemory#1235

Closed
kagura-agent wants to merge 1 commit into
VoltAgent:mainfrom
kagura-agent:fix/set-default-memory-title-generator
Closed

fix(core): initialize titleGenerator in __setDefaultMemory#1235
kagura-agent wants to merge 1 commit into
VoltAgent:mainfrom
kagura-agent:fix/set-default-memory-title-generator

Conversation

@kagura-agent

@kagura-agent kagura-agent commented Apr 23, 2026

Copy link
Copy Markdown

Summary

Closes #1232

When Memory is passed globally to VoltAgent (via the memory option), __setDefaultMemory updates conversationMemory but does not initialize titleGenerator. This causes generateTitle to silently fail — all conversations receive the fallback title "Conversation".

Changes

  • MemoryManager: Added setTitleGenerator() method to allow updating the title generator after construction.
  • Agent.__setDefaultMemory(): After calling setMemory(), now also calls createConversationTitleGenerator() and passes the result to setTitleGenerator(), ensuring title generation works regardless of whether memory is passed globally or per-agent.

Testing

  • All 13 existing memory-manager.spec.ts tests pass.
  • Verified via code inspection that the fix addresses the exact gap described in the issue: setMemory only set conversationMemory, leaving titleGenerator as undefined.

Summary by CodeRabbit

  • Bug Fixes
    • Ensures conversation titles are correctly initialized and updated when default memory is applied so titles display reliably.
    • Allows the title-generation strategy to be updated at runtime so changes to how titles are created take effect immediately.

Summary by cubic

Initialize the conversation title generator when memory is set via VoltAgent.__setDefaultMemory, fixing #1232. Titles now generate correctly when memory is provided globally or per-agent, instead of the "Conversation" fallback.

  • Bug Fixes
    • Added setTitleGenerator() to MemoryManager.
    • Agent.__setDefaultMemory() now sets the title generator with createConversationTitleGenerator(memory) after setMemory().

Written for commit 02b7c4a. Summary will update on new commits.

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d3c9877f-0c0f-47da-a2f7-1ee5d69c9c32

📥 Commits

Reviewing files that changed from the base of the PR and between 4df8fae and 02b7c4a.

📒 Files selected for processing (3)
  • .changeset/fix-set-default-memory-title-generator.md
  • packages/core/src/agent/agent.ts
  • packages/core/src/memory/manager/memory-manager.ts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fix-set-default-memory-title-generator.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/core/src/memory/manager/memory-manager.ts
  • packages/core/src/agent/agent.ts

📝 Walkthrough

Walkthrough

Agent.__setDefaultMemory now also updates MemoryManager's conversation title generator when a default Memory is applied; a new MemoryManager.setTitleGenerator method was added and a Changeset entry recorded.

Changes

Cohort / File(s) Summary
Title generator + default memory
.changeset/fix-set-default-memory-title-generator.md, packages/core/src/agent/agent.ts, packages/core/src/memory/manager/memory-manager.ts
Adds MemoryManager.setTitleGenerator(...) and updates Agent.__setDefaultMemory to call createConversationTitleGenerator and apply the generator to the memory manager; adds Changeset metadata for a patch release.

Sequence Diagram(s)

sequenceDiagram
  participant VoltAgent
  participant Agent
  participant MemoryManager
  participant Memory

  VoltAgent->>Agent: __setDefaultMemory(memory: Memory)
  Agent->>Agent: createConversationTitleGenerator(memory)
  Agent->>MemoryManager: setTitleGenerator(titleGenerator)
  Agent->>MemoryManager: setMemory(memory)
  MemoryManager-->>Agent: updated state (conversationMemory + titleGenerator)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
I found a missing little spring,
Where titles slept without a ring.
A setter hopped in, swift and merry,
Now every chat has a bright new berry. 🍓✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: initializing titleGenerator in __setDefaultMemory method.
Description check ✅ Passed The description includes most required template sections: Summary with issue reference, Changes section detailing modifications, and Testing validation of existing tests.
Linked Issues check ✅ Passed The PR directly addresses issue #1232 by adding setTitleGenerator() to MemoryManager and updating Agent.__setDefaultMemory() to initialize titleGenerator when memory is set globally, exactly matching the issue's expected behavior.
Out of Scope Changes check ✅ Passed All changes (new setter in MemoryManager, updated __setDefaultMemory call, and changeset entry) are directly scoped to fixing the titleGenerator initialization issue described in #1232.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

…#1232)

When Memory is passed globally to VoltAgent, __setDefaultMemory updates
conversationMemory but not titleGenerator. This causes generateTitle to
silently fail (returning 'Conversation' for all threads).

Add setTitleGenerator to MemoryManager and call it from
__setDefaultMemory so that the title generator is initialized regardless
of whether memory is passed globally or per-agent.
@kagura-agent
kagura-agent force-pushed the fix/set-default-memory-title-generator branch from 4df8fae to 02b7c4a Compare April 23, 2026 08:36
@changeset-bot

changeset-bot Bot commented Apr 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 02b7c4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@voltagent/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@omeraplak omeraplak closed this Apr 25, 2026
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.

Memory: __setDefaultMemory does not initialize titleGenerator, breaking generateTitle for global memory

2 participants