Skip to content

Auto-capture is silently dead on opencode 2.x: session.idle envelope read misses event.data #78

Closed

Description

@abogartz

Part of #82.

The bug. Auto-capture subscribes to the event bus and filters session.idle, then reads the session ID as:

// src/index.ts:899 (main)
const sid = event.sessionID ?? event.properties?.sessionID;
if (typeof sid !== "string") continue;

On opencode 2.x the bus envelope carries the payload under event.data, not event.properties. The identity handler in the same file already handles both shapes — which is only there because 2.x delivered session.created without properties:

// src/index.ts:828 (main)
const d = ev.data ?? ev.properties ?? {};

So on a real 2.x host every session.idle hits the typeof sid !== "string" guard and continues: the capture model is never called, no auto_capture_* evidence rows are ever written, and the feature is silently dead — with no error anywhere. The live store's entire history contains zero auto_capture_* rows, consistent with this (auto-capture was also off in that config, so that is corroboration, not proof; the envelope analysis is the proof).

Scope. Pre-existing on main, affects every published version since auto-capture shipped; only opt-in installs that turned it on are affected — and they would believe it works because it is silent. Found while verifying the question raised in #67 (author: on a fake 2.x host capture made 0 model calls — correct).

Fix. Same defensive envelope read as the identity handler:

const sid = event.sessionID ?? event.properties?.sessionID ?? event.data?.sessionID;

Test. A fake 2.x-shape host (payload under event.data.sessionID) asserting the capture model gets called — the existing capture tests use the 1.x properties shape and therefore pass while the real feature is dead. Consider auditing the other event?.sessionID reads on the bus path (the message.updated measured handler already reads both) while in here.

Activity

  1. added
    bug
    capture
    on Oct 24, 2026
  2. abogartz-opencode-self-improvement commented on Oct 24, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.8.9 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

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

    bugcapturereleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions