Repository navigation
refactor(agent-sdk): build the ACP provider through an SDK factory - #21545
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (6 items) — 5 justifiedIntent: keep the config layer from reaching the raw ACP provider class, as a step in the SDK-boundary migration (#21468). This is a refactor (ADDITION-free FIX of a boundary).
[FIRST-PRINCIPLES-REVIEWED] cfad00d Description read[DESCRIPTION-READ] 0258690c8a0d1a6369532d3d4b0c52de8ad9b4b956dfdf634bcdda929ca42013 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS
Watch
Suggestions
[DESIGN-REVIEWED] cfad00d Description read[DESCRIPTION-READ] 510cf22749e6ffb0cb8693cbcadd18093ab9cfc6ee0654fcfb15fa1869cbd247 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
c3c426f to
91c39a8
Compare
|
Addressed in
|
config.create_provider_factory reached kiro_crew.providers.acp.AcpProvider through a narrow accessor module (agent_sdk/acp_provider_class.py) that only relocated the config -> providers.acp dependency into the exempt SDK tree. Give the ACP driver a build_acp_provider(**kwargs) factory that owns the one construction touching providers.acp, have config call it with the values it already resolves, and delete the accessor. The class is still read at call time, so a patch of providers.acp.AcpProvider reaches the factory. No behaviour change.
91c39a8 to
cfad00d
Compare
|
HOLD at cfad00d. The refactor itself looks sound: config now builds the provider through agent_sdk.drivers.acp.build_acp_provider, the class is still imported at call time, and the defaults match AcpProvider.init today. CI on this head is green. What blocks approval: the Design and First Principles CONCERNS on this head have no reply. Both point out that build_acp_provider copies all 25 constructor defaults ( ), so if a default changes only in providers/acp.py, config sessions keep the old value without any error. The earlier reply was written for 91c39a8 and covers the typed signature, not the copied defaults.To clear: either drop the defaults (make the parameters required-keyword, or forward only the arguments the caller passed), or add a test that pins the wrapper's defaults to inspect.signature(AcpProvider.init). Then post a disposition for each lane and fix the description, which still says build_acp_provider(**kwargs). — crew-pr-reviewer (r111) |
Problem / Motivation
Goal: Make the config package build its provider through the agent SDK instead of reaching the raw ACP provider class, so
configno longer depends on the ACP layer.KiroCrewConfig.create_provider_factoryconstructedkiro_crew.providers.acp.AcpProviderthrough a narrow accessor module,src/kiro_crew/agent_sdk/acp_provider_class.py, added by the line-cap split ofconfig/loader.py(#20550). That accessor only relocated theconfig -> providers.acpdependency into the SDK's exempt tree soscripts/check_agent_sdk_boundary.pywould stay green; it did not remove it. The dependency is still there, just laundered through one extra module.Why it matters
The agent SDK boundary RFC (
docs/request-for-change/rfc-crew-agent-sdk-boundary.md) makeskiro_crew.agent_sdkthe single surface through which the rest of the tree talks to a backend, migrated one consumer at a time. Whileconfigreaches the provider class through a passthrough accessor, swapping or hardening the backend still means touching the config layer, and the boundary checker reports a cleanliness the code does not actually have. Removing the accessor and routing construction through a real SDK factory movesconfiggenuinely behind the boundary — one step of the RFC's additive migration.Not a goal
What changed (motivation → approach → change)
create_provider_factorythat touchesproviders.acpis fetching the class and the finalAcpProvider(...)call; config owns all the surrounding policy (model, backend, effort, gateway resolution). The accessor returned the class so config could still do the construction itself — the construction, not the class lookup, is the edge.src/kiro_crew/agent_sdk/drivers/acp.py) abuild_acp_provider(**kwargs)factory that owns that one construction, matching the module's existing deferred-import pattern (provider_label,context_provider_of). Config calls it with the values it already resolves.build_acp_provider;create_provider_factorynow calls it instead ofacp_provider_class(); deletedagent_sdk/acp_provider_class.py. The class is still read at call time (function-local import), so a patch ofkiro_crew.providers.acp.AcpProviderreaches the factory and the import cycle (providers.acp→acp.client→session→config.loader) stays broken.check_agent_sdk_boundary.pyshows noconfig -> providers.acpedge and the baseline is unchanged (both the old accessor and the driver live in the exemptagent_sdk/tree).Backwards compatibility
Compatible: no public signature changes;
create_provider_factoryreturns the same callable building the sameAcpProviderwith identical arguments.This diff deletes the private helper
agent_sdk/acp_provider_class.py::acp_provider_class(). Grepped origin/main foracp_provider_classacross every entry point (chat, cron, subagent, app bundles, crew page, release branch) — it has exactly two readers, both updated in this PR and neither reachable except through the config provider factory, whose behaviour is unchanged:Reader: src/kiro_crew/config/loader_config.py:create_provider_factory -- chat -- rewritten in this PR to call agent_sdk.drivers.acp.build_acp_provider, which performs the identical construction; the one provider factory used by chat, cron, subagent and crew-page sessions.
Reader: test/test_loader_owners_contract.py:test_a_patched_provider_class_reaches_the_factory -- release -- rewritten in this PR to exercise build_acp_provider and keep pinning the patchability and single-build contract.
Tests
test/test_loader_owners_contract.pyupdated to exercisebuild_acp_providerand keep pinning the patchability + single-build contract (a patch ofproviders.acp.AcpProviderreaches both the SDK factory and the config factory). The suite'stest_no_loader_module_imports_the_acp_layerstill passes.test/test_agent_sdk_provider_identity.py::test_importing_this_module_does_not_load_the_acp_packagestill passes: the added SDK import is function-local, so loading the SDK does not loadkiro_crew.acp.Manual verification
N/A — unit coverage sufficient. Verified locally:
scripts/check_agent_sdk_boundary.pyand--testpass;test/test_loader_owners_contract.py,test/test_agent_sdk_provider_identity.py,test/test_acp_provider.py,test/test_cc_permission_mode_seed.py,test/test_crew_reasoning_effort.pypass; black / isort / flake8 / mypy clean on the changed files. Only new/changed and referencing tests were run locally; CI runs the full cross-surface set.CI note (not this PR):
Frontend Tests (2),Real Adapter Contract Tests, thetest/test_extras.py::test_requirements_match_setup_cfg[teams]case in a Backend Tests shard (PyJWT[crypto]==2.13.0vs2.15.0), andE2E (stub ACP backend, offline)all fail independent of this change. This diff is Python-only inconfig/agent_sdkand touches no frontend, JS bundle, dependency pin, or dashboard UI. The first three fail byte-identically on unrelated open PRs (an in-flight main fix exists for the PyJWT extras pin). The E2E red is thetest_dashboard_playwright_suiteharness, not the ACP path: in this run the provider-exercising smoke tests (test_chat_send_receives_reply,test_chat_tool_call_renders) PASSED, and the only failure is the Playwright dashboard suite (gateway timeout / a flakyembed-popoutspec — the same test fails on unrelated PRs). A Backend Tests shard hitstest/test_session_allocation_bindings.py::...@tree_scan_session_allocation_bindings - Failed: Timeout >120.0s. This is an inherently slow AST tree-scan test (it parses the whole source corpus;facade = kiro_crew.session_allocation, which this diff does not touch). Measured in isolation (-p no:randomly -n 0, same interpreter/venv): 84.7s on this branch vs 85.0s on origin/main — identical, so the diff does not slow the scan; it is a CI-load timeout against the 120s ceiling (the single run on each unrelated PR happened to land under the ceiling). Not rerun again.Coverage Gatefails closed downstream of the test reds (it reportsbackend-test=failure/frontend-test=failure) and fails the same way on unrelated PRs #21552/#21551/#21549;PR Readinessis downstream of the same reds. No code rerun requested; these clear when main / the flakes do.Related Issues
Fixes #21468
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)