feat(workflows): add dynamic until loops#36
Conversation
📝 WalkthroughWalkthroughThis PR adds workflow ChangesUntil condition feature
Executable resolution
Release version update
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CreateRunCommand
participant WorkflowRunner
participant ExecuteSteps
participant EvaluateUntil
participant RunJson
CreateRunCommand->>WorkflowRunner: onUntilStart / onUntilResult callbacks
WorkflowRunner->>ExecuteSteps: executeSteps(workflow.until)
loop each iteration
ExecuteSteps->>ExecuteSteps: run leaf and group steps
ExecuteSteps->>EvaluateUntil: evaluate until condition
EvaluateUntil-->>ExecuteSteps: satisfied or continue
end
ExecuteSteps->>RunJson: persist satisfiedAt
WorkflowRunner-->>CreateRunCommand: printSummary
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
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/providers/workflow-discovery.ts`:
- Around line 376-379: The `!typeKey` guard in `getUntil` is unreachable because
`typeKeys` has already been validated to contain exactly one entry earlier in
the same flow. Remove the dead `if (!typeKey)` branch and keep the existing
`typeKeys[0]` selection and return path, using the `workflow-discovery` logic
around `typeKeys` and `typeKey` as the place to update.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: eb2b31bc-ec78-4035-87a9-303daf431dc8
📒 Files selected for processing (13)
defaults/system/workflows/review-and-fix.yamlsrc/commands/run.tssrc/domain/workflow.tssrc/providers/workflow-discovery.tssrc/services/workflow-runner.tstest/e2e/claudecode.shtest/e2e/codex.shtest/e2e/lib/workflow-until.shtest/e2e/opencode.shtest/e2e/pi.shtest/unit/commands/run.test.tstest/unit/providers/workflow-discovery.test.tstest/unit/services/workflow-runner.test.ts
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 `@CHANGELOG.md`:
- Line 14: Tighten the wording in the changelog sentence by replacing the phrase
“by accident” with a more concise alternative such as “unintentionally” or
“accidentally” in the note about `until: { prompt: ... }`, keeping the rest of
the explanation intact.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 95ba64f9-f953-41cf-8e4d-f408eac26d30
📒 Files selected for processing (12)
CHANGELOG.mdREADME.mddefaults/config.jsonpackage.jsonsrc/providers/agent-runner.tssrc/providers/workflow-discovery.tssrc/services/provider-detection.tstest/unit/domain/version.test.tstest/unit/hooks/format-reminder.test.tstest/unit/services/init-service.test.tstest/unit/services/setup-session.test.tstest/unit/services/workflow-runner.test.ts
a800189 to
17d5307
Compare
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/providers/agent-runner.ts`:
- Around line 11-19: The PATH lookup logic is duplicated between agent execution
and provider detection, so extract it into a shared helper and reuse it in both
places. Move the existing whichOnCurrentPath behavior from provider-detection.ts
into a common utility such as resolveOnCurrentPath or a shared which module,
then have agent-runner.ts use that helper instead of calling Bun.which inline so
both code paths stay in sync.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f84c6349-e909-46fa-aa20-ecb1ece9815e
📒 Files selected for processing (9)
src/providers/agent-runner.tssrc/providers/workflow-discovery.tssrc/services/provider-detection.tstest/unit/hooks/format-reminder.test.tstest/unit/platform/process-runner.test.tstest/unit/services/autoresearch.test.tstest/unit/services/setup-session.test.tstest/unit/services/uninstall-service.test.tstest/unit/services/workflow-runner.test.ts
17d5307 to
fc92625
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/unit/services/workflow-runner.test.ts (1)
593-614: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winSkip POSIX-only
untiltests on Windows.Three
untilintegration tests use POSIX shell commands (test -f,test "..." = "...",printf) but are not wrapped intest.skipIf(process.platform === "win32"), unlike the adjacent tests at lines 511, 694, 725, 756, and 1031. On Windows (cmd.exe), these commands don't exist, causing theuntilcondition to fail with a non-zero exit code — the workflow never satisfies, and assertions onsatisfiedAt/ callback events will fail.🔧 Proposed fix: wrap POSIX-only tests with skipIf
- test("until condition resolves current iteration step templates", async () => { + test.skipIf(process.platform === "win32")( + "until condition resolves current iteration step templates", + async () => { // ... test body unchanged ... - }); + }, + );- test("workflow loop 1 with until evaluates once and records satisfaction", async () => { + test.skipIf(process.platform === "win32")( + "workflow loop 1 with until evaluates once and records satisfaction", + async () => { // ... test body unchanged ... - }); + }, + );- test("until progress callbacks report start and result", async () => { + test.skipIf(process.platform === "win32")( + "until progress callbacks report start and result", + async () => { // ... test body unchanged ... - }); + }, + );Also applies to: 641-663, 665-692
🤖 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 `@test/unit/services/workflow-runner.test.ts` around lines 593 - 614, The POSIX-only `until` test in `workflow-runner.test.ts` uses shell commands that fail on Windows, so wrap this `until` case in `test.skipIf(process.platform === "win32")` like the adjacent platform-gated tests. Apply the same guard to the other affected `until` tests in the file that use `run` commands such as `test -f`, `test "..." = "..."`, and `printf`, so `runWorkflow` assertions like `metadata.satisfiedAt` only run where the commands are supported.
🤖 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.
Outside diff comments:
In `@test/unit/services/workflow-runner.test.ts`:
- Around line 593-614: The POSIX-only `until` test in `workflow-runner.test.ts`
uses shell commands that fail on Windows, so wrap this `until` case in
`test.skipIf(process.platform === "win32")` like the adjacent platform-gated
tests. Apply the same guard to the other affected `until` tests in the file that
use `run` commands such as `test -f`, `test "..." = "..."`, and `printf`, so
`runWorkflow` assertions like `metadata.satisfiedAt` only run where the commands
are supported.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 10fbfffc-e37d-4a7d-8361-955608822b27
📒 Files selected for processing (11)
src/platform/paths.tssrc/providers/agent-runner.tssrc/providers/workflow-discovery.tssrc/services/provider-detection.tstest/unit/hooks/format-reminder.test.tstest/unit/platform/paths.test.tstest/unit/platform/process-runner.test.tstest/unit/services/autoresearch.test.tstest/unit/services/setup-session.test.tstest/unit/services/uninstall-service.test.tstest/unit/services/workflow-runner.test.ts
Summary by CodeRabbit
runsuccess or prompt verdict satisfaction.