Skip to content

bug(sdk/go): no system-level active gateway fallback; OPENSHELL_SYSTEM_GATEWAY_DIR ignored #4517

Open

Description

@CloneOfAlex

User Story

I use OpenShell and build automation against its SDKs. While reviewing sdk/ I hit this behavior and reproduced it with the minimal test below against main.

Problem Statement

The CLI falls back to the system active_gateway under /etc/openshell (or $OPENSHELL_SYSTEM_GATEWAY_DIR) when no user active_gateway exists, and honors that variable for the system gateways directory. The Go SDK reads only the user active_gateway and hardcodes /etc/openshell.

Impact / Why This Matters

On machines provisioned with system-level gateway config, gateway.NewClient("") fails with no active gateway although the CLI works, and an overridden system directory is invisible to the SDK.

Acceptance Criteria

  • The Go SDK resolves the active gateway and system gateways the same way as the CLI, including OPENSHELL_SYSTEM_GATEWAY_DIR.

Reproduction Steps

Set XDG_CONFIG_HOME to an empty dir and OPENSHELL_SYSTEM_GATEWAY_DIR to a dir containing gateways/corp/metadata.json and active_gateway = corp; gateway.LoadConfig("") fails.

Suggested UX (if applicable)

No response

Environment

  • OpenShell: main @ 82977e2 (2026-10-13)
  • SDK: Go (sdk/go/openshell/v1/gateway/paths.go)
  • Toolchain: Go 1.25.4 linux/amd64, Node 22

Logs

BUG: system active gateway not resolved: gateway: no active gateway

Activity

  1. added theissue type on Oct 13, 2026
  2. rhuss commented on Oct 14, 2026

    @rhuss
    Contributor

    📋 triage-agent

    Thanks for the report.

    Partially fixed on current main. Since #4106 (6e69360, merged after the commit you tested), systemConfigDir() in sdk/go/openshell/v1/gateway/paths.go honors OPENSHELL_SYSTEM_GATEWAY_DIR and ignores empty and relative values, matching the CLI.

    The active-gateway fallback is still missing. resolveActiveGateway() reads only the user active_gateway file, while the CLI's load_active_gateway() (crates/openshell-bootstrap/src/metadata.rs) falls back to <system dir>/active_gateway when the user file is absent. The CLI also skips an invalid user entry and falls back to the system one (load_active_gateway_ignores_invalid_user_name_and_falls_back_to_system), so the Go fix should match that too. Note that #4509 affects the same function: a host-derived system gateway name with dots would still be rejected after this fix.

    The remaining acceptance criterion is the active-gateway fallback. Next step: maintainer acceptance decision.

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

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions