You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(sdk/go): no system-level active gateway fallback; OPENSHELL_SYSTEM_GATEWAY_DIR ignored #4517
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.
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.
Activity
rhuss commentedon Oct 14, 2026
Thanks for the report.
Partially fixed on current
main. Since #4106 (6e69360, merged after the commit you tested),systemConfigDir()insdk/go/openshell/v1/gateway/paths.gohonorsOPENSHELL_SYSTEM_GATEWAY_DIRand ignores empty and relative values, matching the CLI.The active-gateway fallback is still missing.
resolveActiveGateway()reads only the useractive_gatewayfile, while the CLI'sload_active_gateway()(crates/openshell-bootstrap/src/metadata.rs) falls back to<system dir>/active_gatewaywhen 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.