Skip to content

Follow-up to #75: state.sessions, per-session calls, and frontierInjectedSessions remain unbounded; repokey re-declares SESSION_CAP #224

Closed

Description

@abogartz

Finding

#75 bounded the epoch/latestPrompt/sessionStats caches, but three ledgers that grow with work remain unbounded:

  • state.sessions: Map<string, SessionState> (src/state.ts:102) - session() inserts on first touch and never removes; each entry retains tool results, counters and recentQuerySigs for the process lifetime.
  • SessionState.calls: ToolResult[] (src/state.ts:29, appended at src/triggers.ts:51) - no cap.
  • frontierInjectedSessions: Set<string> (src/inject.ts:228, added at :320) - no bound.

Long-lived hosts (opencode serve, the desktop app) are exactly the ones that accumulate them. src/config.ts exposes no session-cap option. Separately, src/repokey.ts:93 re-declares const SESSION_CAP = 64 instead of importing src/sessions.ts:8, so the two can drift silently.

Fix direction

Put the sessions Map and the frontierInjectedSessions Set behind the existing SessionLru, cap or clear calls at turn end, and import the shared constant in src/repokey.ts.

Source

Architecture review 2026-10-31, finding R1 (Med) and O3.

Activity

  1. added
    bug
    severity:medium
    agent:ready
    on Nov 1, 2026
  2. ocsi-triager commented on Nov 3, 2026

    @ocsi-triager

    osi-spec-hash: 9edded2507dac33d 2026-11-03T22:16:14Z - acceptance criteria frozen at this text. A later edit to the body changes this hash, and the reviewer will withhold approval until a maintainer replies spec ok.

  3. added
    fix:working
    fix:pr-open
    and removed
    fix:working
    on Nov 4, 2026
  4. added
    spec:incomplete
    on Nov 4, 2026
  5. added a commit that references this issue on Nov 4, 2026
  6. abogartz-opencode-self-improvement commented on Nov 4, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.15.28 🎉

    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

    agent:readybugfix:pr-openreleasedseverity:mediumspec:incomplete

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions