Skip to content

ISSUE_251107_coaia_tash_fetch.md #55

@jgwill

Description

@jgwill

Issue: coaia tash and coaia fetch commands failing with Redis authentication error

Problem Description

The coaia tash and coaia fetch commands are currently failing to execute successfully, returning an "invalid username-password pair or user is disabled" error. This occurs even when no .env file is explicitly present in the current working directory, suggesting a potential misconfiguration or incorrect handling of Redis connection parameters.

Observed Behavior

When attempting to use coaia tash (e.g., coaia tash TMP -F README.md -T 33) or coaia fetch <key>, the following error message is displayed:

invalid username-password pair or user is disabled
Key: TMP  was just saved to memory.

Despite the message indicating the key was saved, subsequent coaia fetch commands for the same key also fail with the same authentication error. This indicates that the operation is not completing successfully due to a Redis authentication issue.

Expected Behavior

  1. The coaia tash and coaia fetch commands should successfully interact with the configured Redis instance.
  2. The commands should correctly prioritize environment variables for Redis connection, specifically UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
  3. If a .env file exists in the current working directory (/src/coaiapy/), these variables should be read from it and used for Redis authentication.
  4. If no .env file is present, the commands should fall back to other configured methods (e.g., ~/.coaia.json or other global configurations) without authentication errors.

Reproduction Steps

  1. Ensure no .env file is present in /src/coaiapy/.
  2. Execute coaia tash TMP -F README.md -T 33.
  3. Observe the "invalid username-password pair or user is disabled" error.
  4. Execute coaia fetch TMP.
  5. Observe the same authentication error.

Relevant Environment Variables

The following environment variables are critical for Redis connection and should be correctly processed by the coaia tool:

  • UPSTASH_REDIS_REST_URL
  • UPSTASH_REDIS_REST_TOKEN

These variables should be looked for in the .env file within the current working directory (/src/coaiapy/) first.

Suggested Solution/Investigation Areas for Copilot Agents

Copilot agents should investigate the following:

  1. Environment Variable Loading: Verify how coaia loads and prioritizes environment variables, especially from .env files. Ensure that python-dotenv or a similar mechanism is correctly implemented and functioning.
  2. Redis Client Configuration: Examine the coaia codebase to understand how the Redis client is initialized and how the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are passed to it. There might be an issue with how these credentials are being formatted or used during the connection attempt.
  3. Fallback Mechanism: Confirm that the fallback logic for Redis configuration (when .env variables are not present) is correctly implemented and does not lead to authentication failures.
  4. Error Handling: Improve error messaging to provide more specific details about why the authentication failed (e.g., which credential was invalid, which configuration source was used).
  5. Testing: Implement unit and integration tests to ensure robust handling of Redis connection parameters and environment variables under various scenarios (e.g., .env present, .env absent, invalid credentials).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions