Commit Graph

377 Commits

Author SHA1 Message Date
Greyson LaLonde
167b609365 fix: restore event scope stack from checkpoint event record
Replay the event record during _restore_runtime to rebuild
_event_id_stack with correct event IDs. Remove manual push_event_scope
calls from task and crew resume paths that used task UUIDs instead
of event IDs.
2026-04-04 23:18:23 +08:00
Greyson LaLonde
b46e96532e fix: return state messages by reference, not copy 2026-04-04 23:06:07 +08:00
Greyson LaLonde
5c243b72a8 fix: skip adding crew-owned agents as top-level RuntimeState entities 2026-04-04 23:03:50 +08:00
Greyson LaLonde
055d1469a0 fix: resolve mypy errors from openai 2.x type changes 2026-04-04 23:00:49 +08:00
Greyson LaLonde
6e7afb732f fix: avoid duplicating LLM hooks on checkpoint restore 2026-04-04 22:41:59 +08:00
Greyson LaLonde
e0fc32144c fix: return 0 instead of None when checkpoint resumes from first task 2026-04-04 22:37:42 +08:00
Greyson LaLonde
0c228b45b7 fix: seed _registered_entity_ids from restored RuntimeState 2026-04-04 22:31:39 +08:00
Greyson LaLonde
3f447f21d0 cleanup: remove redundant _registered_entity_ids class annotation 2026-04-04 22:27:32 +08:00
Greyson LaLonde
da5a890eae fix: share event metadata setup between emit and aemit
Extract _prepare_event to set previous_event_id, triggered_by_event_id,
emission_sequence, parent/child scoping, and event_record tracking.
Both emit and aemit now call it, fixing aemit's missing metadata.
2026-04-04 22:24:58 +08:00
Greyson LaLonde
686cff6514 fix: register entities in aemit like emit does 2026-04-04 22:12:19 +08:00
Greyson LaLonde
fac186a931 fix: handle unhashable partial handlers in param count cache 2026-04-04 22:10:09 +08:00
Greyson LaLonde
70fc701941 fix: bump litellm to ~=1.83.0 and openai to ~=2.30.0
litellm 1.83.0 fixes CVE-2026-35029 (proxy config privilege escalation)
and CVE-2026-35030 (proxy JWT auth bypass), and is the first release
after the supply chain incident. Bump openai to 2.x to satisfy litellm's
dependency.
2026-04-04 22:04:16 +08:00
Greyson LaLonde
c4bbb039da refactor: use lru_cache for handler param count 2026-04-04 21:35:00 +08:00
Greyson LaLonde
d769469ff6 fix: restore checkpoint_train flag during checkpoint resume 2026-04-04 21:30:36 +08:00
Greyson LaLonde
ebb58a237e fix: bump uv-pre-commit to 0.11.3, distinguish checkpoint resume
- Bump uv-pre-commit from 0.9.3 to 0.11.3 to support relative
  exclude-newer values in pyproject.toml
- Use checkpoint_kickoff_event_id to detect resume, preventing
  second kickoff() from skipping tasks or suppressing events
2026-04-04 21:29:30 +08:00
Greyson LaLonde
b882988128 fix: checkpoint resume bugs and handler signature caching
- Return len(tasks) from _get_execution_start_index when all tasks
  complete, preventing full re-execution of finished checkpoints
- Add _get_execution_start_index call to _aexecute_tasks so async
  resume skips completed tasks like the sync path does
- Cache inspect.signature results per handler to avoid repeated
  introspection on every event emission
2026-04-04 04:11:34 +08:00
Greyson LaLonde
81e51f058a Merge branch 'main' into chore/runtime-state-event-bus 2026-04-04 04:01:50 +08:00
Greyson LaLonde
e72b08ec49 fix: resolve mypy errors from optional executor fields
- Disable union-attr/arg-type at file level in the two executor files
  where agent/task/crew are always set at runtime but typed as optional
- Fix Liskov override in OpenAICompletion: use BaseAgent instead of Agent
- Remove stale type: ignore comments now covered by file-level disables
2026-04-04 03:57:39 +08:00
Greyson LaLonde
c1f9d9270b fix: assign mocks post-init for remaining executor tests
Remove spec= from mocks and construct executors with defaults, then
assign mock agent/task/crew after init to avoid pydantic validation.
2026-04-04 03:38:46 +08:00
Greyson LaLonde
a94c2bf786 fix: bypass pydantic validation for mocks in BaseAgentExecutor tests
After model_rebuild, BaseAgentExecutor rejects plain MagicMock for
typed fields. Construct with defaults then assign mocks post-init.
Also guard RuntimeState tests for environments where model_rebuild fails.
2026-04-04 03:33:07 +08:00
Greyson LaLonde
206259b537 fix: add spec= to remaining mocks passed to pydantic models 2026-04-04 03:12:21 +08:00
Greyson LaLonde
a3d25c661a fix: register RuntimeState in Flow.from_checkpoint
Crew.from_checkpoint called set_runtime_state but Flow.from_checkpoint
did not, leaving the event bus without the restored state.
2026-04-04 03:09:57 +08:00
Greyson LaLonde
7f24d74795 fix: use real pydantic instances in executor tests, preserve cache handler across re-validation
- Replace MagicMock fixtures with real Agent/Task instances in
  test_async_agent_executor.py so pydantic validation passes
- Guard CacheHandler creation in Crew.set_private_attrs to avoid
  replacing an existing handler when the model validator re-runs
  during RuntimeState registration
2026-04-04 03:05:06 +08:00
Greyson LaLonde
fba56056c0 fix: use spec= on mocks for typed executor fields 2026-04-04 02:16:34 +08:00
Greyson LaLonde
f9d58d4d32 fix: add BaseAgentExecutor to model_rebuild chain 2026-04-04 02:11:48 +08:00
Greyson LaLonde
fb8b59d001 fix: guard register_entity when RuntimeState is None 2026-04-04 02:07:48 +08:00
Greyson LaLonde
ce99312db1 chore: add exclude-newer = 3 days to all pyproject.toml files 2026-04-04 02:02:58 +08:00
Greyson LaLonde
191053c41b refactor: generic from_checkpoint with provider, full LLM serialization 2026-04-04 01:25:31 +08:00
Greyson LaLonde
6dc9f462f9 feat: mid-task checkpoint resume and executor refactor 2026-04-04 01:07:45 +08:00
Greyson LaLonde
5ace0bfe4a fix: suppress duplicate lifecycle events on checkpoint resume 2026-04-03 23:02:16 +08:00
Greyson LaLonde
c653d41b89 feat: add EventRecord to RuntimeState checkpoints 2026-04-03 22:31:36 +08:00
Greyson LaLonde
de9300705d refactor: move RuntimeState to state/, add async checkpoint with provider pattern
- Move runtime_state.py to state/runtime.py
- Add acheckpoint async method using aiofiles
- Introduce BaseProvider protocol and JsonProvider for pluggable storage
- Add aiofiles dependency to crewai package
- Use PrivateAttr for provider on RootModel
2026-04-03 21:29:27 +08:00
Greyson LaLonde
1ed6646eae refactor: move RuntimeState to runtime_state.py, type _runtime_state on event bus 2026-04-03 20:36:57 +08:00
Greyson LaLonde
2e1525f69a fix: mypy errors in streaming.py and core.py 2026-04-03 19:32:29 +08:00
Greyson LaLonde
caaccd748d fix: validate entity_type tag before auto-registering in emit() 2026-04-03 18:49:23 +08:00
Greyson LaLonde
3a08e954e7 fix: replace object.__new__ and MinimalExecutor subclass with proper construction 2026-04-03 18:42:31 +08:00
Greyson LaLonde
0b980db1e9 fix: use spec= on test mocks for typed executor fields 2026-04-03 17:42:47 +08:00
Greyson LaLonde
de9f121cf7 fix: type remaining Any fields on CrewAgentExecutor 2026-04-03 17:32:00 +08:00
Greyson LaLonde
78fbe455b9 fix: TokenCalcHandler hashability, test MinimalExecutor as instance 2026-04-03 17:25:51 +08:00
Greyson LaLonde
6504e39d47 feat: type executor fields, auto-register entities in event bus, convert TokenProcess to BaseModel 2026-04-03 17:12:41 +08:00
Greyson LaLonde
5179b411cd Merge branch 'main' into chore/runtime-state-event-bus 2026-04-03 12:43:14 +08:00
Greyson LaLonde
9ab85e642c refactor: make CrewAgentExecutorMixin a proper base class with Fields instead of PrivateAttr properties 2026-04-03 12:41:13 +08:00
Greyson LaLonde
743ebedd1b fix: preserve kickoff_event_id on resume, verbose already works 2026-04-03 12:21:05 +08:00
Greyson LaLonde
2e1f882234 feat: convert executor/tools/prompts to BaseModel, enable checkpoint resume via kickoff() 2026-04-03 12:03:11 +08:00
Lorenze Jay
6ef6fada4d feat: bump versions to 1.13.0 (#5246) 2026-04-02 16:12:03 -07:00
Lucas Gomide
1b7be63b60 Revert "refactor: remove unused and methods from (#5172)" (#5243)
* Revert "refactor: remove unused  and  methods from (#5172)"

This reverts commit bb9bcd6823.

* test: fix tests
2026-04-02 18:02:59 -04:00
Greyson LaLonde
cf241d85e8 feat: pass RuntimeState through event bus, add .checkpoint() and .from_checkpoint() 2026-04-03 05:33:15 +08:00
alex-clawd
59aa5b2243 fix: add tool repository credentials to crewai install (#5224)
* fix: add tool repository credentials to crewai install

crewai install (uv sync) was failing with 401 Unauthorized when the
project depends on tools from a private package index (e.g. AMP tool
repository). The credentials were already injected for 'crewai run'
and 'crewai tool publish' but were missing from 'crewai install'.

Reads [tool.uv.sources] from pyproject.toml and injects UV_INDEX_*
credentials into the subprocess environment, matching the pattern
already used in run_crew.py.

* refactor: extract duplicated credential-building into utility function

Create build_env_with_all_tool_credentials() in utils.py to consolidate
the ~10-line block that reads [tool.uv.sources] from pyproject.toml and
calls build_env_with_tool_repository_credentials for each index.

This eliminates code duplication across install_crew.py, run_crew.py,
and cli.py, reducing the risk of inconsistent bug fixes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: add debug logging for credential errors instead of silent swallow

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 17:56:36 -03:00
alex-clawd
2e2fae02d2 fix: add tool repository credentials to uv build in tool publish (#5223)
* fix: add tool repository credentials to uv build in tool publish

When running 'uv build' during tool publish, the build process now has access
to tool repository credentials. This mirrors the pattern used in run_crew.py,
ensuring private package indexes are properly authenticated during the build.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: add env kwarg to subprocess.run mock assertions in publish tests

The actual code passes env= to subprocess.run but the test assertions
were missing this parameter, causing assertion failures.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 17:52:08 -03:00
Greyson LaLonde
6627845372 feat: pass RuntimeState through event bus, add .checkpoint(directory) 2026-04-03 04:19:06 +08:00