Skip to content

[SYMPP-5702] Rotate backend ownership without restarting followers - #624

Merged
Pimpmuckl merged 9 commits into
integration/mcp-first-caller-lifecyclefrom
feature/sympp-on-demand-02-rotating-owner
Aug 18, 2026
Merged

[SYMPP-5702] Rotate backend ownership without restarting followers#624
Pimpmuckl merged 9 commits into
integration/mcp-first-caller-lifecyclefrom
feature/sympp-on-demand-02-rotating-owner

Conversation

@Pimpmuckl

@Pimpmuckl Pimpmuckl commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Context

PowerShell fallback followers lost their MCP session when the native owner Job and backend exited,
even though follower STDIO stayed open.

TL;DR

Keep follower STDIO alive while one fallback bridge elects and binds a replacement backend.

Summary

  • Re-elect one managed backend after native owner-and-backend loss without restarting followers.
  • Rotate leases and reinitialize sessions before retrying only requests proven unsent.
  • Return an indeterminate result for ambiguous mutations instead of replaying them.
  • Preserve pipelined STDIO order while observing EOF and draining the final detach to zero.
  • Treat only transport loss as recoverable; keep live HTTP errors on the current backend.
  • Run the Windows launcher matrix and descendants at BelowNormal priority.

Alternatives

  • Owner PID monitoring is excluded because the native non-breakaway Job ends owner and backend together.
  • Generic live-but-unhealthy migration is excluded; recovery starts only after transport loss.
  • Requests that may have reached the old backend are not replayed across the replacement epoch.

Test Plan

  • make -C elixir all
  • make -C elixir ci-full is not required; GitHub CI is the remote full gate.
  • Canonical launcher suite under pwsh ran once at BelowNormal; the unrelated unmanaged
    200-client burst had one missing initialize result, so the heavyweight local run was not repeated.
  • Focused fallback initialize retry passed under PowerShell 5.1 and 7.
  • Focused ambiguous mutation recovery and Node response-policy assertions passed.
  • PowerShell parser checks, Node syntax checks, and git diff --check passed.
  • Review Suite deep correctness and conformance closure: rvw_2b37f7e3.

Pimpmuckl and others added 5 commits August 17, 2026 21:04
Summary:
- re-enter the existing cold election when a managed backend disappears
- rebind surviving STDIO adapters to the replacement backend epoch
- return an indeterminate error instead of replaying ambiguous tool calls
- extend the canonical launcher lifecycle matrix with recovery coverage

Rationale:
- long-lived adapters previously froze one backend URL and HTTP session
- shared cold locks and bridge leases already own singleton startup and exit
- conservative replay keeps mutating tool outcomes safe after transport loss

Tests:
- pwsh -NoProfile -ExecutionPolicy Bypass -File
  plugins/symphony-plus-plus-mcp/tests/launcher/run-launcher-tests.ps1
- make -C elixir all

Co-authored-by: Codex <codex@openai.com>
Summary:
- Reject truncated backend responses as requests that may have reached the
  old backend.
- Detach and fail closed when replacement cleanup-source validation fails.
- Extend the canonical recovery matrix for both lifecycle failures.

Rationale:
- Ambiguous mutating calls must return one indeterminate result instead of
  hanging or replaying.
- A rejected replacement must retain a trusted path to zero-process cleanup.

Tests:
- focused six-mode rotating-owner recovery matrix
- state-identity-tests.js
- bridge-response-forwarding-tests.js
- node-bridge-burst.js (200 clients)

Co-authored-by: Codex <codex@openai.com>
Summary:
- re-enter the existing cold-start election from surviving fallback bridges
- rebind sessions and leases while keeping follower STDIO processes alive
- cover concurrent and delayed followers on PowerShell 5.1

Rationale:
- the Node bridge already recovered after owner and backend loss, but the
  shipped PowerShell fallback stayed bound to the dead epoch
- only provably unsent requests retry; ambiguous tool calls fail indeterminate

Tests:
- focused launcher state, response, burst, leader-death, and recovery matrix
- pwsh -File plugins/symphony-plus-plus-mcp/tests/launcher/run-launcher-tests.ps1
- make -C elixir all

Co-authored-by: Codex <codex@openai.com>
Cancel a blocked PowerShell fallback preparation when STDIO closes and clean up an unleased replacement if post-start validation fails. Extend the canonical owner/backend-loss case through final-close cancellation and zero-resource cleanup.

Co-authored-by: Codex <codex@openai.com>
Track ordered PowerShell STDIO read-ahead while a fallback election runs so EOF behind a buffered request still cancels final shutdown. Cover the pipelined close in the canonical fallback recovery case.

Co-authored-by: Codex <codex@openai.com>
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a78fade-ab6e-40c3-bfa4-29b8ebd6f2f3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@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: 4862881edc

ℹ️ 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".

Pimpmuckl and others added 4 commits August 18, 2026 01:02
Summary:
- Reuse a provably unsent caller initialize after fallback recovery.
- Add deterministic fallback coverage and lower launcher-test priority.

Rationale:
- The caller initialize can safely establish the replacement session when
  the preflight proves that its POST never reached the failed backend.
- BelowNormal test priority prevents the launcher matrix from monopolizing
  the Windows workstation while preserving live runtime priority.

Tests:
- Focused fallback initialize retry under PowerShell 5.1 and PowerShell 7.
- Focused fallback owner recovery and ambiguous mutation coverage.
- make -C elixir all (1694/1696 passed; unrelated dashboard migration
  assertion remains red and one timeout cleared on focused rerun).

Co-authored-by: Codex <codex@openai.com>
Summary:
- Count the new initialize-retry recovery case in the launcher matrix.
- Leave its mode-specific result shape to the dedicated assertion.

Rationale:
- The canonical wrapper otherwise rejects a successful eight-case smoke run
  before it can evaluate the initialize-retry contract.

Tests:
- PowerShell parser and focused aggregate-predicate check.

Co-authored-by: Codex <codex@openai.com>
Summary:
- Exclude the initialize-only fallback case from the tools-list aggregate.

Rationale:
- That focused mode proves retransmission and lifecycle cleanup without
  issuing tools/list, so its dedicated assertion owns the contract.

Tests:
- PowerShell parser and focused tools-list aggregate check.

Co-authored-by: Codex <codex@openai.com>
Summary:
- Trigger Node recovery only after transport loss, not live HTTP errors.
- Replay recovered requests only when the failed send is provably unsent.
- Add focused predicate assertions to the response-forwarding suite.

Rationale:
- Live application errors must remain responses from the current backend.
- Ambiguous delivery cannot be retried safely across a replacement epoch.

Tests:
- Node bridge response forwarding and recovery-policy assertions.
- Focused PowerShell initialize retry and Node ambiguous-tool recovery.

Co-authored-by: Codex <codex@openai.com>
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f28c26145a

ℹ️ 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".

@Pimpmuckl
Pimpmuckl merged commit 89f33d4 into integration/mcp-first-caller-lifecycle Aug 18, 2026
19 checks passed
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