Skip to content

fix(runtime): accept RLMSpawnHandle in delete_subagent and align name attributes - #854

Closed
sashankh wants to merge 2 commits into
PrimeIntellect-ai:mainfrom
sashankh:fix/824-rlm-spawn-handle-interop
Closed

fix(runtime): accept RLMSpawnHandle in delete_subagent and align name attributes#854
sashankh wants to merge 2 commits into
PrimeIntellect-ai:mainfrom
sashankh:fix/824-rlm-spawn-handle-interop

Conversation

@sashankh

@sashankh sashankh commented Aug 7, 2026

Copy link
Copy Markdown

Summary

rlm() returns an RLMSpawnHandle whose child name field is name, while rlm.list_subagents() returns RLMSubagent objects whose child name field is session_name. Neither type carried the other's attribute, and delete_subagent() accepted only str | RLMSubagent, so the natural call await rlm.delete_subagent(handle) on the handle just returned by rlm(...) raised TypeError.

This matters because the shipped system prompt teaches exactly the call that fails:

Delete a direct child explicitly with await rlm.delete_subagent(child) when it is no longer needed.

Reproduction

Confirmed live from the IPython kernel of a running prime-agent session, before the fix:

handle type: RLMSpawnHandle | .name = pi-arch
handle.session_name    -> AttributeError: 'RLMSpawnHandle' object has no attribute 'session_name'
delete_subagent(handle) -> TypeError: target must be str or RLMSubagent, got RLMSpawnHandle
registry type: RLMSubagent | .session_name = pi-arch
RLMSubagent.name       -> AttributeError: 'RLMSubagent' object has no attribute 'name'

Changes

  • delete_subagent() accepts RLMSpawnHandle in addition to str and RLMSubagent, 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 and both documented spellings become correct.
  • Type hints widened on both the module-level function and the rlm proxy method.

Behavior for existing str and RLMSubagent targets is unchanged. The TypeError message now lists all three accepted types; the one existing assertion pinned to the old message was updated.

Tests

Added RlmSpawnHandleInteropTest to prime-agent-runtime/test/test_subagent_registry.py covering each symptom in the issue: the session_name alias, the name alias, both types agreeing on the same child, delete_subagent accepting a handle, and handle/subagent resolving to an identical host selector.

$ uv run python -m unittest discover -s test -p 'test_subagent_registry.py'
Ran 15 tests in 0.009s
OK

Full runtime suite goes from 64 to 69 tests. Two pre-existing ModuleNotFoundError: No module named 'mcp' errors in test_mcp_base.py are present identically on unmodified main and are unrelated to this change.

fixes #824

Note

Fix delete_subagent to accept RLMSpawnHandle and align name/session_name attributes

  • delete_subagent now accepts an RLMSpawnHandle (the value returned by rlm(...)) in addition to str and RLMSubagent, resolving it via rlm_child_id.
  • RLMSpawnHandle gains a session_name property aliasing name; RLMSubagent gains a name property aliasing session_name, making the two types interchangeable for name lookups.
  • New test class RlmSpawnHandleInteropTest in test_subagent_registry.py covers the alias properties and delete_subagent behavior for spawn handles.

Macroscope summarized f0b90d8.

Sai Sashankh D added 2 commits August 7, 2026 19:06
… 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.
avion23 pushed a commit to avion23/prime-agent that referenced this pull request Aug 9, 2026

Copy link
Copy Markdown
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rlm] RLMSpawnHandle.name vs RLMSubagent.session_name: rlm.delete_subagent(handle) raises TypeError and RLMSubagent.name raises AttributeError

2 participants