Skip to content

audit(C20): OpenCode native multi-session identity and project attribution #159

Closed

Description

@pablontiv

Audit lineage

Parent: #128

Cluster: C20
Audit IDs: F38
Reviewed HEAD: eeb9e8f2b0435ac07e3f00f91ea1eb24176df4b3
Priority: P2 (scope-specific proposed implementation priority, not a retroactive finding severity).

Evidence

Current observed problem

  • F38 — confirmed: SQL/record construction / ParsedFile return; isolated DB with s1/project-a and s2/project-b yields one ParsedFile with 3 records, Cwd empty and UUID empty; SQL scans sessionID but never uses it. project fallback uses database pathname. | Single-file record API drops native session ownership; project falls back to DB pathname. LoadToolSequences groups by source_path (queries.go:1079), not native session_id. No exact duplicate. | Introduce explicit per-record/session identity and project metadata or a multi-session parse contract before changing grouping; ingest native session directory and IDs, test two sessions/projects in one DB and stable UUIDs across mutations.

Expected contract / decision gate

Two sessions/projects in one source database remain distinct in list/search/sequences with stable proven native identities; updates preserve session ownership.

Decision/blocker: D16: per-record/session metadata versus multi-session reader API; no invented UUIDs or path-only grouping.

Scoped acceptance criteria

  • Two sessions/projects in one source database remain distinct in list/search/sequences with stable proven native identities.
  • updates preserve session ownership.

Required validation / smoke

Use current-HEAD source/LSP callers and narrowly affected behavior tests. Reproduce the linked report probes using /tmp fixtures with scrubbed HOME and BACKSCROLL_CONFIG_DIR; observe exit code, stdout/stderr and SQLite/file state, including negative controls. Tests must exercise behavior, not source-text assertions. Implementation must later pass the normal repository gate without weakening coverage; issue materialization itself runs no builds/tests.

Dependencies and duplicate reconciliation

All-state issue inventory is searched immediately before creation; related closed history is not proof that these current observations are fixed. True cross-batch overlaps are owned by this one cluster, not an issue per ID.

Non-goals / safety boundaries

Do not change native origin/identity evidence, reasoning privacy, tokenizer/echo eligibility, perennial retention, historical migrations, or owner/follower/remediation locking merely to deduplicate code. Do not alter #128–#136 closure/tracker state as part of implementation.

Activity

  1. added
    enhancementNew feature or request
    auditWork originating from a repository audit
    priority:P2Confirmed edge case or contract defect with workaround
    on Oct 13, 2026
  2. pablontiv commented on Oct 17, 2026

    @pablontiv
    OwnerAuthor

    Contexto y evidencia

    Derivado de #198 y pablontiv/homeserver#485. Fuente cotejada en main, HEAD f280884a359f88e0e71bef48d69b0a1052d6fa30. Las mediciones siguientes ya fueron ejecutadas en la investigación; este triage no ejecuta builds ni modifica el índice. Evidencia local (no adjunta ni pública): /tmp/backscroll-485-handoff/reports/. Solo se publican conteos, comandos y referencias de código.

    Evidencia adicional L6

    lim-uniform-metric.md:125-218: los 32.640 registros OpenCode comparten un único source_path y tienen UUID NULL. El parche/reingesta aislados recuperaron 429 sesiones nativas distintas, sin UUID NULL. No se publican identidades ni contenido.

    Cotejo actual: internal/readers/opencode_reader.go:176-183 construye texto sin UUID; :201-209 escanea sessionID sin preservarlo en los mensajes. Las líneas históricas de #159 se desplazaron por el snapshot hash: el defecto sigue en la construcción actual. Parche experimental: /tmp/backscroll-485-handoff/opencode-session-identity.patch; no es integración ni reemplaza la decisión de identidad/proyecto de este issue. La rama pablontiv/ingestion-policy ya contiene contrato de identidad nativa/V18, pero HEAD main inspeccionado mantiene el comportamiento anterior. Prueba esperada: varias sesiones en una fuente conservan identidad/atribución y no se colapsan al contar sesiones. Duplicado reconocido: este issue es el propietario, sin nuevo ticket.

  3. pablontiv commented on Oct 20, 2026

    @pablontiv
    OwnerAuthor

    Pregunta

    Preserve native OpenCode per-record session and cwd ownership in canonical storage and session-scoped consumers.

    BASIS

    Issue159 real two-session SQLite fixture and429-session experiment plus retained native commits demonstrate runtime behavior. Port only native identity onto current snapshot/project proof and bounded fingerprint replay, append new migration after shippedV18, preserve unknown expired history.

    REVIEW

    TriageReview159

  4. added a commit that references this issue on Oct 20, 2026
    e018eff
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

    auditWork originating from a repository auditenhancementNew feature or requestpriority:P2Confirmed edge case or contract defect with workaround

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions