feat(rfc-0027): ACP subagent Zed compatibility - #110
Conversation
- SpawnSessionStart in zed mode now generates a NEW tool_call_id instead of reusing the PydanticAI-native tool_call_id - This creates a distinct tool call bearing _meta.subagent_session_info - Zed can recognize this as a subagent and load the child session - Original PydanticAI tool call remains untouched Related Zed-side change: dynamic subagent loading via EntryUpdated
…e providers - Reverted accidental deletion of get_skills() from ResourceProvider base class which broke 18 callers across agent_routes, command_registry, aggregating, etc. - Restored missing return skill in LocalResourceProvider.get_skill() Fixes: serve-acp config loading error "Failed to import class"
…fications) Reverted 50 files that contained: - ruff auto-fix (import sorting, line length, TYPE_CHECKING moves) - Exception type changes in tools/base.py (ValueError -> TypeError) - Import removals in provider_router.py - Various formatting and style changes Kept only RFC-0027 core files: - acp_server/ event_converter, session, session_manager, server, acp_agent - pool_server config, serve_acp CLI - Tests and snapshots - resource_providers base.py and local.py (get_skills fix)
- Fix local.py task_ref garbage collection with _background_tasks set - Fix zed_provider.py database connection leaks with finally blocks - Fix event_converter.py child_session_id mismatch using returned ID - Fix event_converter.py exception handling to catch Exception broadly - Fix event_converter.py cleanup _subagent_message_counts and _subagent_tool_map on completion - Fix session.py and event_converter.py _display_mode propagation - Move RFC-0027 to implemented status
- fix(session_manager): add session.close() on initialization failure to prevent resource leaks - feat(session_manager): allow passing explicit child_session_id to create_child_session for ID consistency - fix(event_converter): clean up subagent state on StreamCompleteEvent fallback path to prevent memory accumulation - fix(sessions/manager): accept optional child_session_id in create_child_session
|
|
|
|
Summary
RFC-0027 implementation: ACP subagent Zed compatibility support.
Changes
Bug fixes in event_converter.py
_current_message_idfield declarationreset()bodyreset()call on StreamCompleteEventZed mode type propagation
"zed"tosubagent_display_modeacross 7 files (server, CLI, config, session, agent)SubagentSessionInfo model and helpers
SubagentSessionInfoPydantic model withsession_id,message_start_index,message_end_index_build_subagent_field_meta()helper for constructing_metapayload_metafilling in zed modeSpawnSessionStarthandler emitsToolCallStartwith_meta.subagent_session_infoandtool_name="task"SubAgentEventhandler routes inner events and emitsToolCallProgresswith_meta_metanever leaks in non-zed modes (legacy/inline/tool_box)Child session creation and routing
SpawnSessionStartcreates independent ACP subsession viasession_manager.create_child_session()SubAgentEventinner events routed to child session's event loopStreamCompleteEventcloses child session and emits parent completionMessage index tracking
message_start_index=0on SpawnSessionStartmessage_end_index=count-1on StreamCompleteEventIndependent tool_call_id for zed subagent
_meta.subagent_session_infoTests and snapshots
Verification
pytest tests/test_event_converter.py- 29/29 passpytest tests/test_acp_event_converter_snapshots.py::TestZedModeSnapshots- 4/4 passRelated
Zed-side change required for full functionality: dynamic subagent loading via
EntryUpdatedevent handling (separate PR).