Skip to content

Fix durable broker isolation and merged PR recovery#162

Merged
kjgbot merged 1 commit into
mainfrom
fix/respect-relay-state-dir
Jul 21, 2026
Merged

Fix durable broker isolation and merged PR recovery#162
kjgbot merged 1 commit into
mainfrom
fix/respect-relay-state-dir

Conversation

@kjgbot

@kjgbot kjgbot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Factory could reuse an ancestor Relay broker even when AGENT_RELAY_STATE_DIR requested isolation. It also discarded a merged babysitter session on restart without completing the durable lifecycle, leaving capacity permanently occupied.

This change:

  • makes AGENT_RELAY_STATE_DIR authoritative for broker connection lookup;
  • starts the public Harness Driver broker persistently in that explicit state directory;
  • completes an exact, issue-matching merged babysitter PR during startup recovery;
  • preserves the unrelated-PR fail-closed guard.

Verification:

  • TypeScript build passes.
  • Full suite: 129/129 suites, 1088/1088 tests.
  • Exact packed-package E2E: 9/9 checks at head 754015a.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kjgbot, 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 16d02b0a-1431-4582-81c1-4c88f4ad9734

📥 Commits

Reviewing files that changed from the base of the PR and between ae31018 and 754015a.

📒 Files selected for processing (6)
  • src/cli/fleet.test.ts
  • src/cli/fleet.ts
  • src/fleet/ensure-relay-broker.test.ts
  • src/fleet/ensure-relay-broker.ts
  • src/orchestrator/factory.test.ts
  • src/orchestrator/factory.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/respect-relay-state-dir

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.

@kjgbot
kjgbot marked this pull request as ready for review July 21, 2026 04:55

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces support for an explicit relay state directory via the AGENT_RELAY_STATE_DIR environment variable, ensuring that the broker connection path and auto-started broker persistence use this directory. It also adds logic to the orchestrator's FactoryLoop to gracefully complete a restored babysitter session if its corresponding pull request was merged while the Factory was down. Regarding the feedback, a potential runtime issue was identified in src/orchestrator/factory.ts where 'record' could be undefined and is passed directly to #advanceMergedPrToDone without a safety check.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/orchestrator/factory.ts
@kjgbot
kjgbot merged commit b5faf80 into main Jul 21, 2026
2 of 3 checks passed
@kjgbot
kjgbot deleted the fix/respect-relay-state-dir branch July 21, 2026 04: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.

1 participant