Skip to content

feat: add /rebase and /rebaseWithConflicts commands to cloudflare-docs-bot#32121

Open
mvvmm wants to merge 20 commits into
productionfrom
feat/flue-rebase-commands
Open

feat: add /rebase and /rebaseWithConflicts commands to cloudflare-docs-bot#32121
mvvmm wants to merge 20 commits into
productionfrom
feat/flue-rebase-commands

Conversation

@mvvmm

@mvvmm mvvmm commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds /rebase and /rebaseWithConflicts slash commands to the cloudflare-docs-bot (.flue/). Both are codeowner-only and post status updates at the top of the bot's singleton comment throughout the operation.

/rebase — Rebases the PR branch against production using the GitHub update-branch API. Stops with an explanation if:

  • The PR targets a branch other than production
  • The PR is from a fork (can't push)
  • Conflicts are detected

On a clean rebase, posts a success status and triggers a /full-review automatically (since the head SHA changed).

/rebaseWithConflicts — Same as /rebase, but on conflict it attempts AI-assisted resolution:

  • Identifies files changed on both sides since the merge base
  • Fetches both versions of each conflicting file
  • Calls Workers AI (kimi-k2.7-code) with both file contents + PR intent to produce resolved versions and a confidence score
  • High confidence: applies via Git Data API (blob → tree → commit → force-push), then triggers /full-review
  • Medium/low confidence: stops and posts an explanation of why it couldn't resolve automatically

Other changes:

  • postOrUpdateComment extracted from the two workflow files that duplicated it into lib/code-review-render.ts as a shared export — covers the create-if-absent case in one place
  • renderRebaseStatusUpdate() added to the render lib — injects/replaces the rebase status block at the top of the bot comment, preserving existing review content below
  • New FlueRebaseWorkflow Durable Object class added (wrangler.jsonc v9 migration)
  • Commands table in the bot comment updated to list the two new commands

Documentation checklist

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
* @cloudflare/product-owners
*.ts @cloudflare/content-engineering, @kodster28

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@mvvmm
mvvmm marked this pull request as ready for review July 16, 2026 21:54
@mvvmm
mvvmm requested review from a team and kodster28 as code owners July 16, 2026 21:54
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@mvvmm
mvvmm force-pushed the feat/flue-rebase-commands branch from c7fa096 to 1cffd2a Compare July 17, 2026 04:06
@mvvmm
mvvmm force-pushed the feat/flue-rebase-commands branch from 1cffd2a to 9dd8749 Compare July 17, 2026 14:33
@cloudflare cloudflare deleted a comment from ask-bonk Bot Jul 17, 2026
@cloudflare cloudflare deleted a comment from ask-bonk Bot Jul 17, 2026
@cloudflare cloudflare deleted a comment from ask-bonk Bot Jul 17, 2026
@cloudflare cloudflare deleted a comment from cloudflare-docs-bot Bot Jul 17, 2026
@cloudflare cloudflare deleted a comment from cloudflare-docs-bot Bot Jul 17, 2026
@mvvmm

mvvmm commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

/full-review

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review

✅ No issues found in commit d306617.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

No code review issues found.

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. Stops if there are conflicts and reports which files conflict.
/rebaseWithConflicts Rebases against production and attempts to resolve conflicts automatically using AI. Stops with an explanation if confidence is not high enough.

@mvvmm

mvvmm commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

/bonk please review

@ask-bonk

ask-bonk Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review triage

Finding Verdict Action
CR-792a12f1f2a0 — SHA length validation in Agree Fixed

Fix applied

The tool was allowing abbreviated SHAs ( characters) even though the GitHub endpoint requires a full 40-character SHA. Updated:

  • Regex changed to
  • Parameter description updated to
  • Comment and error message now explicitly state the full-SHA requirement

This prevents unnecessary HTTP 422 errors when the model passes a short SHA.


Overall PR assessment: LGTM. The rebase workflow is well-structured with clear guard rails (fork detection, wrong-base detection, file-size caps, production-head-race guards, completeness checks) and good failure transparency.

@ask-bonk

ask-bonk Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review triage

Finding Verdict Action
CR-792a12f1f2a0 — SHA length validation in .flue/lib/github-repo-tools.ts Agree Fixed

Fix applied

The get_commit_pr tool was allowing abbreviated SHAs (7–40 characters) even though the GitHub commits/{sha}/pulls endpoint requires a full 40-character SHA. Updated:

  • Regex changed to /^[0-9a-f]{40}$/i
  • Parameter description updated to: "The full 40-character git commit SHA to look up."
  • Comment and error message now explicitly state the full-SHA requirement

This prevents unnecessary HTTP 422 errors when the model passes a short SHA.


Overall PR assessment: LGTM. The rebase workflow is well-structured with clear guard rails (fork detection, wrong-base detection, file-size caps, production-head-race guards, completeness checks) and good failure transparency.

Co-authored-by: mvvmm <mvvmm@users.noreply.github.com>
@ask-bonk

ask-bonk Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Done.

Triage:

Finding Verdict Action
CR-792a12f1f2a0 — SHA length validation in .flue/lib/github-repo-tools.ts ✅ Agree Fixed

Fix applied to .flue/lib/github-repo-tools.ts:

  • Regex tightened from /^[0-9a-f]{7,40}$/i/^[0-9a-f]{40}$/i
  • Parameter description updated to: "The full 40-character git commit SHA to look up."
  • Comment and error message now explicitly state the full-SHA requirement

This prevents the tool from passing abbreviated SHAs to the GitHub commits/{sha}/pulls endpoint, which only accepts 40-character SHAs and would otherwise return HTTP 422.

I also left a review comment on PR #32121 with these details.

github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants