Skip to content

fix(server): surface background elicitations over API#3678

Merged
Sayt-0 merged 2 commits into
mainfrom
fix/3584-server-background-elicitations
Jul 16, 2026
Merged

fix(server): surface background elicitations over API#3678
Sayt-0 merged 2 commits into
mainfrom
fix/3584-server-background-elicitations

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Complete the server/API portion of #3584 so elicitation requests raised by concurrent background jobs are replayable and answerable instead of being auto-declined when no per-request stream is active.

This supersedes #3625 with the same core session-scoped sink plus the lifecycle and concurrency hardening found during review.

Issue expectations

Expectation Implementation
Display concurrent background elicitations API-created runtimes append each request to a session-scoped /events log
Route responses to the correct job elicitation_id is preserved through POST /api/sessions/:id/elicitation
Avoid silent drops Event logs are created on demand and retain multiple requests in order
Avoid duplicate requests Mirrored RunStream copies are skipped when the reliable sink already delivered the event
Handle session lifecycle safely Single and batch deletion close lazy logs, clear server-owned sinks, and tombstone deleted IDs
Cover concurrency under the race detector Regression tests exercise concurrent delivery, deletion, source registration, replay, and response routing

Implementation

  • Register a per-session OnElicitationRequest sink for API/server-created runtimes.
  • Create replayable event logs lazily for out-of-band events.
  • Reuse existing attached logs rather than replacing buffered events or listeners.
  • Serialize creation, source registration, and deletion to prevent stale callbacks from resurrecting leaked logs.
  • Preserve exactly-once delivery when local runtimes mirror elicitation events onto RunStream.
  • Document API event-log coverage and correlated responses.

Validation

  • go test ./...
  • go test -race ./pkg/server ./pkg/runtime/...
  • go build ./...
  • go vet ./pkg/server/... ./pkg/runtime/...
  • golangci-lint run ./pkg/server/... ./pkg/runtime/...
  • markdownlint-cli2 docs/features/api-server/index.md

All checks pass. The full test suite was run with workspace proxy variables unset because the injected proxy intercepts the private-address SSRF tests.

Closes #3584

@Sayt-0
Sayt-0 requested a review from a team as a code owner July 16, 2026 10:06
@aheritier
aheritier marked this pull request as draft July 16, 2026 10:35
@aheritier aheritier added area/api For features/issues/fixes related to the usage of the cagent API area/docs Documentation changes area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) kind/fix PR fixes a bug (maps to fix:). Use on PRs only. status/needs-rebase PR has merge conflicts or is out of date with main labels Jul 16, 2026
@aheritier

Copy link
Copy Markdown
Contributor

👋 This PR has merge conflicts with the base branch. Please rebase or merge the latest base branch and resolve them. I've moved it to draft and added status/needs-rebase; it'll be picked back up automatically once the conflicts are cleared.

…round-elicitations

# Conflicts:
#	docs/features/api-server/index.md
#	pkg/server/session_manager.go
#	pkg/server/session_manager_test.go
@Sayt-0
Sayt-0 marked this pull request as ready for review July 16, 2026 10:50
@Sayt-0
Sayt-0 merged commit e103477 into main Jul 16, 2026
18 checks passed
@Sayt-0
Sayt-0 deleted the fix/3584-server-background-elicitations branch July 16, 2026 10:52
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 area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) kind/fix PR fixes a bug (maps to fix:). Use on PRs only. status/needs-rebase PR has merge conflicts or is out of date with main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concurrent background-job elicitations are silently dropped — nothing displayed to the user

3 participants