Skip to content

feat(auto-title-sync): auto-memory linked chat title refresh + observability - #7032

Closed
Ferrum360 wants to merge 15 commits into
agentscope-ai:mainfrom
Ferrum360:pr/auto-title-sync-clean
Closed

feat(auto-title-sync): auto-memory linked chat title refresh + observability#7032
Ferrum360 wants to merge 15 commits into
agentscope-ai:mainfrom
Ferrum360:pr/auto-title-sync-clean

Conversation

@Ferrum360

Copy link
Copy Markdown

What Problem This Solves

Currently, chat titles in QwenPaw are static placeholders (truncated first message) and never update as the conversation evolves. When auto-memory generates new memory entries, the session title does not reflect the updated topic, making it harder to scan chat history and understand context at a glance.

This PR adds an auto-title-sync mechanism that regenerates the chat title after auto-memory flushes, ensuring the title stays aligned with the actual conversation topic.

Evidence

  • Added title_generator.py with refresh_title_after_auto_memory() that generates a concise title from recent messages after auto-memory succeeds.
  • Updated middlewares.py so _flush_auto_memory calls title_refresh_callback on success, instead of silently completing.
  • Updated manager.py to persist the refreshed title and record auto_title_refresh metadata in chat.meta.
  • Added observability in _coordinator.py (INFO log) so title refresh events are visible in logs.
  • Adapted memory managers to accept and invoke title_refresh_callback.

Summary of changes

  • feat(auto-title-sync): auto-memory linked chat title refresh + observability
  • Fix middlewares.py: call title_refresh_callback after _flush_auto_memory success
  • Integrate title refresh into manager.py for chat.meta persistence
  • Add observability support in _coordinator.py (INFO logging)
  • Adapt memory managers to title_refresh_callback interface

Test plan

  • Verify chat title auto-refreshes after auto-memory triggers
  • Verify title_refresh_callback is only called after successful auto-memory flush
  • Verify chat.meta["auto_title_refresh"] is recorded correctly

Ferrum and others added 11 commits August 6, 2026 19:52
- load_skill/unload_skill/check_skill_status 改用 WORKING_DIR 常量
- 修复 Path(__file__).parentx4 硬编码导致的目录找不到问题
- skill.json name 字段对齐目录名 market-access-audit
- 保存动态技能加载核心代码(本地定制,上游无此功能)
…ability

- Add title_generator.py: generate chat titles based on auto-memory
- Fix middlewares.py: call title_refresh_callback after _flush_auto_memory success
- Integrate title refresh into manager.py for chat.meta persistence
- Add observability support in _coordinator.py (INFO logging)
- Adapt memory managers to title_refresh_callback interface
@github-actions

Copy link
Copy Markdown

Welcome to QwenPaw! 🐾

Hi @Ferrum360, this is your 6th Pull Request.

📋 About PR Template

To help maintainers review your PR faster, please make sure to include:

  • Description - What this PR does and why
  • Type of Change - Bug fix / Feature / Breaking change / Documentation / Refactoring
  • Component(s) Affected - Core / Console / Channels / Skills / CLI / Documentation / Tests / CI/CD / Scripts
  • Checklist:
    • Run and pass pre-commit run --all-files
    • Run and pass relevant tests (pytest or as applicable)
    • Update documentation if needed
  • Testing - How to test these changes
  • Local Verification Evidence:
    pre-commit run --all-files
    # paste summary result
    
    pytest
    # paste summary result

Complete PR information helps speed up the review process. You can edit the PR description to add these details.

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.


Tip

⭐ If you find QwenPaw useful, please give us a Star!

Star QwenPaw

Staying ahead

Star QwenPaw on GitHub and be instantly notified of new releases.

Your star helps more developers discover this project! 🐾

Ferrum added 3 commits August 14, 2026 16:58
- Add Dict[str, Any] type annotation for recommendation in smart_unload_recommendation
- Fix relative import in auto_unload.py to use absolute import
- Fix _init_local_workspace return type to match post_init signature
- Add Optional[AgentProfileConfig] type annotation for _config
- Add type: ignore comment for _config.running access during register()
@Ferrum360
Ferrum360 requested a deployment to ai-review-approved August 14, 2026 12:22 — with GitHub Actions Waiting
- Remove unused List from typing in skill_tools.py
- Remove unused Path imports from check_skill_status/load_skill/unload_skill
- Remove unused should_auto_unload import from check_skill_status
- Rename unused context params to _context in skills_handler
- Rename unused reason/pool_name vars to _reason/_pool_name
- Fix trailing newlines in skill_tools.py
@jinliyl

jinliyl commented Aug 18, 2026

Copy link
Copy Markdown
Member

Thank you for working on automatic chat title refresh. I have one architectural concern about the current implementation.

Chat title generation and persistence are application/chat concerns, not memory concerns. Passing title_refresh_callback through BaseMemoryManager and then into MemoryMiddleware couples the memory abstraction to chat presentation and persistence behavior. It also requires every memory backend, including ADBPGMemoryManager and ReMeLightMemoryManager, to accept and forward a parameter that has nothing to do with memory storage, retrieval, summarization, or lifecycle management.

Could we please avoid changing BaseMemoryManager and MemoryMiddleware for this feature?

I suggest introducing a dedicated middleware, for example ChatTitleRefreshMiddleware, backed by a ChatTitleRefreshService. The new middleware could observe the appropriate conversation lifecycle hook, apply its own refresh policy, and delegate title generation and compare-and-set persistence to the chat service. It should then be registered from the application/runtime assembly layer, where both chat services and middleware composition are available.

A possible separation would be:

  • MemoryMiddleware: memory search, auto-memory collection, and memory flush behavior only.
  • ChatTitleRefreshMiddleware: decide when a completed conversation turn should trigger a title refresh.
  • ChatTitleRefreshService: generate the title, locate the chat, preserve manual renames, and update ChatSpec.name and metadata.
  • Application/runtime builder: construct and register the middleware with its required chat-layer dependencies.

This would remove the cross-layer callback chain from Workspace to concrete memory managers to BaseMemoryManager to MemoryMiddleware, keep memory backends independent of chat UI behavior, and allow title refresh cadence and configuration to evolve independently from auto-memory.

If the product requirement is specifically to refresh only after a successful auto-memory flush, a generic application-level AutoMemoryFlushed event could be published and handled by the chat title service. Even in that case, I would prefer not to expose a title-specific callback on the memory manager abstraction.

Would you please consider restructuring this part before merging? Thank you.

Ferrum360 pushed a commit to Ferrum360/QwenPaw that referenced this pull request Aug 20, 2026
…n layer (agentscope-ai#7032)

Remove title_refresh_callback from BaseMemoryManager and its concrete
subclasses (ADBPGMemoryManager, ReMeLightMemoryManager). MemoryMiddleware
no longer holds or invokes the callback.

Introduce ChatTitleRefreshMiddleware backed by ChatTitleRefreshService.
The middleware observes conversation lifecycle via on_reply hook, reads
the _auto_memory_flushed context variable set by MemoryMiddleware after
a successful auto-memory flush, and delegates title generation +
compare-and-set persistence to the chat service.

Registered from runtime/builder.py where both chat services and
middleware composition are available, keeping memory backends independent
of chat UI behavior.
Ferrum360 pushed a commit to Ferrum360/QwenPaw that referenced this pull request Aug 23, 2026
Ferrum360 pushed a commit to Ferrum360/QwenPaw that referenced this pull request Aug 23, 2026
…n layer (agentscope-ai#7032)

Remove title_refresh_callback from BaseMemoryManager and its concrete
subclasses (ADBPGMemoryManager, ReMeLightMemoryManager). MemoryMiddleware
no longer holds or invokes the callback.

Introduce ChatTitleRefreshMiddleware backed by ChatTitleRefreshService.
The middleware observes conversation lifecycle via on_reply hook, reads
the _auto_memory_flushed context variable set by MemoryMiddleware after
a successful auto-memory flush, and delegates title generation +
compare-and-set persistence to the chat service.

Registered from runtime/builder.py where both chat services and
middleware composition are available, keeping memory backends independent
of chat UI behavior.
Ferrum360 pushed a commit to Ferrum360/QwenPaw that referenced this pull request Aug 23, 2026
@Ferrum360 Ferrum360 closed this Aug 23, 2026
@Ferrum360
Ferrum360 deleted the pr/auto-title-sync-clean branch August 23, 2026 15:22
@github-project-automation github-project-automation Bot moved this from Todo to Done in QwenPaw Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants