eemario opened a new pull request, #1422: URL: https://github.com/apache/flink-agents/pull/1422
Linked issue: #1411 ### Purpose of change Use Java `Duration` and Python `timedelta` for MCP initialization timeouts, and Java `Duration` for retry delays. Java builder timeouts retain their fractional seconds. #### Runtime flow Descriptor and JSON inputs use the existing duration parser. Java passes the duration to the HTTP request and MCP client; Python passes it to the HTTP transport, session, and tool call. Java retry delays convert to milliseconds only at RetryExecutor. #### Key decisions Keep timeout precision at whole microseconds and validate retry delays at their existing whole-millisecond precision. A local Jackson deserializer handles MCPServer constructor inputs, and ISO strings preserve serialized durations. Shared ResourceDescriptor changes are identical to #1410 and can be rebased away once either PR merges. ### Behavioral Semantics #### Input behavior | Input / option | Result | | --- | --- | | Duration/timedelta, unit string, ISO string | Parsed without sub-microsecond truncation | | Bare integer / integer string | Milliseconds | | timeout omitted | 30 seconds | | Python sse_read_timeout omitted | 5 minutes | | Java backoff omitted | Initial 100 ms, maximum 10 s | #### Contracts and failures Timeouts must be positive; malformed, zero, negative, and sub-microsecond values fail at construction. Java null values retain constructor/descriptor defaults; Python explicit None remains invalid. Java initialBackoff and maxBackoff must be non-negative, whole milliseconds within long range. Invalid values fail at construction. RetryExecutor retains its existing validation that maximum backoff is at least the initial backoff when the executor is initialized. Retry execution and authentication are otherwise unchanged. ### Tests | Contract | Coverage | | --- | --- | | Descriptor duration parsing and JSON | ResourceDescriptorTest | | Java builder/descriptor/JSON inputs, defaults, fractional timeout preservation, invalid durations | MCPServerTest | | MCP serialization and tool/prompt behavior | MCPSerializationTest, MCPToolTest, MCPPromptTest | | Python input forms, JSON, rejection, local MCP calls | test_mcp.py | 51 Java and 22 Python tests passed. Spotless, Ruff, and git diff --check passed. Java and Python MCP tests were run separately because the Python fixture uses port 8000. Remote MCP services and the Pemja cross-language suite were not tested. <details> <summary>Verification commands</summary> ```bash mvn --batch-mode --no-transfer-progress test -pl integrations/mcp -am -Dtest=ResourceDescriptorTest,MCPServerTest,MCPSerializationTest,MCPToolTest,MCPPromptTest -Dsurefire.failIfNoSpecifiedTests=false python -m pytest flink_agents/integrations/mcp/tests/test_mcp.py -q ``` </details> ### API Java MCPServer constructor and getters use Duration. `getTimeoutSeconds` becomes `getTimeout`; backoff keys/getters become `initialBackoff`/`getInitialBackoff` and `maxBackoff`/`getMaxBackoff`. Builder signatures remain Duration-based. Python `timeout` and `sse_read_timeout` become timedelta fields. Bare timeout numbers now mean milliseconds instead of seconds. Adds the shared public `ResourceDescriptor.getDurationArgument` accessor. Defaults are unchanged; no deprecated compatibility path is retained. ### Documentation - [ ] doc-needed - [ ] doc-not-needed - [x] doc-included ### Was this patch authored or co-authored using generative AI tooling? - [x] Yes - [ ] No Generated-by: Codex CLI 0.167.0-alpha.4.1 (GPT-6) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
