Skip to content

fix(mcp): support browser subscriptions and server notifications - #1949

Merged
BlueHotDog merged 13 commits into
integration/mcp-2026-07-28from
fix/mcp-subscriptions
Oct 26, 2026
Merged

BlueHotDog merged 13 commits into
integration/mcp-2026-07-28from
fix/mcp-subscriptions

Conversation

@BlueHotDog

@BlueHotDog BlueHotDog commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Implement the browser MCP subscription lifecycle and separate server notifications from response envelopes in Phoenix.

Browser MCP server

  • Validate subscriptions/listen with the shared protocol schema and acknowledge it with the original typed request ID.
  • Accept an empty notification filter because this server advertises no optional change-event categories.
  • Keep subscriptions active until cancellation, attachment teardown, or transport loss. Numeric and string IDs remain distinct.
  • Reject reuse of active subscription or tool-call IDs. Each attachment permits at most 128 active subscriptions.
  • Remove client-cancelled subscriptions without a response. Send cancellation and completion before intentional session teardown leaves the channel.
  • Retain IDs for asynchronous and suspended tool calls. Suppress late tool responses after teardown or transport loss.
  • Clear subscriptions on channel error/close without replay. Remove attachment-owned listeners on detach.
  • Log malformed cancellation with a safe diagnostic. A sentinel-value regression checks that private values do not enter the log.

Phoenix MCP client boundary

Distinguish notification envelopes from responses. Log valid unopened notifications without a reply. Retain explicit diagnostics for malformed messages.

Phoenix opens no subscriptions and exposes no subscription-opening API. This PR adds no automatic listeners, resource/prompt support, catalog refresh, or tool-execution cancellation.

Review comments

Both findings are fixed in 20a12d51 and checked again after consolidation at 0f35ba1b:

  • Session cleanup retains the MCP handler and calls detach before channel leave. The existing session matrix checks close/disconnect/parse-error ordering, silent tasks-channel/socket loss, idempotency, listener removal, and timer cleanup. Failed joins retain a separate regression.
  • The request guard reserves asynchronous and suspended tool-call IDs as well as subscription IDs. Regressions cover collisions, terminal release, typed IDs, and stale completions.

Both review threads contain replies and are resolved.

Change size and test reuse

The complete PR is now 243 net-new lines, down from 731. The consolidation and coverage follow-up remove 488 lines from the previous PR head.

  • Reuse the real MCP server fixture instead of duplicate discovery/catalog builders and per-test channels.
  • Extend the existing filter, typed-ID, and session-lifetime tests instead of parallel matrices.
  • Extend existing channel validation with malformed notifications. Remove the separate notification test file.
  • Reuse JSON-RPC parsing, subscription metadata schemas, and the notification send path.
  • Cancel fire-and-forget Phoenix push bookkeeping. The reused timer regression exposed this gap.

Mutation validation temporarily reintroduced both review bugs: the ID regression and close/disconnect cases failed. Restoring the fixes returned the suite to green. Additional mutations to connection-loss suppression and parse-error cleanup failed their restored matrix cases.

Validation

Local checks on 0f35ba1b:

  • MIX_TEST_DB_SUFFIX=_delta_pr1949 make -C apps/frontman_server precommit: 1,077 tests passed, plus compilation, formatting, and strict Credo.
  • make -C libs/frontman-client check: 112 tests passed, plus compilation and formatting.
  • make -C libs/client test: 500 tests passed.
  • make build RESCRIPT_FLAGS='--warn-error +a': passed.
  • make reanalyze: zero issues. The pre-push hook also passed for all nine checked libraries.
  • make check-source-comments and git diff --check: passed.

GitHub CI runs again after the push. Local validation did not include a live browser/network subscription E2E test.

Stack

The destination remains integration/mcp-2026-07-28, not main.

Predecessors #1940, #1939, and #1948 are already integrated. This branch includes the integration tip 48d815a3 through merge commit b02c45ef. Conflict resolution preserves the integrated authentication, interim-result validation, shared subscription schemas, and regression tests.

Neither the integration branch nor main was updated by this branch refresh. This PR remains open.

Specification

Related Issue

No separate issue was supplied.

Checklist

  • Added/updated tests
  • Included changeset coverage
  • Tested locally with make dev (not run)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T19:50:42.320741Z 0f35ba1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 250a1179d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BlueHotDog
BlueHotDog added this pull request to stack #1955 October 23, 2026 20:37
Base automatically changed from fix/mcp-input-required to integration/mcp-2026-07-28 October 25, 2026 15:58
Preserve the integrated handshake-origin and interim-result fixes while retaining subscription lifecycle, session teardown, and pending tool request ID protection. Reuse the shared subscription schema and typed acknowledgment.
@BlueHotDog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: b02c45efad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Fold notification cases into existing channel validation tests, extend the existing session lifetime matrix, and share the browser MCP server fixture. Remove duplicate filter and teardown scenarios while retaining ID, privacy, bounded-stream, and stale-response checks.

Reuse JSON-RPC parsing and subscription metadata schemas. Cancel fire-and-forget Phoenix push bookkeeping so the shared timer cleanup regression also covers MCP frames.
@BlueHotDog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: e529d008ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Extend the existing session lifetime matrix with active-subscription parse failure, tasks-channel error, and socket loss. Reuse exact terminal-frame assertions and require silent MCP teardown on connection failure.
@BlueHotDog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 0f35ba1ba5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BlueHotDog
BlueHotDog merged commit 562eb08 into integration/mcp-2026-07-28 Oct 26, 2026
41 of 42 checks passed
@BlueHotDog
BlueHotDog deleted the fix/mcp-subscriptions branch October 26, 2026 11:02
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.

1 participant