Skip to content

fix: allow renaming an agent to its current name#619

Merged
jaberjaber23 merged 2 commits intoRightNow-AI:mainfrom
Fail-Safe:fix/agent-rename-same-name
Mar 15, 2026
Merged

fix: allow renaming an agent to its current name#619
jaberjaber23 merged 2 commits intoRightNow-AI:mainfrom
Fail-Safe:fix/agent-rename-same-name

Conversation

@Fail-Safe
Copy link
Contributor

Summary

  • Fixes AgentRegistry::update_name incorrectly rejecting a rename when the new name is the same as the current name

Problem

update_name checks name_index.contains_key(&new_name) before proceeding. Since an agent's current name is always in the index, renaming to the same name always hit the AgentAlreadyExists error path — even though no conflict exists.

This surfaces in the dashboard whenever a user edits an agent's name and saves without changing it (e.g. after editing another field in the same form), producing an unexpected error.

Fix

Check whether the name is owned by a different agent before erroring. If the same agent already owns the name, return Ok(()) immediately.

// Before
if self.name_index.contains_key(&new_name) {
    return Err(OpenFangError::AgentAlreadyExists(new_name));
}

// After
if let Some(existing_id) = self.name_index.get(&new_name).as_deref().copied() {
    if existing_id != id {
        return Err(OpenFangError::AgentAlreadyExists(new_name));
    }
    return Ok(());  // same agent — no-op
}

Test plan

  • Rename an agent to its current name — should succeed silently
  • Rename an agent to a name already used by a different agent — should still return AgentAlreadyExists
  • Rename an agent to a genuinely new name — should succeed and update the index

🤖 Generated with Claude Code

Fail-Safe and others added 2 commits March 14, 2026 15:34
Introduces a `release-fast` profile that inherits from `release` but
uses thin LTO and 8 codegen units instead of full LTO + 1, cutting
link time significantly while remaining fast enough for integration
testing. Documents usage in CONTRIBUTING.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AgentRegistry::update_name was calling name_index.contains_key()
without excluding the agent being renamed. Renaming to the same name
always returned AgentAlreadyExists instead of succeeding silently.

Fix: only error when a *different* agent owns the target name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jaberjaber23 jaberjaber23 merged commit 52647b2 into RightNow-AI:main Mar 15, 2026
8 of 11 checks passed
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.

2 participants