Skip to content

Alcove adapter: detect() rejects sessions with 'id' instead of 'session_id' #197

@decko

Description

@decko

Problem

The Alcove adapter's detect() method only matches files containing the string "session_id" in the first 4KB:

def detect(self, source: Path) -> bool:
    ...
    header = file_handle.read(DETECT_READ_SIZE)
    return '"session_id"' in header and '"transcript"' in header

The Alcove Bridge API returns sessions with "id" as the top-level identifier, not "session_id". When exporting sessions via alcove status <id> --full, the output looks like:

{
  "id": "12052e41-...",
  "transcript": [...]
}

The "session_id" string may appear deeper in the transcript (inside the system init entry), but if it's beyond the 4KB detection window, the session is skipped.

Similarly, load() accesses raw["session_id"] which raises KeyError for files that only have "id".

Impact

In testing with 92 exported Alcove sessions, 37 were skipped (40%) due to this detection mismatch.

Suggested fix

detect(): Accept either field:

return ('"session_id"' in header or '"id"' in header) and '"transcript"' in header

load(): Fall back from session_id to id:

session_id = raw.get("session_id") or raw["id"]

Related

This is separate from #176 (hardcoded rework_cycles/findings). That issue is about what happens after loading; this one is about sessions never being loaded at all.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions