Skip to content

mngr/fix-replaced-state#1026

Open
joshalbrecht wants to merge 6 commits intojosh/polish_mindsfrom
mngr/fix-replaced-state
Open

mngr/fix-replaced-state#1026
joshalbrecht wants to merge 6 commits intojosh/polish_mindsfrom
mngr/fix-replaced-state

Conversation

@joshalbrecht
Copy link
Copy Markdown
Contributor

Automated PR created by Claude Code session.

joshalbrecht and others added 6 commits March 28, 2026 09:29
… types

When an agent's type is not registered (e.g., created remotely by someone
with a plugin we don't have), we cannot determine the expected process name
for lifecycle state detection. Previously this resulted in REPLACED, which
is misleading since the agent may actually be running correctly -- we just
don't know what process to look for. The new RUNNING_UNKNOWN_AGENT_TYPE
state distinguishes this case from true replacement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Problem: The determine_lifecycle_state() call in ModalProviderInstance._build_single_agent_details()
did not pass the new is_agent_type_known parameter, so modal-hosted agents with unrecognized types
would still show as REPLACED instead of RUNNING_UNKNOWN_AGENT_TYPE.
Fix: Import check_agent_type_known and pass the result to determine_lifecycle_state(), matching
the pattern already used in base_agent.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lution

Problem: The parent_type resolution logic was duplicated verbatim between
resolve_expected_process_name and check_agent_type_known in hosts/common.py.
Fix: Extracted a shared _resolve_effective_agent_type helper function that
both functions now call, eliminating the duplication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Problem: check_agent_type_known in libs/mngr/imbue/mngr/hosts/common.py was
decorated with @pure, but it calls is_agent_class_registered which reads from
_agent_class_registry, a global mutable dictionary. This violates the @pure
contract that a function "returns the same output for the same inputs."

Fix: Removed the @pure decorator and added a comment explaining why it is not
marked pure. The decorator is advisory-only so this has no behavioral impact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Problem: test_check_agent_type_known_for_registered_type and
test_check_agent_type_known_for_custom_type_with_registered_parent call
register_agent_class() without resetting the global registry afterwards,
leaking state to subsequent tests.

Fix: Wrap both tests in try/finally blocks that call
reset_agent_class_registry(), matching the established pattern used in
agent_config_registry_test.py and mngr_claude_mind/plugin_test.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…coverage

Problem: The new check_agent_type_known call in _build_single_agent_details
added 2 uncovered lines, pushing mngr_modal coverage from 75.01% to 74.99%,
below the 75% threshold.
Fix: Added unit tests for _build_single_agent_details that exercise the
lifecycle state determination and the missing-id early return paths,
restoring coverage to 76.05%.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant