Skip to content

修复 harness 中 memory glob 路径归一化问题#1481

Open
guslegend0510 wants to merge 3 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1466
Open

修复 harness 中 memory glob 路径归一化问题#1481
guslegend0510 wants to merge 3 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1466

Conversation

@guslegend0510

Copy link
Copy Markdown

概述

修复 MemoryConsolidator 在处理 memory/*.md 时对路径归一化不一致的问题,避免本地文件系统返回绝对路径或 Windows 路径时,根目录下的日记文件被漏读、漏合并。

变更内容

  • 新增 WorkspaceManager.toWorkspaceRelativePath(...),统一把文件系统返回的路径转换为 workspace 相对路径。
  • MemoryConsolidator 在读取 daily ledger 时,先将 glob 结果归一化,再进行过滤、排序和读取。
  • 优化 fileName(...),兼容 Windows 路径分隔符。
  • 增加回归测试,覆盖 LocalFilesystem 下根目录 memory/2026-05-20.md 的合并场景。

验证

  • mvn -s codex-maven-settings.xml -pl agentscope-harness -am "-Dtest=MemoryConsolidatorFilesystemTest,FilesystemGlobTest" test

@guslegend0510 guslegend0510 requested a review from a team May 24, 2026 04:30
@CLAassistant

CLAassistant commented May 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.06977% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...scope/harness/agent/memory/MemoryConsolidator.java 62.50% 4 Missing and 2 partials ⚠️
...cope/harness/agent/workspace/WorkspaceManager.java 88.88% 1 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@guslegend0510

Copy link
Copy Markdown
Author

@LearningGp 麻烦审核一下下谢谢

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 AI Review

This PR fixes a real path normalization bug in MemoryConsolidator.readDailyEntries where LocalFilesystem.glob() returns absolute paths that the old toRelative() helper couldn't handle, causing daily memory files to be silently skipped. The fix introduces a centralized WorkspaceManager.toWorkspaceRelativePath() method that correctly handles absolute paths (via Path.startsWith + relativize), virtual/remote paths (leading / stripping), and Windows separators. The refactoring is clean — the eligible list now stores already-normalized relative strings instead of FileInfo objects, eliminating the redundant toRelative() call. Test coverage is solid, including a targeted regression test (consolidate_localFilesystem_readsRootDailyFile) that reproduces the exact bug scenario with LocalFilesystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/harness agentscope-harness (test/runtime support) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants