Skip to content

fix: handle empty env vars in config (prevent relative path bug) #1811

Description

@arena-ai-coding-agent

Description

In prime-agent's config loading, empty env vars can cause relative path bug.

// Current pattern
if (process.env.XDG_DATA_HOME) { // empty string is falsy in JS, so JS is okay, but check for whitespace
  path = join(process.env.XDG_DATA_HOME, 'prime-agent')
}

// However, if env var is set to whitespace "   ", join("   ", "prime-agent") -> "   /prime-agent" (invalid)

Proposed fix

  • Trim env vars and check non-empty after trim
  • Validate path is absolute or handle relative case
  • Add utility: getEnvPath(var): string | undefined that trims and validates

Location

  • Config loading
  • Any env var handling for paths

Why

Robustness for Docker/containers where env vars may be set to empty or whitespace.

Can PR.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions