feat(workflow): cap agent calls per run - #121
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
Greptile SummaryThis PR introduces a shared, concurrency-safe cap of 256 agent calls per workflow run.
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The shared runtime counter is checked and incremented synchronously, nested workflows reuse that runtime, overflow is rejected before provider execution, and the new typed error is accepted throughout the workflow contract and persistence paths.
|
| Filename | Overview |
|---|---|
| src/workflow-api.ts | Enforces the shared agent-call limit with synchronous allocation before cache, semaphore, and provider paths. |
| src/workflow-contracts.ts | Adds the new call-limit error kind to the validated public workflow error contract. |
| src/workflow-errors.ts | Extends WorkflowEngineError typing so call-limit failures survive existing normalization and persistence paths. |
| src/workflow-engine.test.ts | Verifies concurrent allocation at the boundary permits the final call and rejects overflow without provider execution. |
| src/workflow-types.ts | Defines the fixed maximum of 256 agent calls per workflow runtime. |
| src/workflow-types.test.ts | Locks the new workflow limit constant to its intended value. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Agent call requested] --> B{Shared call index below 256?}
B -- No --> C[Throw call_limit]
B -- Yes --> D[Allocate and increment index]
D --> E[Check replay decision]
E -- Cache hit --> F[Return cached response]
E -- Execute --> G[Acquire shared semaphore]
G --> H[Run provider]
H --> I[Release semaphore]
Reviews (1): Last reviewed commit: "test(workflow): cover agent call budget ..." | Re-trigger Greptile
Summary
call_limitworkflow errorValidation
Summary by CodeRabbit
New Features
Bug Fixes
Tests