Skip to content

[Bug]: Harness prompt guidance advertises knowledge and skill paths without matching resources #3777

Closed

Description

@DennisWLX

Describe the bug

Two Harness prompt instructions can advertise resource paths that are not present in the collected materials:

  1. WorkspaceContextMiddleware always adds ## Domain Knowledge, says that knowledge/ holds many detailed reference documents, and asks the model to browse it even when both readKnowledgeMd() and listKnowledgeFiles() return empty results.
  2. SkillPromptBuilder.DEFAULT_CODE_EXECUTION_INSTRUCTION says every skill includes <files-root>. A mixed catalog may contain a documentation-only skill without that element and a scripted skill with it. The generic instruction contradicts the catalog.

To Reproduce

  • Create a WorkspaceManager for an empty temporary workspace and invoke WorkspaceContextMiddleware.onSystemPrompt with an empty RuntimeContext. Inspect WorkspaceContextMaterials (or the rendered system prompt): the working-principles instruction still advertises knowledge references.
  • Render a SkillCatalog containing one entry whose filesRoot is null and another with a valid resource root. Both entries are discoverable, but the code-execution instruction claims each one includes <files-root>.
  • These cases require no LLM, credentials, or external services.

Expected behavior

  • Derive knowledge content and navigation guidance from the same collected body and file catalog. Omit knowledge guidance when both are empty; keep inline-only knowledge without promising a browsable directory; retain navigation when actual file paths were collected, including when reference material is omitted for context budget.
  • Describe file listing and script execution only for skills that provide <files-root>. Documentation-only skills must remain discoverable and loadable through load_skill_through_path.
  • Preserve memory behavior and public APIs.

Error messages

This is a prompt/resource mismatch. It can cause unnecessary attempts to access missing paths; the deterministic reproduction is the inaccurate instruction itself.

Environment

  • AgentScope-Java: 2.1.0-SNAPSHOT, upstream main 16cb024ae62a10db2aedc2371f4d729194ffda82
  • Java: 17
  • OS: macOS

Additional context

#3374 already fixed reporting a cached directory when a repository stages no resources. This report covers the remaining generic guidance, not a reimplementation of that fix. #3278 (an independent knowledge switch) and #3614 (disabled filesystem tools) are related but have different triggers and scope.

I will prepare a focused PR with regression tests and aligned English/Chinese documentation.

Activity

  1. added a commit that references this issue on Oct 27, 2026
    2f0da97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions