You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix duplicate terminal callbacks in SSE listeners #1170
The JSON-RPC SSE listeners use a volatile completed flag with non-atomic check-and-set behavior. onComplete(), onError(), parsing failures, and final-event cancellation can race or occur in close succession, allowing the error consumer to be invoked more than once (including a null completion signal after an error/cancellation).
The native JSON-RPC listener has the same lifecycle pattern, and the 0.3 compatibility JSON-RPC listener mirrors it. This should be addressed consistently, rather than patched only in the compatibility adapter.
Expected behavior
For one streaming request, deliver exactly one terminal callback to the error/completion consumer: either one non-null failure or one null normal-completion signal. A final task/status event that cancels the stream must not allow a later terminal callback to duplicate or contradict that outcome.
Suggested direction
Define the terminal-state contract for the native JSON-RPC and 0.3 JSON-RPC SSE listeners, then guard every terminal path with one shared atomic transition (for example, AtomicBoolean.compareAndSet(false, true)). Cover concurrent or repeated completion/error notifications and cancellation after a final event. Evaluate REST separately: its native and 0.3 implementations currently both use a no-op completion callback, so changing that is an API decision rather than a compat-only fix.
Activity
fix(client): deliver exactly one terminal SSE callback (a2aproject#1170)
fix(client): signal completion for final SSE events
test(client): cover final SSE cancellation callback
fix(client): deliver exactly one terminal SSE callback (a2aproject#1170…