feat(sdk): act on s2s reconnect advice in append and read sessions - #352
feat(sdk): act on s2s reconnect advice in append and read sessions#352infiniteregrets wants to merge 6 commits into
Conversation
Greptile SummaryThis PR adds S2S reconnect-advice parsing and planned handover behavior for append and read sessions, including connection-pool rotation and pacing for repeated advice.
Confidence Score: 4/5The append handover race should be fixed before merging because a clean advised shutdown can bypass reconnection and later consume the normal failure budget. Both append-session channels become closed together, and the ACK-reader select can return through a branch that never invokes the newly required reconnect-advice handler. Files Needing Attention: s2/append_session.go Important Files Changed
Sequence DiagramsequenceDiagram
participant Server
participant Transport as transportAppendSession
participant Reader as AppendSession.readAcks
participant Pump as AppendSession pump
Server-->>Transport: ACK with reconnect-advised flag
Transport-->>Reader: advised ACK
Reader->>Transport: halfClose request body
Server-->>Transport: clean response end
Transport-->>Reader: close errorsCh and acksCh
alt errorsCh selected
Reader->>Pump: handleReconnectAdvice
Pump->>Pump: rotate transport and reconnect
else acksCh selected
Reader-->>Reader: return without handover
Note over Reader,Pump: closed transport remains current
end
|
A frontend that is shutting down sets the reconnect-advised flag on regular s2s frames while it is still healthy enough to serve. Sessions currently ignore it and ride the pod until it goes away.
This makes append and read sessions leave on their own terms:
If the response ends cleanly with appends still unacknowledged, that is a truncated response rather than a handover, so it goes through the normal error path and the retry policy decides.