Skip to content

Own review cancellation, recovery, and shutdown lifecycles - #117

Open
lynnswap wants to merge 38 commits into
mainfrom
codex/review-cancellation-barrier-pr
Open

Own review cancellation, recovery, and shutdown lifecycles#117
lynnswap wants to merge 38 commits into
mainfrom
codex/review-cancellation-barrier-pr

Conversation

@lynnswap

@lynnswap lynnswap commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Purpose

Make cancellation, recovery, and application/MCP shutdown authoritative and joined. Completion is published only after the canonical review terminal and every owned operation, session, channel, and task has drained.

Advances #106. It remains open until Wave 4 adds durable terminal commit-before-cleanup.

Changes

  • Replace split Store attempt state with one owner that records start admission, preserves first-caller cancellation attribution, awaits canonical or typed terminals, and propagates cleanup failures.
  • Own prepared runtime generations, join admitted AppServer lifecycle operations, and replace a force-closed shared backend before resuming eligible same-account reviews.
  • Add replayable CodexReviewStore.close() async throws and serialize Store, Host, MCP, and ReviewMonitor termination.
  • Register accepted MCP channels and handler, domain, stream, and writer tasks before execution; close admission and drain them before SwiftNIO event-loop shutdown.
  • Add deterministic regression gates for cancellation ownership, pre-dispatch cancellation, shared recovery, application close, and MCP shutdown.

Closes #118.
Closes #119.
Closes #120.

Testing

  • swift test --build-system swiftbuild --no-parallel
  • MCP suite under SWIFTNIO_STRICT=1, including five repeated warning scans
  • scripts/check-compatibility.sh
  • ReviewMonitor xcodebuild test
  • Independent exact-head owner and API audits

Screenshots

Not applicable; this PR changes lifecycle and protocol behavior.

@lynnswap

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: d90be36316

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

Comment thread Sources/CodexReviewAppServer/AppServerCodexReviewBackend.swift
Comment thread Sources/CodexReviewAppServer/AppServerCodexReviewBackend.swift
Comment thread Sources/CodexReview/Store/CodexReviewStoreReviews.swift
@lynnswap

Copy link
Copy Markdown
Owner Author

Wave 3B checkpoint pushed at c76ff88. This adds the Store-owned prepared runtime generation, stable MCP lifecycle owner, restart listener preservation, NIO pre-task admission registry, admitted AppServer operation/router/session drain, and the deterministic #118 test fix.

Focused gates are green (AppServer 130, Host 47, MCP HTTP 25, attempt processor 39; compatibility and ReviewMonitor 15/15 were green at the runtime checkpoint).

This Ready PR is intentionally not merge-ready yet: the remaining shared-force-close sibling replacement and additive replayable CodexReviewStore.close() stages are still being implemented on this same branch. Existing review threads will be replied to/resolved only after those owners are published and re-reviewed.

@lynnswap lynnswap changed the title Await canonical review cancellation terminals Own review cancellation, recovery, and shutdown lifecycles Aug 21, 2026
@lynnswap

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant