Skip to content

fix(coding-agent): preserve session-start notifications until UI attach - #1146

Open
Diyoncrz18 wants to merge 3 commits into
PrimeIntellect-ai:mainfrom
Diyoncrz18:codex/fix-1032-session-start-notification
Open

fix(coding-agent): preserve session-start notifications until UI attach#1146
Diyoncrz18 wants to merge 3 commits into
PrimeIntellect-ai:mainfrom
Diyoncrz18:codex/fix-1032-session-start-notification

Conversation

@Diyoncrz18

@Diyoncrz18 Diyoncrz18 commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • Preserve extension notifications emitted during the initial session_start bind until the first eligible extension-UI client can receive them.
  • Deliver retained startup notifications exactly once to the selected public client without changing normal live notification fanout.
  • Prevent the supervisor's internal worker subscription from consuming startup notifications before the public attach response and snapshot are usable.

Root cause

Extensions are bound before a daemon UI client is attached. A session_start handler that called ctx.ui.notify() therefore emitted an extension_ui_request into an empty recipient set. The initial fix retained notifications, but its capture window extended beyond the initial bind, ordinary last-client detach could clear the queue, and a supervisor subscription could release the queue before a public UI client was ready.

Solution

  • Capture notify requests only while the initial extension bind is running.
  • Retain up to 100 startup notifications in deterministic order, dropping the oldest entry when the limit is reached.
  • Keep the queue across temporary detach and clear it only when its lifecycle is invalidated, such as session close or runtime replacement.
  • Select the first eligible public extension-UI client as the startup replay recipient, with fallback if that client disconnects or loses eligibility.
  • Delay worker extension-UI synchronization until the public attach response is usable and any chunked snapshot has completed.
  • Preserve queued frames through snapshot streaming and backpressure, while keeping ordinary post-attach notifications on the existing multi-client broadcast path.

Only fire-and-forget notify requests participate in startup retention. Modal requests such as confirm, select, input, and editor retain their existing response and cancellation behavior. Clients without the per-session extension_ui capability neither receive nor consume retained notifications.

Compatibility

This change is backward-compatible. It only changes internal retention, ordering, and routing of the existing extension_ui_request notification. It adds no daemon command, event type, response field, or startup requirement, so DAEMON_PROTOCOL_VERSION and DAEMON_SCHEMA_REVISION remain unchanged.

Validation

  • Issue Daemon drops session_start extension notifications before first client attach #1032 regression suite: 10 tests passed.
  • Combined regression, extension-binding, and daemon-connection suites: 77 tests passed.
  • Snapshot catch-up regression suite: 9 tests passed.
  • Focused daemon-mode and supervisor/backpressure scenarios passed.
  • npm run check passed, including formatting, linting, type checking, installer rendering, and browser smoke validation.
  • git diff --check passed.

The complete supervisor monitor suite passed 44 tests on Windows; one unrelated Unix-socket test could not create its socket path because Windows returned EACCES. The affected supervisor routing and backpressure cases pass when run directly.

Issue

Fixes #1032

Note

Preserve daemon session-start extension UI notifications until a UI-capable client attaches

  • Extension UI notify events emitted during session_start were previously lost if no UI-capable client was attached yet; they are now buffered and replayed once to the first eligible client after attach and snapshot streaming complete.
  • Buffering is capped at 100 notifications per session (MAX_PENDING_EXTENSION_UI_NOTIFICATIONS) to bound memory use, and delivery is deferred past backpressure.
  • A single recipient is selected per session; detaching that client clears the recipient lock so another can be chosen. Subsequent extension rebinds do not re-open the capture window.
  • shouldSendDaemonOutboundToClient now gates notify-type extension_ui_request messages on per-session UI capability, so non-UI clients no longer receive them.
  • A regression test suite in 1032-session-start-notification.test.ts covers capture, single-recipient replay, backpressure, rebind, and bounded buffering.

Macroscope summarized 39da919.

Capture retained extension UI notifications only during the initial extension bind. Route the replay to the first eligible public client while preserving normal live notification fanout, ordering, backpressure, and cleanup behavior.

Fixes PrimeIntellect-ai#1032
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
@Diyoncrz18 Diyoncrz18 changed the title fix(coding-agent): replay startup notifications on first attach fix(coding-agent): preserve session-start notifications until UI attach Aug 10, 2026
@Diyoncrz18
Diyoncrz18 marked this pull request as ready for review August 10, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daemon drops session_start extension notifications before first client attach

1 participant