feat(auto-title-sync): auto-memory linked chat title refresh + observability - #7032
feat(auto-title-sync): auto-memory linked chat title refresh + observability#7032Ferrum360 wants to merge 15 commits into
Conversation
- 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
|
Hi @Ferrum360, this is your 6th Pull Request. 📋 About PR TemplateTo help maintainers review your PR faster, please make sure to include:
Complete PR information helps speed up the review process. You can edit the PR description to add these details. 🙌 Join Developer CommunityThanks 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: We truly appreciate your enthusiasm—and look forward to your future contributions! 😊 We'll review your PR soon. |
- 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()
- 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
|
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:
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. |
…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.
…resh decoupling
…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.
…resh decoupling


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
title_generator.pywithrefresh_title_after_auto_memory()that generates a concise title from recent messages after auto-memory succeeds.middlewares.pyso_flush_auto_memorycallstitle_refresh_callbackon success, instead of silently completing.manager.pyto persist the refreshed title and recordauto_title_refreshmetadata inchat.meta._coordinator.py(INFO log) so title refresh events are visible in logs.title_refresh_callback.Summary of changes
Test plan
title_refresh_callbackis only called after successful auto-memory flushchat.meta["auto_title_refresh"]is recorded correctly