Port CI events to YAML flows (ci_run trigger + pr-ci.yml + pr-opened.yml rewrite) #1092
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#1092
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As an operator, I want CI completion events to drive flow-engine dispatch (fix-ci on red, reviewer request on green), so that PRs don't sit forever without a reviewer (currently PR #1090 is silently blocked because
ci_runevents are dropped by the YAML adapter).Context
apps/server/src/domain/flows-yaml/webhook-adapter.ts:183explicitly dropsci_runevents with comment "CI events live outside the YAML trigger surface in v1 (the legacy NF-1 union still ownscheck_suite.completed)". But the legacy handlerhandleCheckSuiteCompleted(apps/server/src/domain/workflow/event-handlers.ts:1000) is dead code — no non-test caller. Net effect: nofix-cidispatch on red CI, no reviewer request on green CI. Only path remaining is the janitorstale_fix_ci_redispatchsafety net (6 h cadence).Also:
flows/defaults/pr-opened.ymlshort-circuits any PR withoutarea:agentslabel (PR #1090 hadarea:dashboard), and dispatches reviewer immediately without waiting for CI. Both behaviours need rewiring.Acceptance criteria
Trigger surface
CiRunTriggertoapps/server/src/domain/flows-yaml/trigger-events.ts(kindci_run, fields:state(success|failure),sha,context,runId,workflowId,branches)"ci_run"toFORGE_TRIGGER_KINDSapps/server/src/domain/flows-yaml/webhook-adapter.ts:183convertsci_runForgeEventtoCiRunTrigger(currently returnsnull)apps/server/src/domain/flows-yaml/schema.tsparseson: { ci_run: [success, failure] }syntaxNew ops (thin wrappers around existing implementations in
post-ci.ts+event-handlers.ts)repo_has_workflowsop — wrapsForgePort.repoHasWorkflowsarm_review_fallbackop — wrapsarmReviewFallbackcancel_review_fallbackop — wrapscancelReviewFallbackfind_open_pr_for_headop — wrapsfindOpenPRForHead; outputs{found, pr_number, title, author, head_ref}fetch_aggregate_ci_stateop — wrapsfetchAggregateState; outputs{state}dispatch_fix_ciop — wrapsdispatchFixCidecide_post_ciop — wrapsdecidePostCiAction(composite — keeps approve/merge/bounce decision tree atomic)Flows
flows/defaults/pr-opened.yml— droparea:agentsgate, arm CI fallback when workflows present, otherwise calldecide_post_cidirectlyflows/defaults/pr-ci.ymlonci_run: [success, failure]: cancel fallback timer → find PR for head SHA → dispatch fix-ci (red) ordecide_post_ciafter aggregate-confirm (green)Tests
apps/server/src/domain/flows-yaml/ops/*.test.ts)ci_runevent conversion (webhook-adapter.test.ts)pr-ci.yml(success + failure paths)pr-opened.ymltests to drop thearea:agentsgate assertionCleanup
handlePullRequestOpenedfromevent-handlers.ts(dead after rewrite)handleCheckSuiteCompletedfromevent-handlers.ts(dead afterpr-ci.ymllands)Out of scope
/hold,/ready, etc.) — separate ticketcleanupBranch+ dep drop +pr.mergedpublication) — separate ticketlegacy*executor hooks inmain.ts— separate ticketstale_fix_ci_redispatchrule — remains as 6 h safety net; verify dedup map shared with new webhook pathReferences
apps/server/src/domain/workflow/post-ci.ts(decision tree + fallback timer impl)apps/server/src/domain/workflow/event-handlers.ts:1000(orphanedhandleCheckSuiteCompleted)stale_fix_ci_redispatch(background/janitor.ts:774) — the only currently-active fix-ci path