sangkyoonnam opened a new pull request, #1511:
URL: https://github.com/apache/flink-agents/pull/1511

   Linked issue: Part of #1437
   
   ### Purpose of change
   
   Recovery now replays a gated Python attempt without rendering its prompt 
again. Since #1497, which introduced this bug, the chat action renders the 
bound prompt before the durable call, so recovery renders it again before it 
reaches the journal. If that render fails, for example because the MCP server 
behind an `MCPPrompt` is down, a request whose attempt already succeeded now 
fails, or falls back and makes a live call to the next candidate that the first 
run never made.
   
   #### Runtime flow
   
   A gated, non-closing attempt on a Python candidate renders inside its 
durable call, sends the rendered messages, and journals them with the response. 
The gate judges the messages from that result, so on recovery both come from 
the journal.
   
   #### Key decisions
   
   The messages go into the same journal entry as the response. Rendering 
outside the call and relying on the journaled gate verdict would still render 
on recovery whenever the verdict hasn't been journaled yet.
   
   ### Behavioral Semantics
   
   #### Behavioral contracts
   
   For a gated, non-closing attempt on a Python candidate:
   
   - On recovery, a journaled attempt replays its response without rendering 
the prompt again.
   - The gate judges the messages journaled with that response, including on 
recovery before the gate's own entry was journaled.
   
   #### Failure behavior
   
   A render failure is the attempt's failure: it is journaled, reported as a 
failed model call, and retried or followed by fallback like a provider error, 
as it already is inside `chat()` on an ungated attempt. Cancellation propagates 
without recording an outcome; an async attempt stays pending.
   
   #### Interaction decisions
   
   | Run | Prompt render | Gate input |
   |---|---|---|
   | Live | once, inside the durable call | the rendered messages |
   | Recovery, gate verdict journaled | none | verdict replays |
   | Recovery, gate verdict not journaled | none | the journaled messages |
   
   Ungated attempts, Java candidates, and closing turns keep their current 
calls; a closing turn still renders before its call, as it did before #1497.
   
   ### Tests
   
   | Contract | Tests |
   |---|---|
   | Replay without rendering again | 
`test_gated_attempt_replays_without_rendering_again` (render raises or differs 
on recovery, sync and async, with and without fallback) |
   | Gate judges the journaled messages | live run: 
`test_signal_sees_the_prompt_the_candidate_received`; recovery with the gate 
verdict not journaled: no test |
   
   All 8 new cases fail on `main` and pass with the fix. `pytest 
flink_agents/api flink_agents/plan flink_agents/runtime/tests` has the same 17 
failures locally with and without the change; `ruff check` and `ruff format 
--check` 0.11.13 pass on the changed files.
   
   Not verified: a render failure on a live attempt with the fix (journaling, 
reporting, retry and fallback are covered only by reading the code), recovery 
of a closing turn whose render fails or changes, and a run against a real MCP 
prompt server.
   
   ### API
   
   No public API change. A gated attempt's journal entry now also holds the 
sent messages, so recovery from a development snapshot taken before this change 
isn't supported. #1497 hasn't been released, so no released version needs a 
migration.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Claude Code 2.1.333 (Claude Opus 5.5)
   


-- 
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]

Reply via email to