Skip to content

[flue] In-process review fan-out, native skill bundling, and R2 reduction#31516

Merged
mvvmm merged 2 commits into
productionfrom
flue-storage-native-skills
Jun 17, 2026
Merged

[flue] In-process review fan-out, native skill bundling, and R2 reduction#31516
mvvmm merged 2 commits into
productionfrom
flue-storage-native-skills

Conversation

@mvvmm

@mvvmm mvvmm commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Infrastructure changes to the Flue-powered docs review bot (.flue/) — no user-facing documentation content is changed. Modernizes the bot to current Flue (0.11) patterns in two related parts.

1. Replace child-workflow fan-out with in-process sessions. The style-guide review previously fanned out into N child workflows, each admitted over HTTP and polled via Durable Streams. Each child was a separate Durable Object, so a single DO eviction mid-poll could terminalize a child and fail the whole review. The per-file review now runs as concurrent sessions inside the orchestrator's own Durable Object: one harness over a shared workspace, one session per file via a concurrency pool, with a single file's failure degrading to an empty result instead of aborting the review. The standalone style-guide-review workflow and its DO class are retired (v4 deleted_classes migration).

2. Native skill bundling, Workspace-resident diff, and R2 reduction. Adopt Flue's native skill mechanism instead of fetching skill/reference content from R2 at runtime:

  • Import all four skills (style-guide-review, reconcile-code-review, spam-and-off-topic-filter, dependabot-review) with { type: "skill" } and register them on their agents; drop the runtime R2 SKILL.md fetches and workspace writes.
  • Move the style-guide reference rules into the skill directory so they ship as packaged skill resources; SKILL.md reads them via the native read tool at the advertised packaged paths (patch parsing stays on the code tool).
  • Stage the per-run diff directly in the shared Workspace (writeDiffToWorkspace replaces writeDiffToR2); delete the R2 hydration and the comments.json round-trip (comments already reach reconcile via in-memory args).
  • Remove the obsolete content-sync tooling (bin/sync-agents.ts, bin/sync-skills.ts) and drop the sync step from flue:deploy.

R2 is retained only for cross-run per-PR state (review-{sha}.json snapshots and the auto-review counter); deploy no longer pushes any content to R2.

Validated with tsc --noEmit, flue build --target cloudflare (reference rules confirmed bundled into the worker), and prettier. The one behavior-affecting change is the style-guide skill's reference loading (code tool → native read tool); always references are confirmed working in local runs, with conditional/component references the remaining check.

@mvvmm mvvmm requested review from a team and kodster28 as code owners June 17, 2026 04:49
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review

⏸️ Automatic reviews for this PR are paused.

This PR has already received 2 automatic reviews. To run another review, a codeowner can comment /review or /full-review.

Tip: Keep PRs in draft mode until they are ready for review — the bot skips draft PRs automatically.


✅ No style-guide issues found in commit da6d547.

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.

@github-actions

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
package.json @cloudflare/content-engineering

@mvvmm mvvmm marked this pull request as draft June 17, 2026 04:51
@ask-bonk

ask-bonk Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

UnknownError: The operation timed out.

github run

@ask-bonk

ask-bonk Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@mvvmm Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

@mvvmm

mvvmm commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

/bonk reaview

@mvvmm mvvmm marked this pull request as ready for review June 17, 2026 04:59
@ask-bonk

ask-bonk Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review of PR #31516

Status: Approve — Clean infrastructure refactor with no blockers.


Architecture

In-process fan-out (.flue/lib/style-guide-inproc.ts) is the right move. Retiring the standalone style-guide-review workflow and its Durable Object eliminates the terminal-failure mode where a single child DO eviction would abort the entire review. Running concurrent sessions inside the orchestrator's own DO, over a shared workspace, is simpler and more resilient.

The graceful-degradation behavior is well done: a single file's failure (catch + empty result) does not abort the pool, and the file is deliberately excluded from reviewedFiles so the reconciler doesn't falsely resolve prior findings.

Native skill bundling correctly adopts Flue 0.11 patterns. Importing skills with with { type: "skill" } and registering them on the agent removes the brittle runtime R2 fetch + workspace hydration dance. Dropping bin/sync-agents.ts and bin/sync-skills.ts and removing the sync step from flue:deploy is good cleanup.

