-
Notifications
You must be signed in to change notification settings - Fork 145
Improve composite tool configuration ergonomics #2589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2589 +/- ##
==========================================
- Coverage 54.95% 54.92% -0.04%
==========================================
Files 305 305
Lines 28732 28748 +16
==========================================
- Hits 15791 15790 -1
- Misses 11532 11555 +23
+ Partials 1409 1403 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Makes composite tool workflow configuration more user-friendly by
reducing verbosity and following "convention over configuration":
1. **Step type inference**: When 'tool' field is present, 'type' is
automatically inferred as "tool". Elicitation steps still require
explicit type for clarity.
2. **Optional timeout**: Timeout can be omitted and defaults to 30
minutes at runtime. Validator now allows 0 (use default) instead
of requiring explicit positive value.
Before:
```yaml
composite_tools:
- name: "fetch_data"
timeout: "30m" # Required even for default
steps:
- id: "fetch"
type: "tool" # Redundant when 'tool' field present
tool: "fetch_fetch"
```
After:
```yaml
composite_tools:
- name: "fetch_data"
# timeout omitted - uses 30m default
steps:
- id: "fetch"
tool: "fetch_fetch" # Type inferred as "tool"
```
Changes:
- Infer type="tool" when tool field is present
- Allow timeout=0 in validator (engine applies default)
- Handle empty timeout string in YAML loader
- Add comprehensive tests for both features
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
9b77895 to
ef6c5cd
Compare
yrobla
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some comments
|
@claude i agree with Yolanda that the validator is not a good place for this. Deep dive into the codebase and recommend a better place to add this default. Don't do code changes, just recommend. |
|
Claude finished @JAORMX's task —— View job Architecture Analysis Complete
Analysis SummaryI've analyzed the codebase architecture and data flow. Here's what I found: Current Implementation:
Data Flow:
Key Finding: timeout := def.Timeout
if timeout == 0 {
timeout = defaultWorkflowTimeout // 30 minutes
}Recommendation: Move Defaults to YAMLLoaderPrimary Recommendation: Move both type inference and timeout defaults to Why this is the best location:
Implementation Details: For Type Inference (currently in validator): func (*YAMLLoader) transformWorkflowStep(raw *rawWorkflowStep) (*WorkflowStepConfig, error) {
step := &WorkflowStepConfig{
ID: raw.ID,
Type: raw.Type,
// ... other fields
}
// Apply type inference: if type is empty and tool field is present, infer as "tool"
if step.Type == "" && raw.Tool != "" {
step.Type = "tool"
}
// ... rest of transformation
}Then update func (*DefaultValidator) validateStepType(step *WorkflowStepConfig, index int) error {
// Type is required at this point (should have been inferred during loading)
if step.Type == "" {
return fmt.Errorf("step[%d].type is required", index)
}
// ... rest of validation
}For Timeout Defaults (already partially in loader): Alternative Considered: K8s Webhook DefaultingFor Kubernetes deployments, you could use a mutating admission webhook to apply defaults. However:
Benefits of This Approach
References
|
|
@claude Follow the approach and do a commitnfor this. Ensure the tests and the linter pass |
|
Claude finished @JAORMX's task —— View job Refactoring Complete ✅Successfully moved defaults from validator to YAMLLoader following the architectural recommendation. Tasks Completed:
Changes Summary1. Type Inference Moved to Loader
2. Validator Now Read-Only
3. Test Coverage
Architectural Benefits
Commit: e05c741 |
This refactoring addresses the architectural concern that validators should be read-only and not mutate configuration values. The changes follow the 'convention over configuration' principle while maintaining clean separation of concerns. Changes: - Move step type inference from validator to yaml_loader transformWorkflowStep() - Update validator to be read-only (no longer mutates step.Type) - Add validation to prevent ambiguous configurations (both tool and message fields) - Add test case for the ambiguous scenario - Update existing tests to reflect loader-based type inference Benefits: - Clear separation: Loader applies defaults, Validator validates invariants - Follows existing patterns (elicitation timeout defaults in loader) - Platform consistency (CLI and K8s produce same Config before validation) - Validator becomes pure validation logic (no side effects) Co-authored-by: Juan Antonio Osorio <JAORMX@users.noreply.github.com>
Summary
Improves user experience for composite tool workflow configuration by reducing verbosity and following "convention over configuration" principles.
Changes
1. Step Type Inference
Tool steps no longer require explicit
type: "tool"when thetoolfield is present.Before:
After:
Elicitation steps still require explicit
type: "elicitation"for clarity.2. Optional Timeout
Workflow timeout can be omitted and defaults to 30 minutes at runtime.
Before:
After:
Implementation
type="tool"whentoolfield is presentBenefits
🤖 Generated with Claude Code