Skip to content

Daemon-replace path can kill the calling command: zero-action runs after 'Replacing daemon … unreachable' + SESSION_NOT_FOUND #1596

Description

@thymikee

Observed in the AppControlBench Element re-analysis (0.17.6 transcripts): three gpt_high runs (element-17, element-20, element-29) died with zero or near-zero agent actions immediately after this pair:

Replacing daemon (pid 72475, v0.17.6) in /Users/…/.agent-device/…: unreachable
Error (SESSION_NOT_FOUND): iOS snapshot requires an active app session on the target device.

The opencode transcript then ends with a zero-token step_finish reason:"other" — the driving process stopped mid-task with no further tool calls, no final message. element-17 died at 6 tool calls / 16.3s, element-20 at 4 calls / 10.0s (before ever calling open), element-29 got further but hit the same zero-token cutoff mid-task.

Two candidate mechanisms to investigate:

  1. The daemon replace/takeover path (unreachable daemon → replace) leaves the CLI hanging or exiting in a way that kills/wedges the calling shell's process group.
  2. SESSION_NOT_FOUND immediately after a replace is expected (fresh daemon has no sessions), but the combination may be emitted in a way that crashes the caller rather than returning the error.

Wanted: root cause + regression test. The fix should guarantee that a daemon replacement during a command returns a normal structured error (with a hint to open first) and never terminates or wedges the invoking process.

Evidence transcripts: AppControlBench data gpt_high__agent-device/element-{17,20,29}/transcript.jsonl.

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