You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Harness prompt guidance advertises knowledge and skill paths without matching resources #3778
Two Harness prompt instructions can advertise resource paths that are not present in the collected materials:
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.
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.
Hi, I'd like to work on this. Two scoped fixes per the report: (1) WorkspaceContextMiddleware only emits the ## Domain Knowledge section when knowledge materials actually exist (readKnowledgeMd/listKnowledgeFiles both empty → omit the section instead of advertising an empty tree); (2) DEFAULT_CODE_EXECUTION_INSTRUCTION stops unconditionally promising <files-root> — condition the sentence on the catalog containing at least one entry with a files root, or reword to "scripted skills include ". Tests for both. (Note: #3797 already fixed part of the skill-guidance side — will build on main and check what remains.) PR coming shortly.
Following up on my earlier claim — starting implementation now. Two scoped fixes: WorkspaceContextMiddleware omits the ## Domain Knowledge section when both knowledge reads are empty; DEFAULT_CODE_EXECUTION_INSTRUCTION conditions the <files-root> promise on the catalog actually containing scripted skills. PR coming shortly.
Update: verified both points against current main — already fixed (likely via #3797):
WorkspaceContextMiddleware.buildGuidance now guards the Domain Knowledge section with if (!knowledgeContent.isBlank() || !knowledgeFiles.isEmpty()) — omitted when both reads are empty.
SkillPromptBuilder.DEFAULT_CODE_EXECUTION_INSTRUCTION conditions on presence ("For skills that include <files-root>... For skills without <files-root>, load resources with load_skill_through_path") — no unconditional promise.
Withdrawing my claim; this issue should be closable if the reporter confirms against a current build.
Closing as fixed by #3797 (merged), which aligns skill resources with the execution guidance advertised in Harness prompts. Reopen if guidance still references missing resources.
Activity
aiyili commentedon Oct 28, 2026
Hi, I'd like to work on this. Two scoped fixes per the report: (1)
WorkspaceContextMiddlewareonly emits the## Domain Knowledgesection when knowledge materials actually exist (readKnowledgeMd/listKnowledgeFiles both empty → omit the section instead of advertising an empty tree); (2)DEFAULT_CODE_EXECUTION_INSTRUCTIONstops unconditionally promising<files-root>— condition the sentence on the catalog containing at least one entry with a files root, or reword to "scripted skills include ". Tests for both. (Note: #3797 already fixed part of the skill-guidance side — will build on main and check what remains.) PR coming shortly.aiyili commentedon Nov 5, 2026
Following up on my earlier claim — starting implementation now. Two scoped fixes:
WorkspaceContextMiddlewareomits the## Domain Knowledgesection when both knowledge reads are empty;DEFAULT_CODE_EXECUTION_INSTRUCTIONconditions the<files-root>promise on the catalog actually containing scripted skills. PR coming shortly.aiyili commentedon Nov 5, 2026
Update: verified both points against current
main— already fixed (likely via #3797):WorkspaceContextMiddleware.buildGuidancenow guards the Domain Knowledge section withif (!knowledgeContent.isBlank() || !knowledgeFiles.isEmpty())— omitted when both reads are empty.SkillPromptBuilder.DEFAULT_CODE_EXECUTION_INSTRUCTIONconditions on presence ("For skills that include<files-root>... For skills without<files-root>, load resources withload_skill_through_path") — no unconditional promise.Withdrawing my claim; this issue should be closable if the reporter confirms against a current build.
juruoO-o commentedon Nov 12, 2026
Closing as fixed by #3797 (merged), which aligns skill resources with the execution guidance advertised in Harness prompts. Reopen if guidance still references missing resources.