Skip to content

fix: unify runtime path resolution for procd services#341

Open
stehdev wants to merge 1 commit intosipeed:mainfrom
stehdev:fix/procd-config-resolution
Open

fix: unify runtime path resolution for procd services#341
stehdev wants to merge 1 commit intosipeed:mainfrom
stehdev:fix/procd-config-resolution

Conversation

@stehdev
Copy link

@stehdev stehdev commented Feb 17, 2026

📝 Description

This PR fixes runtime config resolution for non-interactive environments (especially OpenWrt procd) where PicoClaw could silently fall back to defaults.

Problem Summary

In service contexts, config/auth/skills paths could diverge or resolve incorrectly:

  1. Config path lookup depended on home resolution assumptions.
  2. Missing config file path caused defaults to be returned before env overrides were applied.
  3. Auth store and global skills used separate hardcoded home-based assumptions.
  4. A global short -c flag would conflict with picoclaw cron add -c, so long-form handling is needed.

What this PR changes

  • Centralizes runtime path resolution for:
    • config path
    • auth path
    • global skills directory
  • Uses explicit precedence:
    • --config / PICOCLAW_CONFIG
    • PICOCLAW_HOME/config.json
    • fallback to ~/.picoclaw/config.json
  • Ensures env overrides are always parsed even when config file is missing.
  • Adds tests for:
    • global --config parsing behavior
    • resolver precedence
    • env-only config loading
    • auth/global path alignment behavior

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🔗 Linked Issue

No public issue for this change (internal investigation + OpenWrt repro).

📚 Technical Context (Skip for Docs)

  • Reference: N/A (no external/public issue URL)
  • Reasoning: procd and other non-interactive runtimes may not provide expected home context. Explicit runtime path precedence and unconditional env parsing remove ambiguity and make service behavior deterministic.

🧪 Test Environment & Hardware

  • Hardware: OpenWrt router (runtime validation) + local dev machine
  • OS: OpenWrt + macOS
  • Model/Provider: N/A for this fix (startup/path/env behavior)
  • Channels: N/A

📸 Proof of Work (Optional for Docs)

Click to view Logs/Screenshots
  • go test ./... passes on this branch.
  • Manual checks:
    • PICOCLAW_CONFIG=<custom-path> picoclaw status
    • PICOCLAW_HOME=<custom-home> picoclaw status
    • env-only behavior with missing config file validated.
  • OpenWrt procd startup validated by installing /usr/bin/picoclaw and running as service.

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

Centralize config/auth/global skills path derivation with PICOCLAW_CONFIG and PICOCLAW_HOME precedence so non-interactive OpenWrt services load the intended files. Always apply env overrides even when the config file is missing, and add tests for global --config parsing plus resolver precedence.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant