Skip to content

bug(attach): validate target session before writing active pointer #9

@pinion05

Description

@pinion05

Summary

agentty attach writes the requested session id as the active pointer without validating that the session exists or is currently running.

Why this is a problem

The command can succeed even when the target session is missing or already exited. The actual failure only appears later on get, text, key, or kill.

Impact

  • Misleading CLI UX: attach appears successful when it is not.
  • Broken active-session pointers that need later cleanup.
  • More confusing failure mode for both humans and agents.

Suggested direction

  • Validate that the target session exists and is running during attach.
  • Consider applying the same validation policy to explicit --session resolution paths.
  • Add tests for attaching nonexistent and exited sessions.

Relevant code

  • src/resolveSession.ts#attachSession
  • src/resolveSession.ts#resolveTargetSessionId
  • src/index.ts#attach

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