Correctness & safety

  • writeDiffToWorkspace correctly stages the diff in the shared DO workspace instead of R2. The run-scoped diffDir (diffs/pr-{n}/runs/{runId}) ensures concurrent reviews for the same PR don't collide.
  • withConcurrency (style-guide-inproc.ts:76) is a straightforward bounded-async-pool implementation. Correct.
  • mergeStyleGuideResults deduplicates findings by ID across files, which handles the edge case where the same rule violation appears in multiple files.
  • R2 retention is scoped appropriately: only cross-run durable state (review-{sha}.json, auto-review counter) remains in R2. No content or skill data is pushed at deploy time.
  • Wrangler migration v4 with deleted_classes: ["FlueStyleGuideReviewWorkflow"] is correct. No code references the retired class.

Notable details

  • The separate named harness ("style-guide") prevents collision with the orchestrator's default harness used for reconciliation. Good.
  • Compaction reserve of 64_000 tokens on the style-guide agent is appropriate given the reference rules are now read directly into context via the native read tool.
  • Type-check (tsc --noEmit -p .flue/tsconfig.json) passes cleanly. Prettier passes on all changed files.

Non-blocking nits

  • The style-guide skill SKILL.md still instructs the model to "Skip files with additions === 0" (line 40), but selectStyleGuideFiles already filters those out before fan-out. Redundant but harmless.
  • console.error is used in style-guide-inproc.ts for per-file failures. Since this is a library function without access to FlueContext.log, this is reasonable, though passing a structured logger from the orchestrator would be more consistent with the Flue AGENTS.md guidance.

Bottom line: This is a solid modernization that reduces complexity, eliminates a failure mode, and moves to native Flue 0.11 patterns. Ship it.

github run

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

mvvmm added 2 commits June 17, 2026 10:18
…sions

Collapse the per-file style-guide review from N child workflows (admitted
over HTTP + Durable Streams long-poll) into concurrent sessions within the
code-review orchestrator's own Durable Object. One harness over a single
shared workspace, hydrated once, with one session per file fired via a
concurrency pool; a single file's failure degrades to an empty result
instead of aborting the whole review.

This removes the separate child-workflow DOs that were the unit getting
evicted mid-poll (the interruption that failed PR #31514), and deletes the
admit/poll plumbing (lib/poll-run.ts retained for the spam-filter gate).

- Add lib/style-guide-inproc.ts (hydrate-once + per-file session fan-out)
- Rewrite orchestrator fan-out to call runStyleGuideReviewInProcess
- Delete lib/style-guide-fanout.ts (only the orchestrator used it)
- Retire the style-guide-review workflow + its DO class (v4 deleted_classes migration)
…shrink R2 to per-PR state

Adopt Flue's native skill mechanism instead of fetching skill/reference
content from R2 at runtime, and stage the per-run PR diff directly in the
shared Workspace now that review runs in-process.

- Import all four skills (style-guide-review, reconcile-code-review,
  spam-and-off-topic-filter, dependabot-review) with { type: "skill" } and
  register them on their agents; drop the runtime R2 SKILL.md fetches and
  workspace writes.
- Move the style-guide reference rules into the skill directory so they ship
  as packaged skill resources; rewrite SKILL.md to read them via the read
  tool at the advertised packaged paths (patch parsing stays on the code
  tool). Manifest file paths updated to skill-root-relative.
- Replace writeDiffToR2 with writeDiffToWorkspace: the orchestrator writes
  manifest/pr/patches straight into the shared Workspace; delete the R2
  hydration (lib/style-guide-hydration.ts) and the comments.json round-trip
  (comments already reach reconcile via in-memory args).
- Remove the obsolete content-sync tooling (bin/sync-agents.ts,
  bin/sync-skills.ts) and drop the sync step from flue:deploy.

R2 is retained only for cross-run per-PR state (review-{sha}.json snapshots
and the auto-review counter); no content is pushed to R2 on deploy anymore.
@mvvmm mvvmm force-pushed the flue-storage-native-skills branch from da6d547 to bc3de13 Compare June 17, 2026 15:19
@mvvmm mvvmm marked this pull request as draft June 17, 2026 15:19
@mvvmm mvvmm marked this pull request as ready for review June 17, 2026 15:29
@mvvmm mvvmm merged commit 454a3ab into production Jun 17, 2026
12 checks passed
@mvvmm mvvmm deleted the flue-storage-native-skills branch June 17, 2026 15:49
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