Skip to content

config: share and enterprise are accepted, normalised, and read by nothing #57932

Open

Description

@oke3

Description

share and enterprise are both accepted by the v2 config schema, normalised, and then read by nothing. A user who sets either gets no behaviour and no warning.

share is the clearer one, because it still has a migration path:

// packages/core/src/config/normalize.ts:79-99
const legacyShare = own(input, "autoshare")
  ? decodeValue(Schema.Boolean, input.autoshare, ["autoshare"], diagnostics) === true
    ? "auto"
    : "manual"
  : undefined
if (legacyShare !== undefined) encoded.share = legacyShare

so a v1 autoshare: true is still migrated into share: "auto" — into a field nothing reads. The session sharing backend was retired in #55716 ("chore: retire session sharing backend"), and the config key was left behind.

The full set of references in the repository:

  • packages/schema/src/config.ts:42 — the schema field itself ("manual" | "auto" | "disabled")
  • packages/core/src/config/normalize.ts:79-99 — the legacy autoshare migration
  • packages/core/src/config/normalize.ts:210 — the field being passed through the normaliser
  • packages/schema/src/config.ts:45 / normalize.ts:211 — the same three for enterprise ({ url })

Nothing else. A grep across packages/ for config.share, config.enterprise and enterprise?.url returns nothing.

Neither key appears in the config reference, which is fortunate rather than by design — documenting them would be documenting a ghost.

Two ways this could go, and I am not sure which is intended:

  1. Remove them from the schema (and drop the autoshare migration), so the config surface matches what the CLI does.
  2. Wire them up — share reads naturally as "allow/deny session sharing", and enterprise.url as the sharing service endpoint.

Whichever it is, the current state is the worst of both: a user can set these, the config validates, and nothing happens.

Steps to reproduce

  1. Add "share": "auto" to opencode.json.
  2. Start opencode — no warning, no error, and the setting has no effect.
  3. Same for "enterprise": { "url": "https://example.com" }.

OpenCode version

dev (checked at a7a508b8).

Activity

  1. changed the title [-]config: and are accepted, normalised, and read by nothing[/-] [+]config: share and enterprise are accepted, normalised, and read by nothing[/+] on Oct 21, 2026
  2. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report. I can confirm this on @opencode/cli 2.1.2 and on the latest dev (e441dafb).

    • On 2.1.2, putting "share": "auto", "autoshare": true and "enterprise": { "url": "https://example.com" } in opencode.json and running opencode debug config resolves to { share: "auto", enterprise: { url: … } } with no warning.
    • On dev, ConfigNormalize.normalize returns the same result with empty diagnostics, and autoshare: true is still migrated to share: "auto".
    • No runtime code reads either key. Session sharing itself was removed in chore: retire session sharing backend #55716 and fix(opencode): discontinue session sharing #55718, but the schema still describes share as controlling it.

    Related: #55716 (retired the sharing backend and marked the session.share keybinds as deprecated rather than removing them) and #55718 (the v1 equivalent). Whether to deprecate these keys with a warning or remove them is up to the maintainers. The script below reproduces it.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Repro for #57932: `share`, `autoshare` and `enterprise` validate silently but nothing reads them.
    # Usage: ./repro.sh            (uses `opencode` on PATH)
    #        OC_DEV=/path/to/checkout ./repro.sh   (runs from source)
    set -u
    P=$(mktemp -d); cd "$P"; git init -q
    cat > opencode.json <<'J'
    {
      "$schema": "https://opencode.ai/config.json",
      "share": "auto",
      "autoshare": true,
      "enterprise": { "url": "https://example.com" }
    }
    J
    if [ -n "${OC_DEV:-}" ]; then
      oc() { bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js" "$OC_DEV/packages/cli/src/index.ts" "$@"; }
    else oc() { opencode "$@"; }; fi
    echo "== version"; oc --version
    echo "== debug config (look for diagnostics/warnings)"; oc debug config 2>&1
    echo "== control: an unknown key, for comparison"
    mkdir -p ctl && echo '{ "notARealKey": 1 }' > ctl/opencode.json && (cd ctl && git init -q && oc debug config 2>&1 | tail -15)
    echo "== /share command in v2?"; oc run --help 2>&1 | grep -i share || echo "(no share flag)"
    if [ -n "${OC_DEV:-}" ]; then
      echo "== ConfigNormalize.normalize on the checkout (diagnostics should be empty if the bug is present)"
      cat > "$OC_DEV/packages/core/.repro-57932.ts" <<'TS'
    import { normalize } from "./src/config/normalize.ts"
    console.log(JSON.stringify(normalize({ share: "auto", enterprise: { url: "https://example.com" } })))
    console.log(JSON.stringify(normalize({ autoshare: true })))
    TS
      (cd "$OC_DEV/packages/core" && bun run ./.repro-57932.ts); rm -f "$OC_DEV/packages/core/.repro-57932.ts"
      echo "== runtime readers of share/enterprise in $OC_DEV/packages (excluding config schema/normalize/tests, console, stats):"
      grep -rnE "\.share\b|\.enterprise\b|enterprise\??\.url" "$OC_DEV/packages" --include=*.ts --include=*.tsx \
        | grep -v node_modules | grep -vE "packages/(console|stats|function)/|/test/|config/normalize.ts|schema/src/config.ts" || echo "(none)"
    fi

    Run it: bash repro.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions