Skip to content

fix(cli): refresh agent console list after rename #374

Closed

Description

@codeaholicguy

Summary

Renaming an agent from ai-devkit agent console reports success, but the agent list keeps showing the old name instead of updating immediately.

This became especially visible after the daemon event stream was added: once the console subscribes successfully, its normal 3-second poll is replaced by a 60-second fallback poll. A rename only updates the local registry and does not emit a daemon lifecycle event, so there is nothing to trigger an immediate list refresh.

Reproduction

  1. Start an agent and open ai-devkit agent console while devkitd is available.
  2. Select the agent and press r.
  3. Change its name and submit.
  4. Observe the success message and return to the preview pane.

Actual behavior

  • The success message says the agent was renamed.
  • The left-hand agent list continues to show the old name.
  • The list may remain stale until the 60-second safety-net poll runs.
  • When the refresh eventually arrives, selection can fall back because selectedName still contains the old name.

Expected behavior

After a successful rename, the console should immediately refresh the agent list and keep the renamed agent selected under its new name.

Root cause

packages/cli/src/tui/console/hooks/useRenameAgentPane.ts handles a successful rename by closing the pane and showing a transient message, but it does not receive or call the console's refresh() function and does not update selection.

packages/cli/src/tui/console/hooks/useAgentList.ts changes the polling interval from LIST_POLL_INTERVAL_MS (3 seconds) to LIST_FALLBACK_INTERVAL_MS (60 seconds) after the daemon subscription succeeds. The child process used by runAction({ type: "rename" }) writes the SQLite registry directly; that registry-only mutation does not produce a daemon event.

The start-agent flow already demonstrates the intended pattern in useStartAgentPane.ts: after success it awaits refresh() and then selects the newly created agent.

This is a regression in perceived responsiveness exposed by the daemon subscription change in #352. The original rename implementation deliberately relied on the next poll, but that poll is no longer frequent when the daemon is connected.

Suggested fix

Pass refresh and a selection callback into useRenameAgentPane. On successful rename:

  1. Close the rename pane and show the success message.
  2. await refresh().
  3. Select values.newName so the preview remains attached to the same agent.

The order can mirror useStartAgentPane.

Acceptance criteria

  • A successful console rename refreshes the visible list without waiting for a poll or daemon event.
  • The renamed agent remains selected under the new name.
  • A failed rename does not refresh or change selection and keeps the inline error behavior.
  • Add hook/integration coverage proving refresh() and selection happen only after a successful rename.
  • Behavior works both with and without an active daemon subscription.

Environment

  • Branch: main
  • Revision investigated: de852a64
  • Package version: 0.70.0
  • Node.js: v26.7.0
  • Platform: macOS

Activity

  1. added a commit that references this issue on Oct 14, 2026
    9258b69
  2. added a commit that references this issue on Oct 14, 2026
    9eae9bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions