-
Notifications
You must be signed in to change notification settings - Fork 13
feat: implement enum-based state machine and update changelog #99
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
- Add AgentState enum with 4 states: USER_INPUT, ASSISTANT, TOOL_EXECUTION, RESPONSE - Create AgentStateMachine with thread-safe state transition validation - Implement backward compatibility layer in ResponseState class - Update node_processor.py to use state machine for completion detection - Add transition rules to prevent invalid state changes - Maintain full backward compatibility with existing boolean flags This replaces the error-prone 4-boolean system with a robust state machine that enforces valid transitions and eliminates premature completion issues.
- Add enum-based state machine implementation for v0.0.72 - Document configurable tool validation for v0.0.71 - Include model configuration updates for v0.0.70 - Fix test alignment with new completion marker format - Update system prompt documentation and examples
Caution Review failedThe pull request is closed. WalkthroughIntroduces an enum-based agent state machine (USER_INPUT, ASSISTANT, TOOL_EXECUTION, RESPONSE), integrates transitions across node processing, updates completion detection to a “TUNACODE DONE:” marker, revises system prompts and agent config for plan mode, adjusts REPL detection, updates tests, adds planning/research docs, and an example config. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Agent
participant StateMachine as AgentStateMachine
participant Tools
participant REPL
User->>Agent: Provide input
Agent->>StateMachine: transition_to(ASSISTANT)
Agent->>Agent: Generate response / tool-calls
alt Tool calls present
Agent->>StateMachine: transition_to(TOOL_EXECUTION)
Agent->>Tools: Execute tool(s)
Tools-->>Agent: Tool results
end
Agent->>StateMachine: transition_to(RESPONSE)
Agent->>Agent: Check for "TUNACODE DONE:" (regex)
alt DONE detected
Agent->>StateMachine: set_completion_detected(True)
Agent-->>User: Final response
else Not done
Agent->>StateMachine: transition_to(ASSISTANT)
Agent-->>User: Follow-up / continue loop
end
REPL->>Agent: Monitor output
REPL->>REPL: Detect anchored DONE marker
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (18)
✨ Finishing touches
🧪 Generate unit tests
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 |
Summary
Changes Made
TUNACODE_TASK_COMPLETE
toTUNACODE DONE:
tool_strict_validation
settingTest plan
Summary by CodeRabbit
New Features
Documentation
Tests