-
Notifications
You must be signed in to change notification settings - Fork 1
Workflows #13
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
- Moving them to another file so it can be used in any higher level code
- Separate calling ai from domain logic - Simplify parsing response using list comprehension - Extract tool call, might reuse it for other calls
- CLI calls into workflow - Removing the older flow temporarily, not generating files, no target dir - Extracting reasoning effort into env, and refactoring settings to have the file name specified inside config.py itself
- Extract spinner as an activity so it can be used only around parts of workflow - Rename FeedbackResponse and status appropriately
- Make another request to responses with the function call and response both. - Not doing this makes the response incomplete, and we can't continue it. - Note that the actual tool call implementation is just an empty string, because there is no tool, just that the tool call args are in json.
- This was removing imports - Need to find a better hook for this, perhaps pre-push / pre-commit
- Use OpenAI's conversations API to manage state - Use global state with the assumption that there will only ever be 1 ongoing conversation per CLI run - Only prompt to use the tool, nothing else.
- Don't enforce the story structure too much, be a bit flexible - Add basic t-shirt size estimates - Add a note about ordering stories - Add a note about cutting pieces for CRUD tasks
- Add prompt, activity and extension to workflow
- Aware that this pollutes the code a bit right now - Adding function and file context for debuggability, should ideally just use module name. Will refactor this later. - This is an init commit, will tweak logging as needed with progress
- Refactor ai.py to output reasoning, and then send it back - Refactor it to use types defined in the python library - And extract the response parsing into a function - Some of the request creation is duplicated in the follow up. want to clean that up sometime.
- Remove story_machine.py. It has been superseeded by current implementation. - CLI.py only has the basic cli setup. Workflow is extracted to its own. - New implementations don't have tests yet.
- Add these details along with ACs, and then ask the user for feedback. - Use the same prompt when iterating too. This makes it confusing when there's mixed feedback for ACs and enriched context. Need to figure this out.
- Given PRD and tech spec, get a list of relevant questions to ask about the codebase - Reuse the existing call_openai function, just without tool calls - Temporarily breaking the workflow until the next step of getting the codebase context is implemented
- Given repo and questions, get answers. Currently using claude code sdk. But, can switch to something else in the future. Preferably something that doesn't need a local codebase. Note that the SDK is wrapper over the CC CLI. CC CLI needs to be installed on user machine for this to work. - Isolate claude code sdk integration into ai.py. We should be able to swap out implementation easily enough. - Setup config and environment for claude code sdk. - Add CLI input for repo path, add to workflow input
- Continue the workflow with the added context of what's in the repo
Pull Request Review: WorkflowsOverviewThis PR implements a workflow system for breaking down problems into user stories with an iterative improvement process. The implementation is substantial (1179 additions, 752 deletions) and introduces several new architectural patterns. 🎯 Code Quality & Best Practices✅ Strengths
|
Code Review: Workflows PROverviewThis PR introduces a significant refactor implementing a workflow-based approach. Changes: 1691 additions, 756 deletions. Critical Issues1. Global Mutable State - src/storymachine/ai.py:20Global conversation_id breaks functional programming principles and causes issues with concurrent execution and testing. 2. Missing Test CoverageCore workflow logic has zero test coverage, violating project guidelines. 3. Resource Leak - src/storymachine/logging.py:23File handle never closed, causing descriptor leaks. 4. Unsafe Dynamic Attributes - src/storymachine/ai.py:100-103Using setattr on OpenAI response objects violates immutability contract. Security ConcernsEnvironment Variable Mutation - src/storymachine/ai.py:276Modifying os.environ at runtime can leak credentials and create race conditions. API Key Validation MissingNo validation or redaction in logs. Other Issues
Must Fix Before Merge
ConclusionWell-structured architecture but should NOT be merged without tests. Global state and resource leak also need fixing. Estimated effort: Critical fixes 4-6h, test coverage 8-12h. Happy to help implement fixes! |
- nudging it to make parallel tool calls - not read the full codebase
Code Review for PR #13: WorkflowsThis is a substantial refactoring that implements a workflow system for story generation. Overall, the architecture is clean with good separation of concerns. Strengths
Critical Issues1. Resource Leak in logging.py:23 2. Unsafe JSON Parsing in activities.py:96 3. Global Mutable State in ai.py:20 4. Missing Error Handling in activities.py:137-142 5. Type Safety Issue in ai.py:69 Security Concerns1. API Key Exposure in ai.py:276 2. Logging Sensitive Data 3. Missing Input Validation Performance Issues1. Sequential Story Processing in workflow.py:64 2. Settings Recreated Every Call Test Coverage GapMajor Issue: No tests for new core modules:
Per CLAUDE.md: "New features require tests". This is 807 lines of untested code. RecommendationsHigh Priority:
Medium Priority: SummaryWell-structured refactoring with good architecture, but has significant gaps in error handling, testing, and resource management. The lack of tests for 807 lines of new code is particularly concerning. Recommendation: Request changes to address critical bugs and add test coverage before merging. |
Code Review for PR #13: WorkflowsOverviewThis PR implements a significant refactoring that introduces a workflow-based architecture for breaking down PRDs and tech specs into user stories. The implementation is well-structured overall, but there are several areas that need attention before merging. 🔴 Critical Issues1. Missing Tests for New Code
2. Global Mutable State
# Global conversation state
conversation_id: Optional[str] = None
3. Broad Exception Handling Missing
🟡 Code Quality Issues4. Inconsistent Type Annotations
def _create_and_parse_response(
client: OpenAI, params: dict, logger, log_prefix: str # logger has no type hint
) -> Response:
5. Hardcoded Magic Values
6. Line Length Violations
7. Docstring Quality
🟢 Performance Considerations8. Sequential Story Processing
9. File I/O on Every Log
logger_factory=structlog.WriteLoggerFactory(file=log_file.open("a"))
🔒 Security Concerns10. API Key Environment Variable Manipulation
os.environ["ANTHROPIC_API_KEY"] = settings.anthropic_api_key
11. Potential Prompt Injection
📊 Test Coverage12. No Tests for New Modules
✅ Positive Aspects
📝 Recommendations SummaryBefore Merging (Required):
Nice to Have:
Test ExecutionBefore merging, ensure all tests pass: PYTEST_DISABLE_PLUGIN_AUTOLOAD="" uv run --frozen pytest
uv run --frozen pyright
uv run --frozen ruff check .Great work on the architecture refactoring! The code is well-structured and the workflow approach is solid. Address the critical issues above and this will be ready to merge. |
- pass the right flags in - read the right configs - update README
PR Review: WorkflowsThis is a significant refactoring with excellent architectural improvements but several critical issues need addressing. Critical Issues1. Missing Exception Handling (activities.py:89-98, ai.py:72-73)
Per CLAUDE.md, catch specific exceptions (json.JSONDecodeError, ConnectionError, etc.) 2. Resource Leaks (logging.py:23) 3. Type Safety Issues (ai.py:68-70, activities.py:89)
4. Global Mutable State (ai.py:19-20) Security Concerns1. Sensitive Data Logging (ai.py:91-98, 174-185) 2. Environment Variable Injection (ai.py:276) 3. Token Validation (activities.py:136-141) Code Quality1. Line Length Violations 2. Incomplete Docstrings 3. Magic Numbers (activities.py:148, ai.py:22) 4. Code Duplication (ai.py:167-172, 214-219) Test CoverageMajor concern: Zero tests for new modules (activities.py, ai.py, workflow.py, types.py)
Need unit tests with mocked API calls and error path testing. Positive Aspects
Action ItemsMust Fix:
Should Fix:
Nice to Have:
RecommendationRequest changes - excellent architecture but needs hardening for production. Prioritize exception handling, resource management, and test coverage. Code references: activities.py:89, ai.py:19, ai.py:68, logging.py:23, workflow.py:64 |
Pull Request Review: WorkflowsOverviewThis PR introduces a significant refactoring that implements a workflow-based approach to story generation, replacing the previous single-pass implementation. The changes represent good progress toward an iterative, feedback-driven system. ✅ StrengthsCode Organization
Type Safety
Workflow Design
🔴 Critical Issues1. Resource Leak in Logging (
|
Code Review: Workflows PRThis PR implements a significant refactoring that introduces a workflow-based approach for breaking down PRDs into user stories. The implementation is well-structured with good separation of concerns, but there are several areas that need attention before merging. Critical Issues1. Missing Tests for Core Functionality 2. Exception Handling Issues
3. Resource Management Issue (logging.py:23) 4. Global Mutable State (ai.py:19) 5. Type Safety Issues Security Concerns1. Token Exposure Risk 2. Input Validation Missing Performance Considerations1. Sequential Story Processing 2. Redundant Settings Creation 3. Unnecessary API Calls Code QualityPositives:
Issues:
RecommendationsMust Fix Before Merge:
Should Fix Before Merge:
Recommendation: Request changes - primarily for test coverage and critical bug fixes. The code shows good architecture but lacks tests which is blocking. Once addressed, this will be solid foundation. |
|
I'm ignoring tests for this work, because it's very likely going to be rewritten in another form, and most of this code will be discarded. The workflow was created as a stepping stone. Similarly for handling exceptions, currently any exception will loudly just stop the program, I think. |
Implement a simple workflow that mimics a typical SDLC workflow for breaking down problems, and iteratively improving the units of work.
Workflow
Phase 1: Codebase Context
structure
Phase 2: Story Generation (Iterative)
codebase context
Phase 3: Story Detailing (Per Story, Iterative)
repo context
approved)
Phase 4: Final Output
context
Key Characteristics:
TODOs
Notes