Skip to content

M2 decision: OpenCodeClientOptions.Password semantics — unset vs empty vs whitespace (C16) #20

Closed

Description

@Blind-Striker

Source: multi-agent review of PR #16, UNVERIFIED-FINDER (verify while fixing). 2026-08-13. M-anchor: M2 (decide before breadth multiplies public options). Maintainer decision required — public API semantics.

Pipeline resolves the explicit option through string.IsNullOrEmpty(password) and suppresses auth through the same predicate (src/OpenCode.Sdk/Internal/Pipeline.cs:33-38). Consequences: whitespace-only " " bypasses the OPENCODE_SERVER_PASSWORD env fallback and is sent as a real Basic password; Password = "" is indistinguishable from unset, so an explicitly empty password cannot be represented. OpenCodeClientOptions.Password docs say only "When unset" (OpenCodeClientOptions.cs:13-18).

Recommendation: null = unset (env fallback); "" and whitespace-only = ArgumentException (fail loudly — the server always generates a password, pair always prints one; an "explicitly empty password" mode does not exist upstream, so we should not invent semantics for it). Document the property accordingly. Alternative if upstream ever supports passwordless serve: "" = explicit no-auth; that door stays open as an additive change.

Activity

  1. Blind-Striker commented on Aug 14, 2026

    @Blind-Striker
    CollaboratorAuthor

    Sealed and landed on feature/m2-first-breadth-batch @ 2be2d0f: null = unset (OPENCODE_SERVER_PASSWORD fallback); empty or whitespace-only refused with ArgumentException at construction — the server always generates a password, so an explicitly blank credential has no upstream meaning to model. The "" = explicit no-auth door stays available as an additive change if upstream ever ships passwordless serve. Covered by PipelineTests (blank variants refused before any request; null keeps the once-at-construction env resolution).

  2. Blind-Striker commented on Aug 14, 2026

    @Blind-Striker
    CollaboratorAuthor

    Follow-up (2026-08-14, research log Session 22 / Q89–Q90): the environment-fallback half of this decision is revised on new upstream evidence — the v2 client library reads no environment (the CLI consumer resolves OPENCODE_PASSWORD → OPENCODE_SERVER_PASSWORD and passes the value in), so the SDK's OPENCODE_SERVER_PASSWORD fallback was removed in a0c83a9; consumers resolve the environment themselves (or bind it via configuration in the Extensions package). The blank-refusal half of this decision stands unchanged; Password = null now plainly means anonymous requests, matching v2's optional auth.

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

    needs-triageMaintainer needs to evaluate this issueready-for-humanRequires human implementation or decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions