-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Labels
priority/majorDefault priority of the PR or issue.Default priority of the PR or issue.tech debt[Issue Type] User-unaware issues, such as code refactor and infrastructure maintenance.[Issue Type] User-unaware issues, such as code refactor and infrastructure maintenance.
Description
Search before asking
- I searched in the issues and found nothing similar.
Description
AgentPlan (624 lines) mixes plan definition, resource caching/resolution, Python bridge wiring, and serialization
into one class. This makes the plan mutable after construction, prevents testing resource resolution independently,
and couples Python MCP discovery logic to the plan definition.
What is currently not ideal?
AgentPlanis mutable after construction —setPythonResourceAdapter()writes to the transientresourceCache- Resource resolution (
getResource()) and cleanup (close()) are runtime concerns living on a serializable plan
object - Python MCP tool/prompt discovery is entangled with the plan — AgentPlan directly references
PythonMCPServer,
PythonResourceAdapter - Cannot test resource resolution without constructing a full AgentPlan
- Blocks runtime MCP reloading — the plan owns the cache, so refreshing tools requires mutating the plan
How should it be fixed?
Extract two classes:
ResourceCache(~80 lines) — Lazy resource resolution, caching, dependency injection, and close/cleanup.
Created by the operator inopen(), owned by the operator lifecycle.PythonResourceBridge(~55 lines) — Static method that discovers tools/prompts from Python MCP servers and
registers them in the cache. Called fromActionExecutionOperator.initPythonResourceAdapter().
After extraction, AgentPlan becomes an immutable data object (~490 lines) holding actions, resource providers, and
config. The removed public methods are getResource(), close(), and setPythonResourceAdapter().
Files affected
plan/.../AgentPlan.java— remove extracted methods and transient fieldsplan/.../ResourceCache.java— newplan/.../PythonResourceBridge.java— newruntime/.../RunnerContextImpl.java— delegate toResourceCacheinstead ofAgentPlanruntime/.../JavaRunnerContextImpl.java— constructor changeruntime/.../PythonRunnerContextImpl.java— constructor changeruntime/.../ActionExecutionOperator.java— create and ownResourceCache- 6 test files updated to use
ResourceCachedirectly
References
- Originally proposed in Discussion #516 under "Tech Debt"
Are you willing to submit a PR?
- I'm willing to submit a PR!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority/majorDefault priority of the PR or issue.Default priority of the PR or issue.tech debt[Issue Type] User-unaware issues, such as code refactor and infrastructure maintenance.[Issue Type] User-unaware issues, such as code refactor and infrastructure maintenance.