Skip to content

local_embedded: daemon ignores shell env — HINDSIGHT_API_LLM_API_KEY only works via config dict, error message is misleading #3253

Description

@fanaticalfishing

Bug Description

In local_embedded mode, DaemonEmbedManager.ensure_running() spawns the per-profile daemon detached, so env vars exported in the parent shell (e.g. HINDSIGHT_API_LLM_API_KEY) are not inherited. The only reliable way to pass the key is via the config dict (llm_api_key) passed to ensure_running.

Steps to Reproduce

  1. export HINDSIGHT_API_LLM_API_KEY= in the shell
  2. In Python: get_embed_manager().ensure_running(cfg, profile) for a profile with a queued reflect/mental-model job (cfg has no llm_api_key)
  3. Observe daemon log / startup result

Expected Behavior

The daemon inherits the parent process env (or, if the detached design is intentional, the error message names the missing config key rather than an env var that can never reach the daemon, and the local_embedded docs state the contract).

Actual Behavior

Daemon crashes at boot with "ValueError: LLM API key is required. Set HINDSIGHT_API_LLM_API_KEY environment variable." despite that env var being set in the parent shell, and ensure_running just times out (~178s). Profiles with no LLM call at boot start fine without the key, so the setup looks healthy until one profile fails — masking the cause.

Version

0.9.0 (hindsight-all / hindsight-api-slim / hindsight-embed; hermes-agent 0.19.0)

LLM Provider

OpenAI-compatible

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions