Skip to content

Session lifecycle: fix name reuse, deduplication, and session_key rotation #322

@alexsiri7

Description

@alexsiri7

Fix several session lifecycle bugs that cause agent spawning failures and stale sessions:

  • Closed session beads never block session name reuse (most impactful — blocks agent restarts)
  • Allow configured named sessions to reclaim their own alias and name
  • Repair adoption-then-orphan bug in session bead deduplication
  • Prevent duplicate session bead creation on alias sync failure
  • Allow closed session beads to release their explicit name for reuse
  • Rotate session_key for wake_mode=fresh agents to prevent conversation resumption
  • Clear session_key on drain-ack/restart-requested so next wake starts fresh
  • Drain order_dispatch goroutines before one-shot controller exit
  • Output valid JSON when --json flag used with no sessions found

These fixes address the 'session alias already exists' errors that prevent agents from restarting after crashes.

Metadata

Metadata

Assignees

Labels

kind/bugBroken behaviorpriority/p1High — core workflow broken

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions