Repository navigation
fix(harness): align knowledge and skill guidance with available resources - #3779
Merged
Buktal merged 2 commits intoOct 27, 2026
Merged
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
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
force-pushed
the
codex/fix-resource-guidance-92714
branch
from
October 27, 2026 07:17
ef61d9c to
19180f0
Compare
5 tasks done
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
2.1.0-SNAPSHOT, based on upstreammainat16cb024ae62a10db2aedc2371f4d729194ffda82.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.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 nativePathformatting. Build the expected catalog entries withPath.of, retaining checks for both reference content and exclusion from SYSTEM instructions. Re-ran the 44 focused tests and Spotless successfully on macOS. Full-repositoryclean verifynow 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
mvn spotless:apply(Harness module).clean verifypassed in Ubuntu and Windows CI; local Harness results and skips are listed above.