Skip to content

Bug: daemon falsely marks opencode sessions as stopped within seconds of launch #146

@c-h-

Description

@c-h-

Problem

The daemon marks opencode sessions as stopped within seconds of launch, even though the actual opencode processes run for 20+ minutes and complete their work (opening PRs, etc.). This means:

  1. No webhook is fired (or fired prematurely when the session hasn't done anything yet)
  2. The supervisor SOP never triggers for real coding sessions
  3. The lifecycle fuse (feat: three-prong session lifecycle fuse for opencode adapter #144) doesn't prevent this false detection

Evidence

Two sessions launched on 2026-03-12 at ~9:21 PM PT:

Session Started Stopped (daemon) Actual runtime Result
d7b63b65 04:21:44 UTC 04:21:54 UTC (10s) ~20 min PR #9271 opened
3c623816 04:21:52 UTC 04:21:54 UTC (2s) ~20 min PR #9272 opened

Both marked stopped at the exact same timestamp (04:21:54.644Z), suggesting a batch cleanup/poll false positive rather than individual fuse detection.

No exitCode recorded. No webhooks received by OrgLoop. Supervisor never fired.

Meanwhile, the e2e test sessions (trivial 'echo hello world' prompts) correctly triggered the full webhook → supervisor chain. Those sessions genuinely completed in seconds.

Expected Behavior

The three-prong fuse should:

  1. Monitor the exit file for the opencode session
  2. Poll PID liveness (kill(pid, 0))
  3. Master timeout as safety net

Only fire session.stopped when one of these signals confirms the session is actually done.

Daemon Context

Daemon PID: 13604, restarted at 21:13 PT (8 min before these launches). Running latest code with #144 (lifecycle fuse) merged.

agentctl status <id> showed stopped correctly, and agentctl list -a doesn't show these sessions at all (pruned from the listing but present in state.json).

Related

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