Skip to content

bug: config-file telemetry opt-out is bypassed on the main thread (Config.get() unavailable before Instance) #1296

Description

@anandgupta42

Found during the v0.11.1 release review (Chaos Gremlin / privacy persona). Deferred because: needs a design decision on how doInit() should read the user's global config without an Instance.

Problem. Telemetry.doInit() (packages/opencode/src/altimate/telemetry/index.ts) reads telemetry.disabled through Config.get(), which throws outside an Instance context. On failure it proceeds as enabled. The CLI middleware in packages/opencode/src/index.ts calls Telemetry.init() before Instance.provide(), so on the main thread a config-file opt-out ("telemetry": {"disabled": true} in the global altimate-code.json) is not honored for main-thread events (onboarding, first_launch, startup_ready, main-thread event_loop_stall). Only the env-var opt-out (ALTIMATE_TELEMETRY_DISABLED / OPENCODE_DISABLE_TELEMETRY) is reliable there.

v0.11.1 fixed the same bypass on the TUI worker (init moved inside Instance.restore), but the main-thread path is pre-existing and remains.

Also missing: no test anywhere exercises the config-file opt-out; only the env vars are tested (test/telemetry/telemetry.test.ts).

Suggested fix. When Config.get() throws, fall back to reading the global config files under Global.Path.config directly (same list config.ts merges) for the single telemetry.disabled key, and add a test that a config-file opt-out disables telemetry both inside and outside an Instance.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions