Skip to content

refactor(harness): move skill catalogs and session facts to runtime context - #3691

Merged
jujn merged 1 commit into
agentscope-ai:mainfrom
Buktal:codex/harness-workspace-runtime-context
Oct 21, 2026
Merged

jujn merged 1 commit into
agentscope-ai:mainfrom
Buktal:codex/harness-workspace-runtime-context

Conversation

@Buktal

@Buktal Buktal commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

AgentScope-Java Version

2.1.0-SNAPSHOT

Description

Refs #3690. Independent PR 1/4: workspace session facts and skill discovery.

Summary

Changing the session ID or skill catalog currently rewrites the system prompt. Keep environment instructions in system, and render date/session facts and the skill catalog through the existing runtime-material channel.

system: environment instructions
conversation
runtime: date/session facts + available_skills

The catalog is required so it survives budget selection before history compaction; date/session facts remain optional. EN/ZH skill and workspace docs describe the placement.

Evidence

  • Before: the catalog lives in system; making it optional runtime material drops it before compaction and leaves it absent from the first compacted request.
    After: skillsRemainVisibleInTheFirstRequestAfterCompaction drives the real middleware, context builder and compactor with 20,000 characters of history and checks that the first prepared request still contains the skill. Environment placement and skill-isolation tests cover the layout.
  • Independent branch validation: mvn -B -T1 -pl agentscope-harness -am test spotless:check passed; 1,284 Harness tests, 0 failures/errors, 18 skipped; 2,742 Core tests, 0 failures/errors, 8 skipped.
  • This checks input placement and visibility; provider cache savings have not been measured. Workspace paths remain in the environment instructions, so this does not close [Feature]: render session-scoped variables at the end of the system prompt #2671.

Merge Danger

Door: two-way. Reverting restores the previous layout; stored state and public builders are unchanged.

Blast Radius: Harness. Skills appear after the conversation and remain required during budget selection.

Checklist

  • Code has been formatted with mvn spotless:apply
  • Relevant module tests and Spotless pass on this independent branch
  • Javadoc comments follow project conventions
  • Related EN/ZH documentation has been updated
  • Code is ready for review

@mintlify

mintlify Bot commented Oct 21, 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 4aa66fb.

Approve preview

@jujn
jujn merged commit 49622b3 into agentscope-ai:main Oct 21, 2026
6 of 7 checks passed
xzxiaoshan added a commit to xzxiaoshan/agentscope-java that referenced this pull request Oct 23, 2026
Conflict resolution in HarnessAgent#forceCompactAndRetry: keep main's
overflow-retry rework (agentscope-ai#3661 — persist compacted state via
updateAgentState, retry with retryInput to avoid duplicate input) and
re-apply the capability-surface re-prepare on the retry call so the
grant surface survives the overflow path.

Adapt HarnessSkillMiddlewareGrantTest to main's agentscope-ai#3691 change: the
skills block now rides a tail runtime material (harness:skills) instead
of the system prompt, so grant-visibility assertions move there.
Buktal added a commit that referenced this pull request Nov 19, 2026
…4248)

Closes #4247.

## AgentScope-Java Version

`2.1.0-SNAPSHOT`

## Description

Follow-up to #3691. Place the Harness skill catalog where the shared
request prefix can include it as conversation history grows.

## Summary

```text
main      System -> history -> runtime materials (including skills) and task state -> references
fork/kst  System -> runtime materials (including skills) -> history -> task state -> references
Proposed  System -> skill catalog -> history -> other runtime materials and task state -> references
```

The earlier fork groups the catalog with session facts and per-call
values from `ContextBlock.runtime(...)`. A changing value can end the
shared prefix before the conversation. [Fork commit
`eb50ccd96`](Buktal@eb50ccd)

`HarnessContextBuilder` uses the existing `harness:skills` source ID to
render the catalog as a request-only User message. The catalog remains
required during compaction. If putting it before history would leave an
Assistant message last, Harness places the catalog at the end as a User
message.

## Evidence

- **Before** `skillCatalogPrecedesGrowingHistoryAndChangingRuntimeState`
fails on `main` (`c1d482900`) because the catalog follows history.
- **After** The ordering, empty-input continuation, and compaction
regressions pass. System text matches across all three requests. The
first two share the same catalog text, and the third reflects the
changed skill description. Changing runtime values follow history.
Provider cache hits and savings remain unmeasured.
- **Maven** Spotless and the full reactor pass with the Windows CI
command below. Harness reports 1,841 tests, 39 skipped, and zero
failures or errors.
- **Docs** All 20 docs tests pass, and `npm run validate` passes. The
`npm run broken-links` report matches the baseline's 2,750 existing
broken links.

```sh
mvn -B -T1C "-Dmaven.javadoc.skip=true" "-Dmaven.source.skip=true" "-Djacoco.skip=true" "-DskipDurableWindowsTests=true" clean verify
```

## Merge Danger

**Door** Two-way. Reverting restores the previous message order.

**Blast radius** Harness model requests with a visible skill catalog.

## Checklist

- [x] Spotless formatting checked.
- [x] Regression tests and Windows CI build pass.
- [x] Javadoc and the English and Chinese Harness guides describe the
request layout.
- [x] Tracking issue linked.
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.

[Feature]: render session-scoped variables at the end of the system prompt

2 participants