Skip to content

Machine attach local detach ends without a framed outcome #151

Description

@schickling-assistant

pty attach --attach-stream-fd-v1 currently closes the inherited machine stream without a terminal protocol outcome when its local user intentionally detaches with Ctrl+\. The command exits successfully, but a consumer sees the same EOF shape as a truncated stream.

An embedded terminal therefore cannot make the correct downstream decision: intentional detach should preserve the session and close the view cleanly, while transport truncation must fail or reconnect because terminal state may be incomplete. Treating both as the same EOF either reports normal user actions as corruption or silently accepts real data loss.

Reproduction

https://github.com/schickling-repros/2026-07-pty-machine-detach-outcome

./repro.sh

The repro uses a real detached session and the shipped bin/pty launcher at exact revision d5fabc3917407aeb937a012bd97679c303e18033.

Expected

The ordered machine stream ends with exactly one framed outcome:

  • empty existing DETACH (type 2) for intentional local detach, including detach before the initial baseline; or
  • EXIT (type 4) when the session process ends.

EOF after either outcome is clean. EOF without either outcome remains truncation.

Actual

The command exits 0 but fd 3 contains only GEOMETRY, SCREEN (types 10, 5) before EOF.

Proposed fix: #146

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
agent_tool Codex CLI
agent_tool_version 0.145.0
agent_runtime Codex CLI 0.145.0
agent_model unknown
runtime_profile /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
skills_manifest /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
worktree pty/schickling-assistant/2026-07-31-machine-detach-outcome
machine dev3
tooling_profile dotfiles@0fb7e03

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions