Skip to content

"What's new" shown every startup in sandbox / fresh install where state file doesn't exist #99

Description

@HaleTom

Problem

Every time opencode launches in a sandboxed or ephemeral environment (Docker, CI, disposable dev container, OpenCode Desktop sandbox), the "what's new" announcement dialog is shown on every startup.

The state directory (~/.local/share/cortexkit/magic-context/) is writable — the issue is that the last_announced_version state file simply doesn't exist at the start of the session. The sandbox's filesystem is ephemeral and does not persist between launches.

Root cause

packages/plugin/src/shared/announcement.ts:

shouldShowAnnouncement() (line 87): calls readLastAnnouncedVersion(), which returns "" when the file doesn't exist. Since "" !== "0.21.7", the announcement always shows.

markAnnouncementSeen() (line 72): does write the file successfully during the session — but the file is wiped with the sandbox on next launch, so it's back to "" next time.

Sandbox startup (empty state)
  → readLastAnnouncedVersion() → ""  (file doesn't exist)
  → "" !== "0.21.7" → true
  → shows "what's new" dialog
  → markAnnouncementSeen("0.21.7")  → writes file (wiped next session)
  → Next startup: repeat forever

Additional concern: new users

A user seeing Magic Context for the first time (fresh install, no state file ever) is shown a list of minor patch-release bullet points they have no context to interpret. This is confusing and provides no value — a new user needs onboarding, not changelogs.

Proposed fix

shouldShowAnnouncement() should differentiate between "user has seen a previous announcement" and "no state file exists at all (fresh install or sandbox)":

export function shouldShowAnnouncement(): boolean {
    if (!ANNOUNCEMENT_VERSION || ANNOUNCEMENT_FEATURES.length === 0) return false;
    const lastVersion = readLastAnnouncedVersion();
    // No previous state at all → fresh install or ephemeral sandbox.
    // Don't pester new users with changelogs they have no context for.
    if (!lastVersion) return false;
    return lastVersion !== ANNOUNCEMENT_VERSION;
}

This way:

  • Fresh install / sandbox: ""false → no dialog (new user doesn't see irrelevant changelog)
  • Existing user with persisted state: version mismatch check as before (upgrade notes work normally)
  • Announcement shown during session: markAnnouncementSeen writes the version, suppressing it for the remainder of the session

Environment

  • Plugin version: 0.21.7+
  • File: packages/plugin/src/shared/announcement.ts
  • State path: ~/.local/share/cortexkit/magic-context/last_announced_version

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpluginOpenCode plugin (packages/plugin)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions