Skip to content

fix: recover renamed GitHub dispatch lifecycles#153

Merged
kjgbot merged 3 commits into
mainfrom
fix/canonical-github-durable-recovery
Jul 20, 2026
Merged

fix: recover renamed GitHub dispatch lifecycles#153
kjgbot merged 3 commits into
mainfrom
fix/canonical-github-durable-recovery

Conversation

@kjgbot

@kjgbot kjgbot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fall back from obsolete title-derived GitHub issue paths to stable public Relayfile by-id aliases
  • collapse expired duplicate queued lifecycle aliases at startup without touching independently active work
  • prevent renamed issues from hot-looping and consuming durable batch capacity

Verification

  • npm run build
  • npm test (1,072 passed)
  • npm run verify:e2e (9/9 packed-consumer checks; SHA 7d3264500d64901bf8fe4e6b7f07679b95af520a)
  • focused renamed-path and duplicate-alias regression tests

@kjgbot
kjgbot marked this pull request as ready for review July 20, 2026 23:45
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 49 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: 930428a4-3145-41f0-8bb6-f1138d721394

📥 Commits

Reviewing files that changed from the base of the PR and between 7d32645 and b0f8d1a.

📒 Files selected for processing (5)
  • src/orchestrator/factory.ts
  • src/ports/state.ts
  • src/state/file-state-store.test.ts
  • src/state/file-state-store.ts
  • src/state/in-memory-state-store.ts
📝 Walkthrough

Walkthrough

GitHub lifecycle recovery now reads stable by-id aliases alongside stale paths. Factory startup deduplicates queued aliases for the same issue, preserves active conflicts, clears losers, and reloads durable state. Integration tests cover renamed-issue recovery and startup collapse behavior.

Changes

GitHub lifecycle alias recovery

Layer / File(s) Summary
Stable GitHub alias read candidates
src/orchestrator/factory.ts, src/orchestrator/factory.test.ts
Issue-derived reads now include supported by-id paths alongside existing aliases; recovery tests verify stale-path dispatch resolves through the stable issue identity.
Queued lifecycle alias deduplication
src/orchestrator/factory.ts, src/orchestrator/factory.test.ts
Startup adoption groups aliases by issue identity, selects a queued winner, clears loser state, reloads storage, and verifies the stable lifecycle remains.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: khaliqgant, miyaontherelay

Poem

I’m a rabbit with aliases tucked tight,
Finding the stable path by moonlight.
Stale trails merge, queued hops align,
One true lifecycle keeps the line.
The factory rests when all is right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: recovering renamed GitHub dispatch lifecycles.
Description check ✅ Passed The description matches the changeset and accurately summarizes the recovery and deduplication work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/canonical-github-durable-recovery

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.

@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 deduplication of queued GitHub lifecycle aliases during startup to handle renamed issues and prevent hot-loops on obsolete title paths. The feedback suggests optimizing the deduplication process by filtering the lifecycles array in memory to avoid redundant state store I/O overhead, and safeguarding the sorting comparator against potential NaN values from missing updatedAtMs properties.

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
Comment thread src/orchestrator/factory.ts

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/orchestrator/factory.ts`:
- Around line 2749-2803: Prevent `#deduplicateQueuedGithubLifecycleAliases` from
unconditionally deleting a queued alias based on stale snapshot state. Add or
use a StateStore operation that conditionally clears the lifecycle only when its
expected owner, epoch, and queued phase still match, and invoke it for each
loser; treat a failed condition as a concurrent promotion and leave the
lifecycle intact. Preserve the existing deduplication metrics and timer cleanup
only after a successful fenced clear.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 816033c6-cc5e-426b-b5c1-a5ed58460343

📥 Commits

Reviewing files that changed from the base of the PR and between a099034 and 7d32645.

📒 Files selected for processing (2)
  • src/orchestrator/factory.test.ts
  • src/orchestrator/factory.ts

Comment thread src/orchestrator/factory.ts
@kjgbot
kjgbot merged commit fc499ec into main Jul 20, 2026
2 of 3 checks passed
@kjgbot
kjgbot deleted the fix/canonical-github-durable-recovery branch July 20, 2026 23: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