Skip to content

feat(server): session-scoped elicitation sink for API/server runtimes (#3584)#3625

Merged
Sayt-0 merged 1 commit into
mainfrom
feat/server-session-elicitation-sink
Jul 16, 2026
Merged

feat(server): session-scoped elicitation sink for API/server runtimes (#3584)#3625
Sayt-0 merged 1 commit into
mainfrom
feat/server-session-elicitation-sink

Conversation

@aheritier

Copy link
Copy Markdown
Contributor

feat(server): session-scoped elicitation sink for API/server runtimes (#3584)

Summary

Lets elicitation (user-input) requests raised by API/server-created runtimes — including background jobs — reach a connected client, instead of being misclassified as headless and silently fast-declined. Part 4 (top) of the #3584 stack.

Stacked on the TUI/app PR — review the diff against that branch.

What changed

  • Session-scoped sink: runtimeForSession registers a per-session OnElicitationRequest sink that appends elicitation events to a lazily created session event log, replayable via GET /api/sessions/:id/events.
  • Event-log lifecycle: the lazy log is closed on session delete (single + batch), so a connected /events stream receives session_exited and terminates rather than blocking forever.
  • Docs: API-server docs updated for the /events out-of-band elicitation flow on API-created sessions, and the answer-vs-raise wording on the POST endpoint.

Testing

  • Session-scoped sink wiring; delete (single + batch) closes a live /events stream; server-side background elicitations surface instead of fast-declining.
  • Full stack task dev + -race — green.

@aheritier aheritier added area/api For features/issues/fixes related to the usage of the cagent API area/docs Documentation changes kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Jul 13, 2026
@aheritier
aheritier force-pushed the feat/tui-background-elicitations branch from d2926c8 to 4b4ed27 Compare July 15, 2026 19:33
@aheritier
aheritier force-pushed the feat/server-session-elicitation-sink branch from 85124bc to 836e723 Compare July 15, 2026 19:33
@aheritier
aheritier requested a review from docker-agent July 15, 2026 19:51
@aheritier
aheritier force-pushed the feat/server-session-elicitation-sink branch from 836e723 to 3c7d997 Compare July 15, 2026 20:32
@aheritier
aheritier force-pushed the feat/tui-background-elicitations branch from af5ba07 to f445d3e Compare July 15, 2026 20:47
@aheritier
aheritier force-pushed the feat/server-session-elicitation-sink branch from 3c7d997 to a91131a Compare July 15, 2026 20:47
Base automatically changed from feat/tui-background-elicitations to main July 16, 2026 06:34
@aheritier
aheritier force-pushed the feat/server-session-elicitation-sink branch from a91131a to 53f2f40 Compare July 16, 2026 08:05
@aheritier
aheritier marked this pull request as ready for review July 16, 2026 08:07
@aheritier
aheritier requested a review from a team as a code owner July 16, 2026 08:07
@Sayt-0

Sayt-0 commented Jul 16, 2026

Copy link
Copy Markdown
Member

@aheritier some commits are not signed can you check ?

@aheritier
aheritier force-pushed the feat/server-session-elicitation-sink branch from 53f2f40 to affcf18 Compare July 16, 2026 10:04
Register a session-scoped elicitation sink on every API/server
runtime so that background elicitations are routed to a
lazily-created session event log rather than being fast-declined
by the headless path (which fires when no sink is registered).

Previously only the TUI registered an OnElicitationRequest sink,
meaning every API-created runtime had none. The headless
elicitation handler therefore declined all background elicitations
immediately, even when a remote SSE client could have answered
them via `POST .../elicitation`.

The session-scoped event log is now created on demand the first
time an out-of-band event is raised, making the session's
`GET .../events` stream replayable without requiring an attached
`--listen` runtime.

Tests pin the lazy-creation behaviour and confirm that repeated
sink invocations accumulate events rather than overwriting an
existing event log.

Documentation is updated to reflect that `GET .../events` is
also available for any API-created session that has raised at
least one out-of-band event.

Closes: #3584
@aheritier
aheritier force-pushed the feat/server-session-elicitation-sink branch from affcf18 to 6a685c8 Compare July 16, 2026 10:05
@Sayt-0
Sayt-0 merged commit 8aef68f into main Jul 16, 2026
17 checks passed
@Sayt-0
Sayt-0 deleted the feat/server-session-elicitation-sink branch July 16, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api For features/issues/fixes related to the usage of the cagent API area/docs Documentation changes kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants