@@ -102,17 +102,27 @@ struct ET_EXPERIMENTAL TextEvent {
102102 std::string text;
103103};
104104
105+ // Final serving result, fixed after engine settlement and text/history
106+ // finalization. A terminal-sink exception or transport delivery failure does
107+ // not revise this result or roll back resident session state.
105108struct ET_EXPERIMENTAL TerminalEvent {
106109 FinishReason finish_reason = FinishReason::Stop;
107110 GenerationStats stats;
108111 // Present exactly when finish_reason is Failed.
109112 std::optional<ServingError> error;
110113};
111114
112- // Each admitted request emits zero or more text events, then one terminal event
113- // after final text flushing and session finalization. Synchronous rejection
114- // emits no events. If the sink throws, it is not called again, even for the
115- // terminal.
115+ // Each admitted request emits zero or more ordered text events, then one
116+ // terminal event. Synchronous rejection emits no events. A throwing sink is
117+ // disabled and is not called again, even for the terminal.
118+ //
119+ // A request retains runtime admission until its terminal notification is
120+ // selected for delivery. Before invoking the terminal sink, the runtime has
121+ // released that admission and the request's session execution claim. Other
122+ // limits, competing requests, or shutdown can still reject new work.
123+ //
124+ // Sinks must do short, nonblocking work. Terminal notification does not mean
125+ // the callback has returned or that a transport delivered the result.
116126using GenerationEvent ET_EXPERIMENTAL = std::variant<TextEvent, TerminalEvent>;
117127
118128struct ET_EXPERIMENTAL ServingInfo {
0 commit comments