Skip to content

capture: sid is bound via setCurrent then awaited — write-time identity races the live session #116

Closed

Description

@abogartz

Why this exists

#108 listed a second finding under "Also open" that #113 deliberately does not fix (correctly — it is a seam decision, not a cooldown fix):

captureSession binds the session with setCurrent and then awaits a model call before writing, while gateContext() and appendMemory's stamp resolve identity from the global current sid at write time. The idle path could already race this but only fired on a quiet session; a compaction fires mid-turn, so the window is open during live activity by construction. The honest fix is threading the sid into the write instead of mutating module state.

#113 says this "deserves its own thread" but no thread existed — merging #113 with Fixes #108 would close the issue and silently orphan the finding. This issue is that thread.

The decision to make

Thread sid through the capture write path (captureSession → gated write → stamp/attribution) instead of resolving identity from module-global "current session" at write time, or document why the global is safe.

Spun out of the #103 review (2026-10-25); recorded 2026-10-26 while reviewing #113 so the fix-closes-issue path cannot swallow it.

Activity

  1. added
    store-security
    on Oct 26, 2026
  2. WhollyMindless commented on Oct 26, 2026

    @WhollyMindless
    Contributor

    Taking this - it is our finding, so the framing carries over: the honest fix is threading sid through the capture write path (captureSession -> gated write -> stamp/attribution) rather than resolving identity from the module-global current session at write time. The global is defensible for paths that never await before writing; capture's whole shape is awaits, so it does not get to use it.

    Plan: red-first pin that makes a compaction capture land its write under a DIFFERENT session's stamp (two live sessions, one awaits a model call while the other goes active - deterministic via the harness seams, no wall-clock race), then thread the sid through and show the same pin green. setCurrent stays for the non-capture callers it legitimately serves.

  3. WhollyMindless commented on Oct 26, 2026

    @WhollyMindless
    Contributor

    Claimed and opened: #118 - fix threads the captured session's identity through GateContext.sessionID -> AppendMemoryInput.sessionID instead of reading getCurrent() back at persistence time. Red pin interleaves deterministically via a park seam in the model stub (blocked-under-hijacker's-evidence now, wrong repo stamp in the sibling timing shape - both caught while writing it); both threading arms individually kill-verified. Suite 490/0/5 + tsc clean.

  4. added 2 commits that reference this issue on Oct 26, 2026
  5. abogartz-opencode-self-improvement commented on Oct 26, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.14.6 🎉

    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

    releasedstore-security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions