fix(runtime): accept RLMSpawnHandle in delete_subagent and align name attributes - #854
fix(runtime): accept RLMSpawnHandle in delete_subagent and align name attributes#854sashankh wants to merge 2 commits into
Conversation
… attributes `rlm()` returns an `RLMSpawnHandle` exposing the child name as `name`, while `rlm.list_subagents()` returns `RLMSubagent` exposing it as `session_name`. Neither type carried the other's attribute, and `delete_subagent()` accepted only `str | RLMSubagent`, so `await rlm.delete_subagent(handle)` on the handle just returned by `rlm(...)` raised TypeError before any host request was made. The shipped prompts and docs teach both spellings without noting they belong to different types. - `delete_subagent()` now also accepts `RLMSpawnHandle`, resolving the selector from `rlm_child_id` exactly as it already does for `RLMSubagent` - `RLMSpawnHandle.session_name` and `RLMSubagent.name` added as read-only aliases so either spelling works on either type - Widen the type hints on both the module function and the `rlm` proxy method Existing behavior is unchanged for `str` and `RLMSubagent` targets. The TypeError message now lists all three accepted types. fixes PrimeIntellect-ai#824
Adds the [Unreleased] bullet for the runtime change in this branch, following the external-contribution attribution format in AGENTS.md.
…MSpawnHandle delete_subagent fix
|
Hi, thanks for taking the time to contribute to Prime Agent! Since open sourcing the project, we’ve received far more pull requests than we can responsibly review and validate. Prime Agent runs directly on users’ machines, so we need to be deliberate about which changes we accept and how they are reviewed. Rather than leave a large backlog that we cannot meaningfully work through, we’re closing the current PR queue and moving to a discussion-first contribution process. We have established new contribution guidelines to help us continue iterating on Prime Agent and better manage contributions from the community. Going forward, we won’t review unsolicited pull requests. Instead, please start with a GitHub Discussion. We’ll identify recurring bugs and feature requests, create Issues for work we want to pursue, and invite pull requests from maintainers or vouched contributors when implementation is ready. Please read the full process documented in our contribution guidelines. While we’re closing this backlog, we’re still reviewing it at a high level to identify recurring bugs, useful ideas, and important problems that we should address ourselves. Thanks again for the time you put into this! |
Summary
rlm()returns anRLMSpawnHandlewhose child name field isname, whilerlm.list_subagents()returnsRLMSubagentobjects whose child name field issession_name. Neither type carried the other's attribute, anddelete_subagent()accepted onlystr | RLMSubagent, so the natural callawait rlm.delete_subagent(handle)on the handle just returned byrlm(...)raisedTypeError.This matters because the shipped system prompt teaches exactly the call that fails:
Reproduction
Confirmed live from the IPython kernel of a running prime-agent session, before the fix:
Changes
delete_subagent()acceptsRLMSpawnHandlein addition tostrandRLMSubagent, resolving the selector fromrlm_child_idexactly as it already does forRLMSubagent.RLMSpawnHandle.session_nameandRLMSubagent.nameadded as read-only aliases, so either spelling works on either type and both documented spellings become correct.rlmproxy method.Behavior for existing
strandRLMSubagenttargets is unchanged. TheTypeErrormessage now lists all three accepted types; the one existing assertion pinned to the old message was updated.Tests
Added
RlmSpawnHandleInteropTesttoprime-agent-runtime/test/test_subagent_registry.pycovering each symptom in the issue: thesession_namealias, thenamealias, both types agreeing on the same child,delete_subagentaccepting a handle, and handle/subagent resolving to an identical host selector.Full runtime suite goes from 64 to 69 tests. Two pre-existing
ModuleNotFoundError: No module named 'mcp'errors intest_mcp_base.pyare present identically on unmodifiedmainand are unrelated to this change.fixes #824
Note
Fix
delete_subagentto acceptRLMSpawnHandleand alignname/session_nameattributesdelete_subagentnow accepts anRLMSpawnHandle(the value returned byrlm(...)) in addition tostrandRLMSubagent, resolving it viarlm_child_id.RLMSpawnHandlegains asession_nameproperty aliasingname;RLMSubagentgains anameproperty aliasingsession_name, making the two types interchangeable for name lookups.RlmSpawnHandleInteropTestin test_subagent_registry.py covers the alias properties anddelete_subagentbehavior for spawn handles.Macroscope summarized f0b90d8.