Skip to content

fix(agent-console): preserve Devin start name and refresh delayed session preview #398

Open

Description

@codeaholicguy

Summary

Starting an interactive Devin agent from agent console with a custom name can produce two related failures:

  1. The agent is permanently stored and displayed as ai-devkit-<pid> instead of the requested name.
  2. The live session preview remains unavailable even after chatting with Devin; restarting the console makes the conversation appear, but the generated name remains.

The process starts successfully. The failure is a race between daemon discovery, managed-start registry persistence, and Devin's delayed session creation.

Reproduction

  1. Open ai-devkit agent console with the daemon enabled.
  2. Open the start-agent pane.
  3. Choose Devin, enter a custom name, and submit.
  4. Chat with the new Devin agent.
  5. Observe the agent list and preview.
  6. Stop and reopen the console.

Actual behavior

  • Immediately after start, the list shows ai-devkit-<pid>, not the submitted name.
  • The preview reports no session/conversation while the console remains open.
  • After restarting the console, the preview contains the existing conversation, but the name is still ai-devkit-<pid>.
  • agent detail after restart returns the full Devin conversation, confirming that the session data itself is valid.

Expected behavior

  • The requested name is authoritative for a successfully managed start and persists across refreshes/restarts.
  • Once Devin creates its session and conversation rows, the open console discovers the session and renders preview messages without requiring a restart.

Confirmed timing

In the reproduced run:

  • The daemon first observed the Devin process and the registry fallback row was created at effectively the same instant.
  • The fallback row used ai-devkit-<pid> with no session id/path.
  • Devin's session row and lock appeared about 13 seconds later.
  • A later fresh list populated the session id/path and made four existing conversation messages readable, while the generated name remained persisted.

Root cause 1: requested name loses to daemon fallback registration

The console starts an agent through a child CLI process. As soon as the Devin process appears, the daemon emits agent.appeared, causing the parent console to refresh before the child agent start command finishes registration.

That refresh registers the daemon's generated ai-devkit-<pid> identity first. When managed start later calls AgentRegistry.register() with the requested name, mergeEntry() unconditionally preserves existing.name. The generated fallback therefore wins over the explicit managed-start name and remains in agents.db.

Relevant paths:

  • packages/cli/src/tui/console/hooks/useStartAgentPane.ts
  • packages/agent-manager/src/runtime/ManagedAgentRuntime.ts
  • packages/agent-manager/src/AgentManager.ts
  • packages/agent-manager/src/utils/AgentRegistry.ts

Root cause 2: delayed Devin attribution does not refresh the subscribed console

The initial daemon event describes a process-only Devin agent because the Devin session DB row/lock does not exist yet. The daemon enriches its cache on later sweeps, but it only emits lifecycle events for appeared/disappeared PIDs—not when an existing PID gains sessionId or sessionFilePath.

After a daemon subscription succeeds, useAgentList relaxes normal polling to a 60-second fallback. The immediate post-start refresh() also occurs before Devin creates the session (and can be dropped if another refresh is already in flight). useAgentConversation therefore keeps receiving an agent object without sessionFilePath and cannot read the conversation. Restarting the console forces a fresh list and resolves the session.

Relevant paths:

  • rust/crates/devkitd/src/server.rs
  • packages/cli/src/tui/console/hooks/useAgentList.ts
  • packages/cli/src/tui/console/hooks/useAgentConversation.ts
  • packages/agent-manager/src/harnesses/devin/DevinAdapter.ts

Suggested direction

Preserve the managed name

Add an authoritative managed-start registration/claim operation keyed by (type, pid) that may replace a known generated fallback name, while still preserving genuine user renames. Alternatively, reserve the requested name before process discovery and bind it to the PID after launch.

Regression coverage should reproduce this order:

  1. discovery registers ai-devkit-<pid>;
  2. managed start registers the requested name for the same type/PID;
  3. the final row and returned list use the requested name.

Refresh delayed session attribution

Emit an update event when an existing process gains or changes enriched session identity/path, or temporarily fast-poll the newly started agent until its session attribution is available. Manual refresh requests should also coalesce behind an in-flight refresh rather than being silently discarded.

Regression coverage should model a Devin process appearing first and its session row/lock appearing later, then verify that the already-open console receives the session path and preview without remounting.

Environment

  • AI DevKit 0.70.1
  • macOS ARM64
  • Interactive Devin agent started from agent console
  • Daemon subscription enabled

Related

Activity

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