feat: add base branch change notification and blocked-by dependency deferral (CYPACK-978)#1004
Open
cyrusagent wants to merge 2 commits intomainfrom
Open
feat: add base branch change notification and blocked-by dependency deferral (CYPACK-978)#1004cyrusagent wants to merge 2 commits intomainfrom
cyrusagent wants to merge 2 commits intomainfrom
Conversation
…eferral (CYPACK-978) Add two session lifecycle features: 1. Base branch push notification: GitHub push webhooks on tracked base branches stream rebase notifications to active sessions via addStreamMessage. 2. Blocked-by dependency deferral: Issues with unresolved blocked-by relations are parked instead of starting a runner. Parked sessions wake automatically when blocking issues complete, or on user re-prompt if blockers clear.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assignee: Connor Turland
Summary
Adds two related session lifecycle features for smarter issue handling:
Base branch change notification — When a tracked base branch receives new commits via GitHub push webhooks, active sessions on that branch are notified to rebase via
addStreamMessage, helping avoid merge conflicts.Blocked-by dependency deferral — When Cyrus is assigned an issue with unresolved
blocked_byrelationships, it skips worktree/runner creation and parks the session. Parked sessions wake automatically when all blocking issues complete (or are canceled), or when a user re-prompt clears the blockers.Implementation
Use Case 1: Base branch push notification
pushevent type toGitHubEventTransportwith newGitHubPushPayload/GitHubPushCommittypesGitHubCommentWebhookEventnarrowing type to keep comment-specific utility functions type-safegetSessionsByBaseBranch(branchName, repositoryId)query toAgentSessionManagerhandleGitHubPushWebhooktoEdgeWorker— extracts branch fromrefs/heads/*, finds matching repo config, looks up active sessions, builds XML notification with commit summary, streams to running sessionUse Case 2: Blocked-by dependency deferral
isIssueStateChangeWebhooktype guard tocyrus-corefor detectingstateIdchanges inupdatedFromparkedSessionsMap toEdgeWorker(keyed by issue ID, stores all data needed to replayinitializeAgentRunner)handleAgentSessionCreatedWebhook— callscheckBlockedByDependenciesbefore starting workhandleIssueStateChangehandler — when blocking issues complete, removes them from parked sessions and wakes fully-unblocked sessionshandleParkedSessionReprompt(Branch 1.5 in prompted handler) — re-checks blockers on user re-promptpostThoughtActivitytoActivityPosterfor posting acknowledgmentsFiles Changed
packages/github-event-transport/src/types.ts— Push event types, comment-narrowing typespackages/github-event-transport/src/index.ts— New exportspackages/github-event-transport/src/GitHubEventTransport.ts— Push event processingpackages/github-event-transport/src/GitHubMessageTranslator.ts— Type narrowing for event typepackages/github-event-transport/src/github-webhook-utils.ts— Narrowed toGitHubCommentWebhookEventpackages/core/src/issue-tracker/types.ts—isIssueStateChangeWebhooktype guardpackages/core/src/index.ts— New exportpackages/edge-worker/src/EdgeWorker.ts— All handler logic (push, blocked-by, parked sessions, wake-up)packages/edge-worker/src/AgentSessionManager.ts—getSessionsByBaseBranchquerypackages/edge-worker/src/ActivityPoster.ts—postThoughtActivitymethodTesting
getSessionsByBaseBranch(AgentSessionManager.base-branch-sessions.test.ts)isIssueStateChangeWebhook(EdgeWorker.issue-state-change.test.ts)pnpm test:packages:run)pnpm typecheck)Linear Issue
CYPACK-978: Base branch change notification + blocked-by dependency deferral