Release 0.9.0
Added
-
Hook Execution Context for Database Access
-
New
get_hook_repository()function allows hooks to access database within task execution context -
New
get_hook_session()function provides direct access to database session in hooks -
Hooks now share the same database session/transaction as TaskManager (no need for separate sessions)
-
Auto-persistence for
task.inputsmodifications in pre-hooks (detected and saved automatically) -
Explicit repository methods available for other field modifications (name, priority, status, etc.)
-
Thread-safe context isolation using Python's
ContextVar(similar to Flask/Celery patterns) -
Added
set_hook_context()andclear_hook_context()internal functions for context management -
Exported to public API:
aipartnerupflow.get_hook_repositoryandaipartnerupflow.get_hook_session -
Added comprehensive test coverage (16 tests):
-
Hook context basic operations and lifecycle
-
Multiple hooks sharing same session instance
-
Hooks sharing transaction context and seeing uncommitted changes
-
Hooks cooperating via shared session
-
Auto-persistence of task.inputs modifications
-
Explicit field updates via repository methods
-
Database Session Safety Enhancements
-
Added
flag_modified()calls for all JSON fields (result, inputs, dependencies, params, schemas) to ensure SQLAlchemy detects in-place modifications -
Added
db.refresh()after critical status updates to ensure fresh data from database -
Added concurrent execution protection: same task_tree cannot run multiple times simultaneously
-
Returns
{"status": "already_running"}when attempting concurrent execution of same task tree -
Added 12 new tests for concurrent protection and JSON field persistence
-
CLI Extension Decorator (
cli_register) -
New
@cli_register()decorator for registering CLI extensions, similar to@executor_register() -
Decorator supports
name,help, andoverrideparameters -
Auto-derives command name from class name (converts
_to-) -
New
get_cli_registry()function to access registered CLI extensions -
CLI extensions are loaded from decorator registry before entry_points discovery
-
Added comprehensive test coverage (18 tests) for CLI extension decorators
-
Exception Handling Architecture
-
New exception hierarchy based on FastAPI/production framework best practices
-
ApflowErrorbase exception for all framework-specific errors -
BusinessErrorfor expected user/configuration errors (logged without stack traces) -
ValidationErrorfor input validation failures -
ConfigurationErrorfor missing configuration/dependencies -
SystemErrorfor unexpected system-level errors (logged with stack traces) -
ExecutorErrorfor executor runtime failures -
StorageErrorfor database/storage failures -
Created
core/execution/errors.pywith comprehensive exception documentation -
Created
docs/development/exception-handling-standards.mdwith implementation guidelines
Changed
-
Executor Error Handling Refactoring
-
All executors now raise exceptions instead of returning error dictionaries
-
Technical exceptions (TimeoutError, ConnectionError, etc.) now propagate naturally to TaskManager
-
Executors validate inputs and raise
ValidationErrororConfigurationErrorfor expected failures -
Updated executors:
DockerExecutor,GrpcExecutor,RestExecutor,SshExecutor,CommandExecutor,LLMExecutor -
TaskManager now catches all exceptions, marks tasks as failed, and logs appropriately based on exception type
-
BusinessErrorlogged without stack trace (clean logs), other exceptions logged with full stack trace -
CrewAI Executor/Batch Executor Renaming and Test Fixes
-
crewai/crew_manager.py→crewai/crewai_executor.py, with the class name updated toCrewaiExecutor -
crewai/batch_manager.py→crewai/batch_crewai_executor.py, with the class name updated toBatchCrewaiExecutor -
All related test cases (test_crewai_executor.py, test_batch_crewai_executor.py, etc.) have been batch-updated with corrected patch paths, mocks, imports, and class names to align with the new naming
-
Resolved AttributeError: module 'aipartnerupflow.extensions.crewai' has no attribute 'crew_manager' and similar test failures caused by the renaming