Repository navigation
fix(skill): move blocking skill reload off reactive event-loop threads - #3792
Merged
jujn merged 1 commit intoOct 27, 2026
Merged
Conversation
DynamicSkillMiddleware.onSystemPrompt performed repository reads, signature computation and box materialization synchronously on the subscribing thread, blocking reactive event-loop threads. Wrap the reload in Mono.fromCallable(...).subscribeOn(Schedulers.boundedElastic()); per-call reload semantics and the content-addressed box cache are unchanged. The cache-hit fast path cannot stay on the calling thread because the cache key (content signature) is only known after the blocking repository read.
jujn
approved these changes
Oct 27, 2026
4 tasks
xzxiaoshan
added a commit
that referenced
this pull request
Oct 27, 2026
…le lock map (#3795) Two targeted fixes in the skill materialisation path: - `DynamicSkillMiddleware.computeSignature` copied the whole resource map on every key inside the hash loop (O(n²) per skill). It now enumerates keys once via `getResourcePaths()` and reads values with per-key `getResource()`; the hashed bytes — and therefore signature values — are unchanged (pinned by a golden-value regression test). - `SkillBox.FILE_LOCKS` was a static per-path lock map that accumulated one lock object per materialised path and was never cleaned. It is replaced by a fixed 256-stripe lock table (`floorMod(pathHash, N)`): same-path mutual exclusion is preserved, unrelated paths colliding on a stripe merely serialise, and lock memory no longer grows with path count. Also includes (kept as separate commits): - Merge of upstream/main; while resolving it, the two `DynamicSkillMiddlewareTest` fixtures added by #3792 still used `my_skill`, which the skill-name validation from #3787 rejects — renamed to `my-skill` following the convention #3787 itself applied to the older fixtures. - `test(channel)`: deflake `BotLoopGuardTest.activePeersSurviveEvictionOfIdleOnes` — `allow()` piggybacks a sweep on the same threshold idle eviction uses, so a ~100ms runner stall (e.g. under `mvn -T1C`) let the sweep evict the idle peer before the explicit `evictIdlePeers()` assertion. Rebalanced sleeps for a 400ms stall margin; assertions unchanged. Verified with `mvn -T1C -pl agentscope-core -am test` (2805 tests, 0 failures) and `spotless:check`.
This was referenced Oct 27, 2026
Buktal
added a commit
that referenced
this pull request
Oct 28, 2026
## AgentScope-Java Version 2.1.0-SNAPSHOT ## Description Refs #3794, review unit 3 of 3. Synthetic messages can be durable conversation records or request-only projections. Treating both as transient moves persisted notifications out of order and keeps them outside compaction. Comparing copied/restored messages by Java object/value types can also prevent a valid summary from being written back. ## Summary ```text canonical history (including persisted synthetic notifications) -> ordered conversation -> budget/compact -> guarded summary writeback request-only projections -> current request only overflow retry -> latest canonical history + surviving request projections system sources -> one System message / one TextBlock, joined by blank lines ``` - Use canonical membership/IDs to distinguish persisted notifications from transient projections, retaining ordinary history order, budgeting, and compaction behavior. - Require complete serialized-history equality before durable writeback. Use the configured JSON codec and a precision-preserving JSON-tree comparison so restored number types match while edited content, metadata, and high-precision decimal values do not. - Rebuild overflow retries from current history without reviving compacted-away notifications. Preserve concurrent-history and final-budget rejection guards. - Clarify the synthetic marker's lifetime contract and update English/Chinese context documentation. ## Evidence - **Before:** with the old history comparison, JSON-restored notification cases failed summary persistence: 3 failures in a 37-test context/compaction regression run. **After:** all 37 passed after the numeric-comparison fix, including protection for distinct `1.0000000000000000001` and `1.0000000000000000002` metadata. `ContextPipelineV2Test` also covers copied/converted notifications, same-ID edits, single-block system text, final-budget rejection, and concurrent changes; `CompactionMiddlewareTest` covers overflow reconstruction. - Independent branch: `mvn -B -T1C clean verify` passed across 99 modules: **11,317 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. - Includes the shared three-line `my_skill` -> `my-skill` test-fixture correction needed after #3787/#3792. It is also in both sibling PRs so these branches validate independently and can merge in any order. ## Merge Danger **Door:** two-way No serialized-state schema change. The existing synthetic marker continues to identify origin; canonical membership determines whether a message is durable. **Blast Radius:** context Changes request layout, compaction eligibility, summary writeback, and overflow retries. Fake-model regressions verify these paths; provider cache behavior and task quality were not benchmarked. #3780's older streaming/backport and custom memory-flush-prompt concerns are separate. ## 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.
Summary
DynamicSkillMiddleware.onSystemPromptexecuted repository reads (Git/DB/FS), signature computation and box materialization synchronously on the subscribing thread, blocking reactive event-loop threads.Mono.fromCallable(...).subscribeOn(Schedulers.boundedElastic()). The cache-hit fast path cannot stay on the calling thread because the cache key (content signature) is only known after the blocking repository read.filterVisiblehook are unchanged; no reactive signatures added to theAgentSkillRepositorySPI.Tests
runsReloadOnBoundedElasticWhenCacheMisses(assertsgetAllSkillsruns on aboundedElasticthread),keepsCacheHitPathBehaviorUnchanged(same-signature reload reuses the cached box; repository still read once per call).mvn -T1C -pl agentscope-core -am test: 2787 passed, 0 failed, 8 pre-existing skips;spotless:checkclean.