feat(subagent): phase1 - persistent subagent instance types and registry - #2192
Closed
ArrogHie wants to merge 3 commits into
Closed
feat(subagent): phase1 - persistent subagent instance types and registry#2192ArrogHie wants to merge 3 commits into
ArrogHie wants to merge 3 commits into
Conversation
- SubagentInstance maps a resumable instance_id to a child Runtime Session - SubagentInstanceRegistry (DashMap-backed) with register/get/state transitions/destroy/list operations and English logs - State transitions validated (Idle->Running, Running->Idle); invalid transitions return Err with warn log - Types exported crate-wide via coordination::mod; unused until Phase 2
- 16 tests covering register/get, Idle<->Running transitions, invalid transition errors (Err + warn), destroy and destroy_all_for_parent, list_for_parent, can_resume, instance id uniqueness, and active_count
- register warns when overwriting an existing entry (M2) - transition and destroy logs include parent_session_id (m1, m2) - destroy captures the removed instance via DashMap remove() for logging - document Destroyed as terminal state reserved for soft-delete/history (M1) - module allow(dead_code) -> expect(dead_code) with reason (m3) - add tests: transitions after destroy fail, register overwrite keeps newest (m4, m5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of Persistent Subagent + Structured Output: define the orchestrator-level
SubagentInstancedata model and an in-memory instance registry. No existing call paths are modified.Changes
subagent_instance.rs(new):SubagentInstancetype mapping a resumableinstance_idto a child Runtime Session,SubagentInstanceStatuslifecycle enum (Running / Idle / Destroyed), and a DashMap-backedSubagentInstanceRegistry.Errwith awarn!log).coordination/mod.rs: crate-wide export of the new types (pub(crate)), following the internal-helper-module convention (mod+pub(crate) use).can_resume, instance ID uniqueness, andactive_count.Verification
pnpm run fmt:rs- formattedcargo check -p bitfun-core- passes, no new warningscargo test -p bitfun-core subagent_instance- 16 passedcargo test -p bitfun-core coordination- 160 passed (no regressions)Notes
#[expect(unused_imports)]/#[allow(dead_code)]on the module, with comments), which the compiler will flag for removal once Phase 2 lands.