feat: state graph, recursive tool handling for streaming logic#455
feat: state graph, recursive tool handling for streaming logic#455onuratakan merged 5 commits intomasterfrom
Conversation
DoganK01
commented
Oct 23, 2025
- Runnable state graph
- Recursive tool handling for streaming logic in Agent class
PR Review: State Graph & Recursive Tool HandlingThis PR introduces a substantial new feature - a LangGraph-style stateful graph system (~3,300 additions) along with improvements to streaming tool call handling. ✅ Strengths1. Excellent Architecture & Design
2. Robust Feature Set
3. Streaming Logic Improvements (steps.py:963-1093)
|
Pull Request Review: StateGraph and Recursive Tool HandlingThis is a significant PR introducing a new Direct class for simplified LLM interactions and a comprehensive StateGraph system. Overall high-quality work with good architecture, but several critical issues need attention. Summary
Strengths
CRITICAL Issues1. Missing Test CoverageNO tests added for Direct class, StateGraph, or recursive streaming. Cannot verify correctness or prevent regressions. 2. Breaking Change Without MigrationRemoved Direct = Agent alias without deprecation warnings. Users will break. 3. File Read Security Issue (src/upsonic/direct.py:170-182)
4. Recursion Limit Missing (steps.py:966-1089)_stream_with_tool_calls recursively calls itself without depth tracking. Risk of infinite loops. High Priority Issues
Minor Issues
Security Concerns
Performance NotesGood: Async-first design, parallel execution, lazy imports Missing Documentation
Recommendations Before MergeMUST HAVE:
SHOULD HAVE: Final VerdictExcellent architecture and impressive features, but BLOCKING ISSUES:
Recommendation: Request changes to address critical issues, then ready to merge. The StateGraph implementation is particularly impressive and shows deep understanding of workflow patterns. The recursive tool handling properly fixes streaming issues. Great work overall - looking forward to seeing this land after addressing the concerns above! |
Pull Request Review: State Graph, Durable Execution & OCR EngineI've completed a comprehensive review of PR #455. This is a substantial feature addition with ~8,700 lines of new code across 3 major feature areas. OverviewScope: 3 major features + infrastructure improvements
Files Changed: 44 files (42 additions, 2 modifications) Strengths1. Well-Structured Architecture
2. Comprehensive Documentation
3. Durable Execution DesignThe durable execution system is particularly well-designed:
4. StateGraph Implementation
Critical Issues1. Missing Test Coverage (HIGH PRIORITY)This is the most significant concern:
Recommendation: Add minimum test coverage for all new features before merge. 2. Type Safety Issue (CRITICAL BUG)src/upsonic/agent/pipeline/manager.py:166 for step_index, step in enumerate[Step](self.steps):
3. Security ConcernsFile Path Handling (src/upsonic/direct.py:170-183) with open(attachment_path, "rb") as attachment_file:
attachment_data = attachment_file.read()
Recommendation: Add path validation and size limits (e.g., max 100MB) 4. Error Handling Gapssrc/upsonic/durable/serializer.py:36-42 src/upsonic/agent/pipeline/manager.py:268-295 Performance Considerations1. Checkpoint Frequency
2. OCR Memory Usage
3. StateGraph State Copying
Code Quality Issues1. Code DuplicationExtensive sync/async method duplication throughout. Consider using decorators to reduce boilerplate. 2. Magic NumbersHardcoded default model "openai/gpt-4o" in Direct class should be a configurable constant. 3. Inconsistent Naming
Checklist Before Merge
Priority RecommendationsMust Fix Before Merge:
Should Fix Before Merge:
Nice to Have:
Final ThoughtsThis is ambitious, high-quality work that adds significant value to Upsonic. The architecture is well-designed and the code is generally clean. However, the lack of tests is a critical blocker for a production-ready AI framework. Estimated Risk: HIGH without tests, MEDIUM with basic tests Recommendation:
Great work overall! Looking forward to seeing this land with proper test coverage. Reviewed by Claude Code following Upsonic CLAUDE.md guidelines |
Comprehensive PR Review: State Graph & Recursive Tool HandlingExecutive SummaryThis PR introduces three major features to Upsonic with 15,169 additions across 45 files:
Code Quality AssessmentStrengths1. StateGraph Implementation (src/upsonic/graphv2/state_graph.py)
2. Durable Execution System (src/upsonic/durable/)
3. Recursive Tool Handling (src/upsonic/agent/agent.py & steps.py)
4. Direct Class (src/upsonic/direct.py)
Issues & ConcernsCritical Issues1. Missing Test Coverage
2. Error Handling in Checkpoint Saving (manager.py:265-293)
3. Recursion Limit Handling (state_graph.py:576-579)
Major Issues4. Type Annotation Bug (manager.py:166)
5. Async/Sync Confusion (execution.py:146-161)
6. Memory Leak Potential (state_graph.py:1158-1161)
7. Security: Deserialization Risks
Performance ConsiderationsPositive:
Concerns:
Security AssessmentGood:
Concerns:
Test Coverage GapCurrent: 41 test files exist, but 0 tests for new features (11k+ LOC) Required minimum:
Estimated missing: 50+ test cases RecommendationsBefore Merging (BLOCKERS)
High Priority
Nice to Have
ConclusionThis is an ambitious and well-architected PR with high code quality and thoughtful design. However, the complete absence of tests for 15k+ lines is a critical blocker. Recommendation:
Estimated work remaining: 2-3 days for tests + fixes Great work! StateGraph design is excellent. Once tests are added, this will be a major feature. 🚀 |
There was a problem hiding this comment.
- Loading info message during OCR model loading section (For example, easyocr)
- Direct info message when language support is not available
- Why aren't things like Pillow and pdf2image included in OCR
- Info message for: pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH
Pull Request Review: State Graph & Durable ExecutionOverviewThis is a significant PR introducing two major features:
Changes: 48 files changed, 15,553 additions, 4,177 deletions ✅ StrengthsArchitecture & Design
Code Quality
|
| Category | Status | Count |
|---|---|---|
| Critical Issues | 🔴 | 1 |
| High Priority | 🟡 | 8 |
| Medium Priority | 📊 | 2 |
| Total Concerns | 11 |
Verdict: ⏸️ NEEDS WORK
This PR introduces valuable features but should not be merged without:
- Comprehensive test coverage (blocking) 🔴
- Fix type safety issue in enumerate (blocking) 🔴
- Address streaming recursion limits (high priority) 🟡
- Improve error handling in recovery (high priority) 🟡
- Clarify OCR integration scope (medium priority) 🟡
Recommended Action Plan
- Phase 1: Add core tests (graph, durable execution, recovery)
- Phase 2: Fix identified bugs and type issues
- Phase 3: Address performance and security concerns
- Phase 4: Improve documentation and examples
- Phase 5: Consider splitting OCR into separate PR
Great work on this ambitious feature! The architecture is solid, but the implementation needs polish before production use. Happy to discuss any of these points further.
🤖 Generated with Claude Code
feat: state graph, recursive tool handling for streaming logic