Skip to content

[plan] Extract ResourceCache and PythonResourceBridge from AgentPlan#548

Open
weiqingy wants to merge 1 commit intoapache:mainfrom
weiqingy:issue_547
Open

[plan] Extract ResourceCache and PythonResourceBridge from AgentPlan#548
weiqingy wants to merge 1 commit intoapache:mainfrom
weiqingy:issue_547

Conversation

@weiqingy
Copy link
Collaborator

Linked issue: #547

Purpose of change

AgentPlan (624 lines) mixes plan definition, resource caching/resolution, Python bridge wiring, and serialization.
This PR extracts two classes to separate concerns:

  • ResourceCache — lazy resource resolution, caching, and cleanup. Created by the operator in open(), owned by
    the operator lifecycle.
  • PythonResourceBridge — static discoverPythonMCPResources() for Python MCP tool/prompt discovery. Called
    during operator init.

After extraction, AgentPlan becomes immutable after construction (~490 lines, down from 624). The removed public
methods are getResource(), close(), and setPythonResourceAdapter().

Tests

  • mvn test -pl plan — all plan module tests pass
  • mvn test -pl runtime — all runtime module tests pass
  • ./tools/lint.sh -c — formatting check passed
  • ./tools/ut.sh -j — full Java test suite passed

API

Yes. Three public methods removed from AgentPlan:

  • getResource(String, ResourceType) — replaced by ResourceCache.getResource()
  • close() — replaced by ResourceCache.close()
  • setPythonResourceAdapter(PythonResourceAdapter) — replaced by PythonResourceBridge.discoverPythonMCPResources()

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions bot added priority/major Default priority of the PR or issue. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. doc-not-needed Your PR changes do not impact docs labels Feb 22, 2026
@weiqingy
Copy link
Collaborator Author

Both CI failures are unrelated to our changes:

  1. it-python [flink-2.2] — Ollama download returned HTTP 404. This is a transient infrastructure issue — the Ollama release artifact was temporarily unavailable. Nothing to fix on our side.
  2. cross-language — Py4JError / Py4JNetworkError in the cross-language e2e tests. The Java gateway crashed during test_java_chat_model_integration and subsequent tests couldn't connect. Our PR only touches plan/ and runtime/ Java code — it doesn't affect the Python-Java bridge or cross-language e2e test infrastructure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant