Repository navigation
feat(task_step)!: require entity_refs on step types; add step_ref_sites - #742
agutmanstein-scale wants to merge 1 commit into
Conversation
A step type that leaves entity_refs undeclared is refused at registration: a plugin is skipped with a failure note, a config impl fails with ConfigError. () declares a type that holds no ids. step_ref_sites reads a TaskStep's or a step dict's declared refs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| ``step_ref_sites``, which reads a step's through the task-step registry, in ``agent_env.task_step.registry``.""" | ||
|
|
||
| from agent_env.entity.refs import EntityKind, EntityRef, RefRole, RefSite, parse_toml_ref, ref_sites | ||
| from agent_env.task_step.registry import step_ref_sites |
There was a problem hiding this comment.
Declaration imports load task steps
Importing only EntityRef from agent_env.entity_refs now loads the whole agent_env.task_step package. Its initializer imports built-in steps, providers, and stores, adding unrelated startup work for existing callers. Export step_ref_sites lazily so declaration imports stay lightweight.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/entity_refs.py
Line: 5
Comment:
**Declaration imports load task steps**
Importing only `EntityRef` from `agent_env.entity_refs` now loads the whole `agent_env.task_step` package. Its initializer imports built-in steps, providers, and stores, adding unrelated startup work for existing callers. Export `step_ref_sites` lazily so declaration imports stay lightweight.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
andrewpark-scaleai
left a comment
There was a problem hiding this comment.
holding for now. the code looks right and tests pass locally (4888 passed). but 10 of the 14 agentenvhub-sdk step plugins don't declare entity_refs yet (cua_evaluate, hydrator, publish, etc), and the sdk only floors agentenv-framework. so this release plus sdk <=0.40.33 skips them, and every task that uses them fails to load. can we land scaleapi#176128 and get the hub/worker pinned to sdk >=0.40.34 first? happy to approve right after. nit: the entity_refs or () and is None branches in bundle/* are dead now, fine as a follow-up.
cikowski
left a comment
There was a problem hiding this comment.
Approving. One sequencing note: this needs scaleapi#176128 (every agentenvhub-sdk step declares entity_refs) to land before agentenvhub-sdk picks up this framework release, otherwise the undeclared SDK steps stop registering.
entity_refsundeclared (None)Noneitselfagent-env plugin checklists it), a[task_steps] implsentry fails withConfigErrorentity_refsunsetentity_refs = ()ref_sites(type(step).entity_refs or (), step.to_dict()), written out by each callerstep_ref_sites(step), for aTaskStepor a step dict (looked up in the registry bytype), fromagent_env.task_step.registryoragent_env.entity_refsBuilt-in step types already all declare (a test checks that), so nothing built in changes.
Why. Tools that read or rewrite a step's ids, such as bundle resolvers and pooled-run checks, can't see a step type that declares nothing, and each consumer had to handle
Noneon its own.Upgrading. A plugin or
[task_steps] implsstep type must declareentity_refsbefore it upgrades to this version: the fields that hold env, A2A agent, artifact or task ids, or()if it holds none. Abstract or intermediate classes without their owntypeare not affected.Docs. The steps page could say that a custom step type must declare
entity_refs(with()for none), and mentionstep_ref_sites.Tests
tst/unit/plugins_test.py: an undeclared step plugin is skipped with its note while a()one and one declaring an env ref register.tst/unit/task_step/test_config_task_steps.py: an undeclared[task_steps] implsentry fails withConfigError.tst/unit/task_step/test_entity_refs.py:step_ref_siteson aTaskStepand on a dict, and an unknown type.entity_refs = ().🤖 Generated with Claude Code
The PR appears safe to merge, with a non-blocking startup-cost concern in the compatibility export.
Fix with agent prompt
Summary
Requires custom step types to declare
entity_refsand addsstep_ref_sitesfor reading references from instances or dictionaries.Reviews (1) · Last reviewed commit: "feat(task_step)!: require entity_refs on..." · Reviewed by Greptile