Skip to content

[Bug]: A session whose agent profile was deleted can never send again and cannot hand off its context #3810

Description

@Fclem

Summary

Deleting an agent profile while a task still has a session leaves that session permanently unusable. The composer then offers no agent/model selection, and sending a message records the message but fails the turn with Failed to send message to agent, marking the session FAILED; every later send fails identically and there is no in-session way to rebind the session to another profile. Adding another agent to the task does not recover the work either: the new session's Context selector offers only Blank and Copy initial prompt, with no way to seed from the failed session's context.

Affected area

Agent lifecycle

Kandev version

v0.94.1-nightly.sha57bbae10ad0f

Install mode

Other (npm global install running as a systemd --user service; KANDEV_INSTALL_KIND=npm, KANDEV_RUNNING_AS_SERVICE=true)

Environment

  • OS: Linux (kernel 7.0.0-30-generic), architecture amd64
  • Browser: Chrome/Chromium on the same host
  • Install: npm global package, systemd --user service, KANDEV_HOME_DIR=/home/clem/.kandev
  • No Docker or Kubernetes in the affected path (worktree executor on the host)

Kandev configuration

  • Executor type/profile: worktree executor, profile b2db8f32-4a2c-48b6-8e9b-4c183618d657 (exec-worktree)
  • Agent profile: OMP DS4 pro (omp-acp, model litellm-fi/deepseek-v4-pro), deleted on 2026-09-18 13:19:05Z
  • Repository source: GitHub clone of kdlbs/kandev, base branch main
  • Summarize utility agent: builtin-summarize-session is disabled (enabled = 0) on this instance
  • Relevant env vars: none beyond the defaults (KANDEV_FEATURES_* are all off); the deletion path does not look feature-gated

Task/session context

  • Workspace ID: 2bca24ab-c6c5-4b78-9671-2e3404fa9871 ("Improve Kandev")
  • Workflow/step: workflow 7ca5033f-f018-4b3b-ade6-10771f4aed48, step b273db91-70b0-4d43-b243-33d0e0398b83
  • Task ID: 20517a31-2c50-4b9c-b19a-b10c19cd59f8
  • Session ID: 55a60ef0-38ca-4638-8ff6-9f7364d36078
  • Branch/worktree: worktree executor, repository 6e5cf61c-f13c-4a3e-82fb-bb4fd59e0a8c, base branch main

Steps to reproduce

  1. Keep a task whose session runs on an agent profile (here: an omp-acp profile named OMP DS4 pro).
  2. In Settings > Agents, delete that profile while the task still has its session.
  3. Open the task's existing session. The composer shows no agent/model selection, because the session's profile no longer exists.
  4. Send any message (observed: rebase).
  5. The message is persisted, the turn fails with Failed to send message to agent, and the session state becomes FAILED. Sending again fails the same way.
  6. Add a new agent/session to the task: the Context selector offers only Blank and Copy initial prompt, so the failed session's context cannot be carried over.

Reproducibility

Always

Clean-state check

Not applicable (the failure needs an existing task whose session outlives the deletion of its agent profile)

Expected behavior

  • Continuing the session should let me choose another agent/model, or rebind the session to a replacement profile, and resume in place.
  • If resuming is impossible, the send should fail with an actionable error and an offered way to recreate or substitute the removed profile, instead of a dead session.
  • Adding an agent to the task should be able to seed the new session from the failed session's context, not only from the original prompt.

Actual behavior

The session is bricked. The composer has no agent/model to select, the send is accepted into the transcript and then fails, and the session stays FAILED with no recovery path in the UI. The new-session flow offers only Blank and Copy initial prompt, so the work in the failed session cannot be handed to a working agent.

Logs and artifacts

Session 55a60ef0-38ca-4638-8ff6-9f7364d36078 on task 20517a31-2c50-4b9c-b19a-b10c19cd59f8:

error_message: failed to resume session: failed to resolve agent profile:
               agent profile "OMP DS4 pro" (***) was removed
state:         FAILED

Timeline for the failing send (2026-09-18, UTC):

20:22:34.240  user message      "rebase"
20:22:34.227  turn started, never completed
20:22:34.522  agent error       "Failed to send message to agent"
20:22:34.498  session state     FAILED

No raw prompts, agent output, tokens, or repository credentials are included. The profile in question is soft-deleted (deleted_at set) rather than hard-deleted, and it no longer appears in the agent-profile list.

Last known good version

N/A

Extra context

Before submitting

  • I can reproduce this using the steps above.
  • I removed secrets, tokens, private repository URLs, private prompts, and customer data.
  • I searched existing issues and did not find a duplicate.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions