eemario opened a new pull request, #1419: URL: https://github.com/apache/flink-agents/pull/1419
Linked issue: #1384 ### Purpose of change #### Outcome Raw duration configuration now treats an integer such as `1000` the same as the text `"1000"`: both mean milliseconds. This also removes duplicate validation and retry conversion helpers, and consolidates duration documentation. #### Runtime flow and key decisions Java and Python duration parsers retain native duration values and parse other non-null values through their string representation. Configuration access adds the option name to parsing errors. Both Java plans and Python plan JSON reach private execution-option validation in `CompileUtils` before operator construction. Chat, Decision, and Java routing-judge calls normalize the initial retry interval to non-negative whole milliseconds. Exponential backoff, sleep, metrics, and response fields then use the same millisecond value. This avoids converting back and forth between durations and integers. Unused Python submission validation is removed because production submission already goes through Java. ### Behavioral Semantics #### Interaction decisions | Input | Retry interval | Short-term memory TTL | | --- | --- | --- | | Zero or negative | Retry without waiting | Disable expiration | | Positive, below 1 ms | Retry without waiting | Reject at submission | | Positive, at least 1 ms | Truncate initial interval to milliseconds, then double for subsequent retries | Truncate to milliseconds | | Positive, overflowing Java millisecond conversion | Reject at submission | Reject at submission | `async.batch.timeout` keeps its existing microsecond precision and is not added to submission-time validation. #### Behavioral contracts and failures - Quoted and unquoted integer YAML duration values have the same millisecond meaning. Floating-point and boolean YAML values remain invalid. - Parsing retains microsecond precision and rejects finer values. Null, empty, and malformed duration text share an actionable format hint; decimal, unknown-unit, precision, and overflow diagnostics remain specific. - Retry metrics and response fields accumulate the milliseconds used by completed retry sleeps, including across requests. Negative and sub-millisecond intervals contribute zero. - Invalid duration values raise errors; positive retry/TTL millisecond overflow and positive TTL below 1 ms fail before operator construction. Java backoff multiplication retains overflow detection with `Math.multiplyExact`. - Provider retry handling, cancellation, durable execution, and event serialization remain unchanged. The Number-to-Long normalization of retry totals is retained. ### Tests | Contract | Coverage | | --- | --- | | Integer/text equivalence and invalid representations | Java/Python duration tests, shared duration cases, YAML configuration-loader tests | | Microsecond precision and configuration round trips | Duration and configuration tests; agent-plan cross-language snapshots | | Submission validation on both entry points | `CompileUtilsTest`: Java plan and Python JSON acceptance/rejection and overflow | | Truncation before exponential backoff; sleep/statistics agreement | Java/Python Chat and Decision retry tests, including zero, negative, 500 us and 1500 us | | Cross-request millisecond accumulation | Existing Chat and Decision retry tests | | Routing and event serialization remain intact | Routing tests, Chat/Decision event tests, cross-language event snapshots | Focused Java tests: 388 passed, 26 skipped. Python tests: 390 passed, 18 skipped. Skips are snapshot-generation entry points and environment-conditioned tests. Spotless, Ruff, and `git diff --check` passed. The final two test-only simplifications were checked with Spotless/Ruff and diff checks. Not verified: full unit/e2e suites, live provider calls, or extreme exponential-backoff counts. Snapshot tests verify committed cross-language payloads, not live interpreter execution. ### API Duration option types, keys, defaults, and serialized fields are unchanged. Raw non-null configuration values now use text conversion; e.g. an integral decimal representation may parse while a fractional representation fails. The Java parser exposes only `parse(Object)`; the String overload and unused normalization helpers are removed. Execution validation becomes private to the runtime. The Java Chat invoker accepts a millisecond `long` instead of `Duration`; repository callers are updated. External consumers of the removed helper APIs need to migrate/recompile. ### 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 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]
