Skip to content

fix(harness): align knowledge and skill guidance with available resources - #3779

Merged
Buktal merged 2 commits into
agentscope-ai:mainfrom
DennisWLX:codex/fix-resource-guidance-92714
Oct 27, 2026
Merged

Buktal merged 2 commits into
agentscope-ai:mainfrom
DennisWLX:codex/fix-resource-guidance-92714

Conversation

@DennisWLX

@DennisWLX DennisWLX commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT, based on upstream main at 16cb024ae62a10db2aedc2371f4d729194ffda82.

Description

Closes #3777.

An empty knowledge workspace currently receives instructions to browse a supposedly populated knowledge/ tree. A catalog mixing documentation-only and scripted skills also receives an instruction claiming that every entry has <files-root>. These instructions can cause reads of paths that were never declared as available.

Collect the knowledge body and file catalog once, then use that snapshot for both reference material and guidance. Omit Domain Knowledge guidance when both are empty; keep inline-only knowledge without promising a directory; include file navigation only when paths were collected, retaining the existing context-budget fallback. Limit skill file listing and execution guidance to entries that actually provide <files-root>; documentation-only skills remain discoverable and loadable.

Add regressions for empty knowledge, inline-only references, remote catalogs, host fallback, failed reads, mixed skill catalogs and rootless body loading. Adapt the assertions to the current separation between SYSTEM instructions and REFERENCE material, while preserving memory behavior. Update the matching English and Chinese workspace/skill documentation. No POM, public API or staging implementation changes; #3374 already fixed the zero-resource staging result.

Validation on Java 17/macOS:

  • mvn -B -T1C -pl agentscope-harness -am -DskipTests install: dependency/module installation passed locally.
  • mvn -B -T1C -pl agentscope-harness -Dtest=WorkspaceContextMiddlewareSandboxPromptTest,WorkspaceContextMiddlewareMemoryPromptTest,SkillRuntimeTest test: 44 tests, no failures/errors/skips.
  • mvn -B -T1C -pl agentscope-harness test spotless:check: 1,407 tests, no failures/errors, 32 skipped; formatting passed.
  • Docs: npm test (13 passed), npm run validate (432 pages, 584 redirects and build validation passed), npm run broken-links (no broken links). Revalidated after the final workspace prose update; no links changed.
  • git diff --check: passed.

Follow-up (2026-10-27): Windows CI exposed two platform-specific assertions in the new catalog tests. Their expected paths used /, while the existing renderer uses native Path formatting. Build the expected catalog entries with Path.of, retaining checks for both reference content and exclusion from SYSTEM instructions. Re-ran the 44 focused tests and Spotless successfully on macOS. Full-repository clean verify now passes on both Ubuntu and Windows in Java CI run 40464242577; documentation validation, License and Module Sync checks also pass.

The full repository Maven build and tests passed in Ubuntu and Windows CI. Real sandbox/LLM execution was not run. Skipped tests are not counted as executed passes.

Checklist

  • Code has been formatted with mvn spotless:apply (Harness module).
  • All repository tests are passing — full-repository clean verify passed in Ubuntu and Windows CI; local Harness results and skips are listed above.
  • Javadoc comments remain applicable; no public API was added.
  • Related documentation has been updated in English and Chinese.
  • Code is ready for review.

@mintlify

mintlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 19180f0.

Approve preview

@DennisWLX DennisWLX changed the title fix: 按实际资源生成 Harness 知识与技能指导(#92714) fix(harness): align knowledge and skill guidance with available resources Oct 26, 2026
Build expected catalog entries with Path.of because the renderer uses native Path formatting. Preserve checks that catalog paths appear in reference material and stay out of system instructions.
@DennisWLX
DennisWLX force-pushed the codex/fix-resource-guidance-92714 branch from ef61d9c to 19180f0 Compare October 27, 2026 07:17

@Buktal Buktal 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.

LGTM

@Buktal
Buktal merged commit 2f0da97 into agentscope-ai:main Oct 27, 2026
7 checks passed
Buktal added a commit that referenced this pull request Oct 28, 2026
## AgentScope-Java Version

2.1.0-SNAPSHOT

## Description

Refs #3794, review unit 2 of 3. A Harness skill can be discoverable
while its lazily stored support files are unreadable, and its execution
guidance can describe the host shell or path as if it belonged to a
sandbox. This PR aligns the loader and prompts with the available
resources and active backend.

## Summary

```text
skill catalog -> exact skill ID -> full SKILL.md -> referenced file
  repository lazy reader first; origin fallback when applicable
  keep raw bytes and paths; choose a content fence longer than the body
execution guidance
  host facts + active sandbox workspace metadata + per-call shell contract
```

- Share guarded filesystem resource reading/listing between Core and
Harness. Preserve repository-reader precedence and filtering, and read
binary resources as bytes without interpreting a literal `base64:`
prefix.
- Require full instructions for a selected skill, allow reuse while
those instructions remain visible, and use dynamic fences around loaded
content. File-execution guidance applies to entries with a files root;
loader-only skills remain loadable.
- Advertise raw paths and the execution backend's quoting/interpreter
requirements. Use POSIX working-directory commands for a sandbox even on
a Windows host. Describe each shell invocation as fresh,
`working_directory` as per-call, and `grep_files.pattern` as literal
text.
- Derive sandbox roots from the current unreleased acquisition's
metadata. Label host workspace/JVM temp paths as host facts, distinguish
routed shell/file backends, clarify project-rule applicability, and
report failed artifact delivery as incomplete.
- Update matching English and Chinese skill/workspace pages.

## Evidence

- **Before:** a filesystem skill with unloaded support resources could
be advertised but fail on the next resource read; pre-escaped paths and
inferred `/workspace`/container identities could describe the wrong
execution environment.
**After:** `LazyFileSystemSkillLoadingTest` exercises two model rounds,
missing-file listing, traversal rejection, filtering, repository denial
precedence, and binary fidelity. Skill rendering, sandbox metadata,
path, filesystem-schema, and shell tests cover the other contracts using
local fixtures.
- Independent branch: `mvn -B -T1C clean verify` passed across 99
modules: **11,327 tests**, 0 failures/errors, **242 skipped**. Spotless
ran without skip flags. Docs: `npm test` (13/13) and `npm run validate`
(432 pages, 584 redirects, Mintlify build) passed. `npm run
broken-links` reports 2,218 links across 326 files, the same counts
recorded before; individual links were not baseline-attributed.
- Rebased onto main at `2f0da9708` (#3779), preserving
knowledge-presence gating and both sets of regressions while retaining
backend-aware execution guidance. Focused Core/Harness validation: **207
tests**, 0 failures/errors/skips; Spotless and `git diff --check`
passed.

## Merge Danger

**Door:** two-way

No migration or provider-service dependency. Files-root strings now
contain raw paths; prompts explain quoting for the actual backend.

**Blast Radius:** harness

Touches skill loading and model-visible execution guidance. No real
Docker/Kubernetes run or model-quality improvement is claimed. #3779 is
now included in the base. Its knowledge-presence gating is preserved;
mixed-catalog guidance retains resource-root checks and uses the actual
execution environment's shell and interpreter.

## Checklist

- [x] Spotless formatting check passes as part of full verification
- [x] All executed tests pass; skipped-test count is reported above
- [x] Javadoc updated for changed contracts
- [x] Related English and Chinese documentation updated
- [x] Code ready for review
chickenlj added a commit that referenced this pull request Nov 13, 2026
…rces (#3779)

Source: 2f0da97
Candidate: 9221b57c85b2f3d4b15a453a621150d8afbee026
Union-Of: execution53+skill-union(810c7d7) + tasks-standalone(511fd8a5)
Conflict-Resolution: docs/v2/en|zh/docs/harness/skill.md <files-root> paragraph — adopted tasks-lane semantics, kept skill-lane execute tool name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants