Skip to content

fix(core): synchronize shared JSON schema generation - #2857

Open
mikemikimike wants to merge 4 commits into
agentscope-ai:mainfrom
mikemikimike:codex/fix-2792-wire-message-bus
Open

fix(core): synchronize shared JSON schema generation#2857
mikemikimike wants to merge 4 commits into
agentscope-ai:mainfrom
mikemikimike:codex/fix-2792-wire-message-bus

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Summary

JsonSchemaUtils shares one victools SchemaGenerator instance across all structured-output calls. The generator and Jackson introspection caches are not thread-safe, so overlapping calls can fail with ConcurrentModificationException.

This change serializes schema generation for both class and generic type entry points with a dedicated lock. The public API and schema conversion behavior remain unchanged.

Testing

  • mvn -pl agentscope-core -Dtest=JsonSchemaUtilsTest test (8 tests passed)
  • mvn -pl agentscope-core spotless:apply
  • git diff --check

Closes #2795.

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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]: JsonSchemaUtils shared SchemaGenerator is not thread-safe (ConcurrentModificationException under concurrent structured calls)

1 participant