Skip to content

fix(launcher): resolve gateway startup issue in tui mode#1720

Open
darrenzeng2025 wants to merge 1 commit intosipeed:mainfrom
darrenzeng2025:fix/1704-launcher-tui-gateway
Open

fix(launcher): resolve gateway startup issue in tui mode#1720
darrenzeng2025 wants to merge 1 commit intosipeed:mainfrom
darrenzeng2025:fix/1704-launcher-tui-gateway

Conversation

@darrenzeng2025
Copy link
Contributor

Fixes #1704

Problem

The picoclaw-launcher-tui was not respecting PICOCLAW_HOME and PICOCLAW_CONFIG environment variables when determining the config file path. This caused a configuration mismatch between the TUI and the gateway command when these environment variables were set.

Root Cause

  • TUI launcher used hardcoded ~/.picoclaw/config.json path
  • Gateway command supported PICOCLAW_HOME and PICOCLAW_CONFIG environment variables
  • When users set these environment variables, TUI saved config to one location but gateway read from another

Solution

  • Updated ConfigPath() to check PICOCLAW_CONFIG environment variable first
  • Updated ConfigDir() to check PICOCLAW_HOME environment variable first
  • Added comprehensive unit tests for both functions
  • Added documentation comments explaining the priority order

Priority Order (consistent with gateway command)

  1. PICOCLAW_CONFIG - direct config file path
  2. PICOCLAW_HOME - custom config directory
  3. Default: ~/.picoclaw/config.json

Testing

  • Added unit tests covering all environment variable combinations
  • Verified priority order works correctly
  • Tests pass on both Unix and Windows platforms

Files Changed

  • cmd/picoclaw-launcher-tui/internal/config/store.go - Fixed config path resolution
  • cmd/picoclaw-launcher-tui/internal/config/store_test.go - Added unit tests

The picoclaw-launcher-tui was not respecting PICOCLAW_HOME and PICOCLAW_CONFIG
environment variables when determining the config file path. This caused a
configuration mismatch between the TUI and the gateway command when these
environment variables were set.

Changes:
- Updated ConfigPath() to check PICOCLAW_CONFIG environment variable first
- Updated ConfigDir() to check PICOCLAW_HOME environment variable first
- Added comprehensive unit tests for both functions
- Added documentation comments explaining the priority order

This ensures that launcher-tui and gateway command use the same config file
path resolution logic, fixing the issue where gateway could not start from TUI.

Fixes sipeed#1704
@sipeed-bot sipeed-bot bot added type: bug Something isn't working domain: config labels Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: config type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]After running picoclaw-launcher-tui, I am unable to start gateway or start talk.

1 participant