Skip to content

fix(conduct): close relay lifecycle cleanup gaps - #1693

Open
4444J99 wants to merge 1 commit into
mainfrom
codex/relay-lifecycle-closeout-20260730
Open

fix(conduct): close relay lifecycle cleanup gaps#1693
4444J99 wants to merge 1 commit into
mainfrom
codex/relay-lifecycle-closeout-20260730

Conversation

@4444J99

@4444J99 4444J99 commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #1669 closing the five remaining relay lifecycle review findings in one bounded correction batch:

  • launch provider wrappers in verified POSIX process groups and revoke the whole group on every non-ready post-launch exit;
  • use an explicit finite cleanup budget for descendant termination, activation rollback, drain completion, and terminal receipt persistence after the startup deadline expires;
  • roll back exact published activation state to dormant before terminalizing an interrupted controller, while preserving evidence on marker or registration mismatch;
  • pass the single absolute discovery deadline through store opening and keep selector/setup failure inside terminalizing cleanup;
  • prevent dead, terminated providers from being recovered as ready after ambiguous publication.

The patch is limited to the relay protocol and its focused effector tests. It does not touch host configuration, credentials, provider sessions, custody state, or public receipt paths.

Verification

  • Focused relay-effector shards passed for real provider descendants, selector setup failure, post-spawn timeout, output ceiling, ambiguous readiness recovery, linked-worktree rollback, dead-controller reconciliation, and cleanup-deadline terminalization.
  • Targeted mypy: Success: no issues found in 1 source file.
  • Scoped resolver cheap wave: 7/7 passed concurrently (syntax-changed, diff-hygiene, direct-main writer contract, parameter hygiene, test hygiene, Ruff lint, Ruff format).
  • Local heavy pytest-cli / pytest-api admission was attempted once and denied before execution because the pressure sensor was unavailable (pressure-sensor-unavailable). Per the bounded verification contract it was not retried; remote CI is authoritative for the exact published head.

Delivery

Normal review and merge queue only; no admin bypass, direct-main write, force push, or repeated base rewrite.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@4444J99, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dcf83380-a64f-4edb-9c0c-f08d947d8f8c

📥 Commits

Reviewing files that changed from the base of the PR and between 1bda0f8 and bba9c6a.

📒 Files selected for processing (2)
  • cli/src/limen/conduct/campaign_relay_protocol.py
  • cli/tests/test_campaign_relay_effector.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

Copy link
Copy Markdown

Multi-agent review roll call
@codex review

(CodeRabbit and Claude review automatically. Reviewers: post substantive findings only. Authors/agents: address every thread, push fixes to this branch, reply and resolve, then re-request review.)

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@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: bba9c6a53f

ℹ️ 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 on lines 1125 to 1127
and not ready_published
and terminal_code != "relay_ready_publication_uncertain"
):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Roll back activation before killing an uncertain provider

When _publish_ready_receipt raises relay_ready_publication_uncertain, this condition deliberately skips _rollback_relay_activation, but finish_nonready then terminates the provider process group. The call therefore returns with the activation marker present and the broker session still registered with accepting_work=True, even though its provider is dead; unless another caller explicitly retries launch_reserved_relay, the broker can continue assigning work to that dead session. Roll back the activation in the same cleanup path when termination is guaranteed, while preserving the publication uncertainty separately. This hard cancellation after provider start also conflicts with the repository's cooperative-stop contract.

AGENTS.md reference: AGENTS.md:L80-L82

Useful? React with 👍 / 👎.

Comment on lines +1129 to +1134
_rollback_relay_activation(
root,
current,
registration=registration,
deadline_monotonic=cleanup_deadline,
activation_lock_held=activation_registration_guard_held,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reserve time for the terminal receipt during rollback

When activation rollback encounters slow worktree Git probes, lock acquisition, or broker registration, passing the full cleanup_deadline lets _rollback_relay_activation consume the five seconds supposedly reserved for terminal receipt persistence. finish_nonready then receives an already-expired cleanup_action_deadline, and _terminalize_relay may also have no time left, so the provider and broker state can be mutated without a durable terminal relay receipt. Bound rollback by cleanup_action_deadline and preserve the remaining budget for terminalization.

AGENTS.md reference: AGENTS.md:L375-L378

Useful? React with 👍 / 👎.

Comment on lines 1011 to 1014
_finish_drains(
(stdout_thread, stderr_thread),
deadline=deadline,
deadline=cleanup_action_deadline,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep readiness drains within the startup deadline

If the proof descriptors reach EOF but a malformed wrapper or descendant keeps stdout or stderr open, _finish_drains now waits until cleanup_action_deadline, which is 55 seconds after the configured startup deadline. Only after that wait does line 1018 assign relay_startup_timeout, so even timeout_seconds=1 can block for roughly 56 seconds. The relay contract defines output-drain proof as part of the single absolute startup deadline (docs/architecture/campaign-successor-relay.md:38-40,49-50); use deadline for readiness proof, then use the cleanup budget only after the attempt has been declared non-ready and terminated.

Useful? React with 👍 / 👎.

@4444J99
4444J99 added this pull request to the merge queue Jul 31, 2026
@4444J99
4444J99 removed this pull request from the merge queue due to a manual request Jul 31, 2026
@4444J99 4444J99 added the lifecycle:blocked Delivery intent exists but an explicit external or technical gate blocks it label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle:blocked Delivery intent exists but an explicit external or technical gate blocks it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant