fix(sdk): the build-an-agent skill stops teaching the deprecated commit shape when ordered operations are on - #5808
Conversation
…it shape when ordered operations are on
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Context
The playground bundles a
build-an-agentskill into every builder agent. Its body and itsreferences/config-schema.mdstill taught the old commit format —workflow_revision.delta.setwith wholesale list replacement, plus four copy-paste JSON examples of that shape — while the
commit_revisiontool, on a deployment withAGENTA_WORKFLOWS_ORDERED_OPERATIONS_ENABLEDon,serves a schema and description for the ordered form only (
read_configfor abase_revision_id, thendelta.operationswithadd_item/remove_item/ anchorededit_text).A live agent read both, followed the skill's example over the tool description, sent a
one-element
skillslist underdelta.set, and wiped the user's existing skill.op_catalogalready records why this happens, in the comment on the delta arm: a model that sees both shapes
picks a different one from call to call. The catalog closed that hole for the tool schema; the
skill was still open.
Changes
The skill content is now flag-conditional, on the same predicate the catalog uses. With the flag
on, the commit teaching describes only the ordered form; with it off, the legacy teaching is
byte-identical to what shipped, because flag-off deployments really do work that way. Neither
state mentions the other's shape.
Before (ordered deployment, what the skill told the agent to send):
{"workflow_revision": {"message": "Add a code-review-checklist skill.", "delta": {"set": {"parameters": {"agent": {"skills": [{"name": "code-review-checklist", "...": "..."}]}}}}}}After:
{"workflow_revision": {"base_revision_id": "019c4f1e-7a2b-73c8-9f10-2b6d5a1c8e04", "delta": {"operations": [{"operation": "add_item", "target": ["parameters", "agent", "skills"], "value": {"name": "code-review-checklist", "...": "..."}}]}}}agenta/sdk/agents/flags.py(new):ordered_operations_enabled()moves to a leaf module sothe skill and the catalog read one definition.
op_catalogre-exports the private names italways had, so
test_ordered_operations_flag.pykeeps importing them from there. The adaptercannot import the
platformpackage itself — it reaches the SDK singleton and is deliberatelykept off the eager import path.
agenta_builtins.py:SKILL.mdandreferences/config-schema.mdare assembled from a commonspine plus the passages that describe how a commit is made. The ordered arm teaches the
read-then-commit loop, the target grammar, the seven operations, worked examples for the five
things a builder agent actually commits (instructions, add a skill, edit a skill body, remove a
skill, add a tool), and the failure modes from the contracts: a stale
base_revision_idanswers 409 and you re-read,
target_not_found,text_not_unique, a read refused withoutput_too_largereturnschildren, andnext_steprather thanretryableis the recoveryfield. It also drops the derived-message teaching (
messageis off the ordered schema) andadds
read_configto the wired-tools list, where it exists.platformtool entry is something youcommit, and the legacy example resent three of them inside
tools. The server refuses anyplatform-kind entry on an agent's commit (platform_tool_not_committable), so that examplewas a guaranteed refusal, and it contradicted the legacy tool description. The entries are out
of the example and the rule is stated where the tool types are documented.
The playbooks under
agent_templates/needed no change: theirdelta.set.parameters.agent.toolsreferences are
test_run's uncommitted delta, which keeps the legacy shape in both flag states.Tests
New
oss/tests/pytest/unit/agents/test_build_an_agent_commit_teaching.pyreads the skill in bothflag states (one subprocess each, since the flag is read at import) and asserts:
delta.set,delta.remove, orwholesale— the classdetector for this incident;
delta.setonly on a line that also namestest_run;commit_revision's real resolved input schema, whichis closed at every level, and the five examples cover the five operations an agent commits;
nothing from the ordered form.
Green in both flag states: the SDK unit suite (
oss/tests/pytest/unit, 2003 passed; the onefailure,
test_streaming.py::test_cli_stream_terminal_only_on_empty_request, fails identicallyon the unmodified branch) and the API unit suite (2085 passed), including
test_static_catalog.py,test_build_kit_overlay.py, andtest_ordered_operations_flag.py.ruff formatandruff checkclean on every touched file.