feat: add fleet refresh verification#77
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: kaizen-agents-org/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds ChangesFleet command and sync workflow
Open PR backpressure
Shared text truncation helpers
Doctor runtime checks
Codex exec arguments
GitHub remote slug parsing
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
6af9899 to
1537d94
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6af9899d4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1537d94 to
41106df
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
93-104: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
npm run dogfood:*don't belong in the generic target-repository quickstart.This block is headed "For a target repository", but
dogfood:sync/dogfood:verifyare package scripts defined only in this repo'spackage.jsonand hardcode--owner kaizen-agents-org/--root ... A user following this in an arbitrary target repo will hit "missing script" or sync the wrong owner. These steps belong in a kaizen-loop self-dogfooding section, not the generic target-repo flow.As per path instructions: "docs that disagree with the implemented CLI behavior [are] actionable review findings."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 93 - 104, The “For a target repository” quickstart includes repo-specific dogfooding commands that only exist in this project and hardcode this repo’s owner/root, so they should be removed from the generic flow. Update the README section around the target-repository examples to keep only commands that work in an arbitrary repo, and move the `npm run dogfood:sync` / `npm run dogfood:verify` steps into a separate kaizen-loop self-dogfooding section. Use the surrounding quickstart text and the `dogfood:*` script references to locate the affected block.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli.ts`:
- Around line 111-129: The CLI action for `fleet` currently always resolves
after `syncFleet`, so failures in `syncFleetProject` and `verify` are never
reflected in the process exit code. Update the `.action` handler in `src/cli.ts`
to inspect the returned `result.projects` for any `error` entries or
`verifyPassed === false`, and set `process.exitCode = 1` before printing when
any project failed; keep the existing `print` and successful `0` behavior
unchanged for all-pass runs.
In `@src/commands/doctor.ts`:
- Around line 116-119: The tail(text, maxLength) helper in doctor.ts duplicates
the same logic used in run.ts, so extract it into a shared utility and update
both call sites to use that common helper. Locate the existing tail function in
doctor.ts and the matching helper in orchestrator/run.ts, then move the
implementation to a reusable shared module and import it from both places to
keep behavior consistent and avoid divergence.
- Around line 41-62: The builder agent smoke test is running against the
developer checkout instead of the isolated workspace. In doctor.ts, update the
`BuilderAgentAdapter.run()` call inside the `check('builder agent runtime',
...)` block to use `resolved.project.workspacePath` for `workspaceDir` so `cwd`
and `KAIZEN_BUILD_RESULT_PATH` stay confined to the sandbox. Keep the rest of
the smoke test flow unchanged, including the config loading, preferred backend
selection, and result handling.
In `@src/orchestrator/run.ts`:
- Around line 267-271: The open PR limit check in run.ts is using a capped
sample of openPullRequests, so filtering sync PRs afterward can undercount
non-sync PRs and bypass run.maxOpenPullRequests. Update runKaizen() and the
helper logic around openCount/remaining to fetch enough PRs before applying
isSyncPullRequest filtering, either by paging until all open PRs are seen or by
continuing until at least limit + 1 non-sync PRs have been collected. Keep the
skipSelectedForOpenPrLimit flow and the open pull request limit reached message,
but ensure the count is based on a complete enough set from
options.openPullRequests.
---
Outside diff comments:
In `@README.md`:
- Around line 93-104: The “For a target repository” quickstart includes
repo-specific dogfooding commands that only exist in this project and hardcode
this repo’s owner/root, so they should be removed from the generic flow. Update
the README section around the target-repository examples to keep only commands
that work in an arbitrary repo, and move the `npm run dogfood:sync` / `npm run
dogfood:verify` steps into a separate kaizen-loop self-dogfooding section. Use
the surrounding quickstart text and the `dogfood:*` script references to locate
the affected block.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: kaizen-agents-org/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0524f83d-9413-406c-913c-1cca8c24752c
📒 Files selected for processing (18)
.kaizen/config.ymlREADME.mddocs/02-cli-spec.mddocs/03-config-spec.mddocs/04-nightly-pipeline.mddocs/12-scheduler-providers.mdpackage.jsonsrc/agents/codex.tssrc/cli.tssrc/commands/doctor.tssrc/commands/fleet.tssrc/orchestrator/run.tssrc/utils/slug.tstest/codex.test.tstest/doctor.test.tstest/fleet.test.tstest/integration/dry-run.test.tstest/slug.test.ts
💤 Files with no reviewable changes (1)
- src/agents/codex.ts
PR guardian updateAddressed the latest CodeRabbit findings on the current head:
Verification after the changes:
Current state: fixes are pushed; waiting for the new CI and CodeRabbit pass on the updated head. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/fleet.ts`:
- Around line 81-82: The fleet failure check in fleetHasFailures currently
treats project.error as a truthy value, so an empty-string error is missed and
can let kaizen fleet succeed incorrectly. Update the predicate to check for the
presence of the error field rather than its truthiness, while keeping the
verifyPassed === false check intact, so FleetSyncResult projects with error: ''
are counted as failures.
In `@src/utils/text.ts`:
- Around line 6-7: The tailLines helper currently counts the empty segment
created by a trailing newline as a real line, so the retry context can lose one
actual output line. Update tailLines in text.ts to ignore terminal newline-only
segments before slicing, so it returns the last meaningful lines from command
output. Use the existing tailLines symbol as the fix point and keep the behavior
correct for both trailing-newline and non-trailing-newline input.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: kaizen-agents-org/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7ed70310-0ef7-48a8-9aba-86ced0b1507b
📒 Files selected for processing (9)
README.mdsrc/cli.tssrc/commands/doctor.tssrc/commands/fleet.tssrc/orchestrator/run.tssrc/utils/text.tstest/doctor.test.tstest/fleet.test.tstest/integration/dry-run.test.ts
PR guardian updateAddressed the latest CodeRabbit edge-case findings:
Verification:
Current state: changes are pushed; waiting for CI and CodeRabbit on the updated head. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/utils/text.ts`:
- Around line 6-9: The exported tailLines function currently treats non-positive
line counts incorrectly, since lines === 0 falls through to slice behavior that
returns the full input. Update tailLines to explicitly handle lines <= 0 by
returning an empty string before splitting or slicing, while preserving the
existing behavior for positive counts and the trailing-empty-line trimming
logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: kaizen-agents-org/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 358a60e6-76cc-4c4a-afcb-3b7dcef63301
📒 Files selected for processing (4)
src/commands/fleet.tssrc/utils/text.tstest/fleet.test.tstest/text.test.ts
PR guardian updateAddressed the latest CodeRabbit edge case:
Verification:
Current state: change is pushed; waiting for CI and CodeRabbit on the updated head. |
Dismissed stale CodeRabbit requested-changes review after follow-up commits addressed the comments and checks passed.
Summary
kaizen fleet --verifyso local runner refresh can sync each fleet workspace to the default branch and run configured setup/verify commands.dogfood:verifyfor the standard post-merge dogfood refresh path.Verification
npm test -- test/fleet.test.tsnpm run typechecknpm testnpm run buildnode dist/cli.js fleet --root .. --owner kaizen-agents-org --prune --verify --dry-run --jsonCloses #78
Refs #76
Summary by CodeRabbit
New Features
kaizen fleetto rebuild/synchronize local registry, workspaces, labels, and scheduler jobs across multiple repos, with--dry-run,--verify,--prune, and component-level disable options.run.maxOpenPullRequeststo cap automated PR selection (sync PRs are excluded from the limit).Bug Fixes
Documentation
kaizen fleetusage andrun.maxOpenPullRequestsbehavior.Tests