Skip to content

[Bug]:Description (Memory fails to load due to inconsistent Workspace paths) #1441

@newswen

Description

@newswen

🧩 Problem Phenomenon

When using the following workspace configuration:

Path workspace = Paths.get(".agentscope/workspace/note");

During system runtime, the memory file path returned by memory_search is resolved to an absolute path, for example:

D:/xx/AgentScope-Study/.agentscope/workspace/note/yw/memory/2026-05-19.md

🔁 Filter Logic Issue

In the memory filtering logic of the harness module, the following judgment exists:

!resolved.startsWith(this.workspace)

It further affects the final result:

!resolved.startsWith(this.workspace) ? "" : resolved

❗ Root Cause

The issue is caused by a combination of inconsistent path semantics + incorrect string judgment method:
1️⃣ resolved is an absolute path

D:/xx/AgentScope-Study/.agentscope/workspace/note/yw/memory/2026-05-19.md

2️⃣ this.workspace is a relative path

.agentscope/workspace/note

3️⃣ The string startsWith comparison becomes invalid
Resulting in:

resolved.startsWith(this.workspace) == false

4️⃣ Trigger fallback logic (Key Point)
Due to the failed filtering condition, the fallback logic is executed:

!resolved.startsWith(this.workspace) ? "" : resolved

The final result becomes:

""

👉 The memory file is silently discarded

💥 Actual Impact

  • The return result of memory_search is emptied
  • The memory file exists but cannot be added to the context
  • No exception logs (silent failure)
  • More likely to be triggered on Windows (D:/)

🎯 Expected Behavior

The memory path judgment must meet the following requirements:

  • Support consistency between relative/absolute workspace paths
  • Avoid misjudgment caused by different path representation formats
  • Memory files should be correctly identified as resources within the workspace
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions