Skip to content

[FEATURE]: Session heartbeat for multi-session liveness detection #27759

Closed as not planned

Description

@MaximKh

Feature has not been suggested before.

  • I have verified this feature I am about to request has not been suggested before.

Describe the enhancement you want to request

OpenCode advertises multi-session ("Start multiple agents in parallel on the same project") but provides no way for sessions to detect each other. If a parallel session crashes or hangs, its resources (temp dirs, ports, files) are never released, and other sessions have no way to know.

Add two fields to the existing session table:

  • heartbeat_at — timestamp, written every 30s while session is alive
  • peer_id — unique per process, survives session restarts

Extend the existing compaction/prune to skip sessions with heartbeat_at older than 5 min as stale.

Why core: multi-session is a public feature, but without heartbeat it is unsafe. External modules (MCP, SLM) can read the DB for coordination; core just tracks liveness.

Scope: ~10 lines across 3 existing files (session/schema.ts, session/lifecycle.ts, session/compaction.ts). No new tables, no new config, no new dependencies.

Activity

  1. github-actions commented on May 15, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. MaximKh commented on May 15, 2026

    @MaximKh
    Author

    This is not a duplicate — #27742 was auto-closed for title format (missing [FEATURE]: prefix). This is the corrected version with the proper title format. Please reopen #27742 or keep this one. Thank you.

  3. prassanna-ravishankar commented on Jun 21, 2026

    @prassanna-ravishankar

    this is the exact problem i ended up solving in repowire, and the heartbeat_at + peer_id shape you propose is almost the same design i landed on, so a couple of notes from running it:

    • keying on a stable peer_id rather than a path/name is the right call. parallel sessions on the same project collide on anything path-derived, so liveness and routing both need the id
    • on the heartbeat: i deliberately avoided a polling timer. instead liveness is reconciled lazily, when a request next needs the registry it runs a repair pass and evicts stale peers. nothing runs on a schedule, the work piggybacks on real requests. cheaper, and no background loop to babysit

    the crashed-session-leaks-resources case is real and ghost eviction handles it well once you have the id + a reconciliation trigger. happy to share specifics if useful, this is squarely the thing the daemon does.

  4. github-actions commented on Aug 20, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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