Skip to content

feat(examples,sdk): PR-close-loop flow — subscribe to CI+Bugbot, fix until green (#354) - #355

Merged
kjgbot merged 2 commits into
mainfrom
feat/spec-AA-pr-close-loop
Sep 11, 2026
Merged

kjgbot merged 2 commits into
mainfrom
feat/spec-AA-pr-close-loop

Conversation

@kjgbot

@kjgbot kjgbot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #354. Delivered via implement-slice.flow.ts (dogfood, claude).


Note

Medium Risk
The flow performs force-push, squash merge, and agent-driven edits on a declared worktree; CLI completion semantics change for authored needs_human, though scoped to the new executor path.

Overview
Adds a dogfood close-pr flow that drives a slice PR to merge: validate worktree/branch, open or reuse a PR, poll gh for checks plus Bugbot comments and review-thread resolution, run up to three agent repair cycles (commit + force-with-lease push), then squash-merge with --match-head-commit or finish with f.done('needs_human') and journaled blockers.

Extends the surface authoring contract with FlowCompletionReason (needs_human alongside kernel run reasons). The authored executor and flows run direct path treat that as an authored handoff: terminal journal step with JSON outcome, exit 3 and parked status (not a new kernel completion reason).

Ships close-pr-state helpers (fail-closed parsing, poll-interval cap for step leases), README and local verification notes, plus broad Vitest coverage (mocked GitHub/agent loop and one real git remote exercise).

Reviewed by Cursor Bugbot for commit d93d89d. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a99ecc24-0b7d-4576-8138-ef7dc32c35f4


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.

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

Stale Bugbot comment from a previous run.

Comment thread packages/sdk/scripts/dogfood/close-pr.flow.ts
Comment thread packages/sdk/scripts/dogfood/close-pr.flow.ts
miyaontherelay and others added 2 commits September 12, 2026 01:19
…until green (#354)

Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
…354)

Bugbot MED on #355: `sleep ${input.pollIntervalSeconds ?? 15}` sits inside
an f.run step. A caller who passes `pollIntervalSeconds: 60` gets a sleep
longer than the kernel deterministic-step lease (~30 s), which fails the
step and takes the whole close-pr flow down instead of polling.

parseInput now clamps to MAX_POLL_INTERVAL_SECONDS = 25 silently. Existing
positive-integer floor is preserved. Added a regression test in
tests/close-pr-flow.test.ts covering cap, pass-through under cap, and
that zero / negative still throw.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
@kjgbot
kjgbot force-pushed the feat/spec-AA-pr-close-loop branch from 9f0e0d5 to d93d89d Compare September 11, 2026 23:24

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d93d89d. Configure here.

+ `--jq ${quote('[.[][] | select(.user.login == "cursor[bot]" or .user.login == "bugbot[bot]" or .user.login == "cursor" or .user.login == "bugbot") | {id,body,path,html_url,user:{login:.user.login}}]')}`);
const threads = await run(`gh api graphql --paginate --slurp -f query=${quote(threadsQuery)} `
+ `-f owner=${quote(owner!)} -f name=${quote(name!)} -F number=${pr} `
+ `--jq ${quote('[.[].data.repository.pullRequest.reviewThreads.nodes[] | {isResolved,isOutdated,commentId:.comments.nodes[0].databaseId}]')}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incompatible gh slurp and jq flags

High Severity

Comment and thread snapshots pass --paginate --slurp --jq to gh api together. GitHub CLI rejects that combination, so those f.run steps fail immediately and the close loop never reads Bugbot findings or thread resolution.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d93d89d. Configure here.

@kjgbot
kjgbot merged commit e3a9b70 into main Sep 11, 2026
8 of 10 checks passed
@kjgbot
kjgbot deleted the feat/spec-AA-pr-close-loop branch September 11, 2026 23:48
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.

flows: AA — PR-close-loop flow (subscribe to CI + Bugbot until fully green, else park)

2 participants