UAT: agents resource add postgres/mysql rejects spec-required type-specific CLI args — --host, --port, --dbname, --connection-string crash with "No such option" #6824

Open
opened 2026-04-10 02:20:22 +00:00 by HAL9000 · 0 comments
Owner

Background and Context

The specification (§Database Resource Types, ~line 24489) defines that built-in database resource types postgres and mysql accept type-specific CLI arguments when registering via agents resource add:

Networked databases (postgres, mysql) accept --connection-string, --host, --port, --dbname, --user, --password CLI args.

The spec also states (§agents resource add):

agents resource add [--description/-d DESC] [--update] <TYPE> <NAME> [type-specific-flags...]

The POSTGRES_TYPE_DEF and MYSQL_TYPE_DEF in cleveragents/resource/handlers/database.py correctly define cli_args with connection-string, host, port, dbname, user, password. The agents resource type show postgres command correctly lists all these CLI arguments.

Current Behavior

Running agents resource add postgres test-pg --host localhost --port 5432 --dbname testdb produces:

Wrapping unexpected exception: NoSuchOption: No such option: --host
Error [500] INTERNAL: An unexpected error occurred

Similarly, --connection-string, --port, --dbname, --user, and --password all fail with "No such option".

The root cause is in src/cleveragents/cli/commands/resource.py — the resource_add command is hardcoded with only generic flags (--path, --branch, --image, --container-id, --mount, --clone-into) and does not dynamically expose the type-specific cli_args defined on the registered resource type.

Expected Behavior (per spec)

agents resource add postgres my-db --host localhost --port 5432 --dbname testdb should succeed and register the resource with the connection parameters stored in properties.

agents resource add postgres my-db --connection-string "postgresql://user:pass@host/db" should also work.

Similarly for mysql.

Steps to Reproduce

# Any of these fail:
agents resource add postgres test-pg --connection-string "postgresql://localhost:5432/mydb"
agents resource add postgres test-pg --host localhost --port 5432 --dbname mydb
agents resource add mysql test-mysql --connection-string "mysql://localhost:3306/mydb"
agents resource add mysql test-mysql --host localhost --port 3306 --dbname mydb

Code Analysis

  • src/cleveragents/cli/commands/resource.py, resource_add() function (line 571): hardcodes only generic flags; no dynamic dispatch of type-specific args
  • src/cleveragents/resource/handlers/database.py POSTGRES_TYPE_DEF and MYSQL_TYPE_DEF: correctly define cli_args with connection-string, host, port, dbname, user, password but these are never exposed in the CLI
  • agents resource type show postgres correctly shows all CLI arguments — confirming the type definitions are correct but the CLI doesn't use them

Acceptance Criteria

  • agents resource add postgres <NAME> --connection-string <CONN> succeeds and stores the connection string
  • agents resource add postgres <NAME> --host <H> --port <P> --dbname <DB> succeeds and stores the individual connection params
  • agents resource add mysql <NAME> --connection-string <CONN> succeeds
  • agents resource add mysql <NAME> --host <H> --port <P> --dbname <DB> succeeds
  • Type-specific args are passed through as properties to register_resource()

Subtasks

  • Implement dynamic type-specific CLI arg dispatch in resource_add command
  • Ensure postgres/mysql args stored correctly in resource properties
  • Add Behave unit tests for the new CLI handling
  • Add Robot integration tests
  • Verify coverage >=97%
  • Run nox (all sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks are completed.
  • A commit is created and pushed to the correct branch.
  • A pull request is submitted, reviewed, and merged.

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Background and Context The specification (§Database Resource Types, ~line 24489) defines that built-in database resource types `postgres` and `mysql` accept type-specific CLI arguments when registering via `agents resource add`: > Networked databases (`postgres`, `mysql`) accept `--connection-string`, `--host`, `--port`, `--dbname`, `--user`, `--password` CLI args. The spec also states (§agents resource add): > `agents resource add [--description/-d DESC] [--update] <TYPE> <NAME> [type-specific-flags...]` The `POSTGRES_TYPE_DEF` and `MYSQL_TYPE_DEF` in `cleveragents/resource/handlers/database.py` correctly define `cli_args` with `connection-string`, `host`, `port`, `dbname`, `user`, `password`. The `agents resource type show postgres` command correctly lists all these CLI arguments. ## Current Behavior Running `agents resource add postgres test-pg --host localhost --port 5432 --dbname testdb` produces: ``` Wrapping unexpected exception: NoSuchOption: No such option: --host Error [500] INTERNAL: An unexpected error occurred ``` Similarly, `--connection-string`, `--port`, `--dbname`, `--user`, and `--password` all fail with "No such option". The root cause is in `src/cleveragents/cli/commands/resource.py` — the `resource_add` command is hardcoded with only generic flags (`--path`, `--branch`, `--image`, `--container-id`, `--mount`, `--clone-into`) and does not dynamically expose the type-specific `cli_args` defined on the registered resource type. ## Expected Behavior (per spec) `agents resource add postgres my-db --host localhost --port 5432 --dbname testdb` should succeed and register the resource with the connection parameters stored in `properties`. `agents resource add postgres my-db --connection-string "postgresql://user:pass@host/db"` should also work. Similarly for `mysql`. ## Steps to Reproduce ```bash # Any of these fail: agents resource add postgres test-pg --connection-string "postgresql://localhost:5432/mydb" agents resource add postgres test-pg --host localhost --port 5432 --dbname mydb agents resource add mysql test-mysql --connection-string "mysql://localhost:3306/mydb" agents resource add mysql test-mysql --host localhost --port 3306 --dbname mydb ``` ## Code Analysis - `src/cleveragents/cli/commands/resource.py`, `resource_add()` function (line 571): hardcodes only generic flags; no dynamic dispatch of type-specific args - `src/cleveragents/resource/handlers/database.py` `POSTGRES_TYPE_DEF` and `MYSQL_TYPE_DEF`: correctly define `cli_args` with `connection-string`, `host`, `port`, `dbname`, `user`, `password` but these are never exposed in the CLI - `agents resource type show postgres` correctly shows all CLI arguments — confirming the type definitions are correct but the CLI doesn't use them ## Acceptance Criteria - `agents resource add postgres <NAME> --connection-string <CONN>` succeeds and stores the connection string - `agents resource add postgres <NAME> --host <H> --port <P> --dbname <DB>` succeeds and stores the individual connection params - `agents resource add mysql <NAME> --connection-string <CONN>` succeeds - `agents resource add mysql <NAME> --host <H> --port <P> --dbname <DB>` succeeds - Type-specific args are passed through as `properties` to `register_resource()` ## Subtasks - [ ] Implement dynamic type-specific CLI arg dispatch in `resource_add` command - [ ] Ensure postgres/mysql args stored correctly in resource properties - [ ] Add Behave unit tests for the new CLI handling - [ ] Add Robot integration tests - [ ] Verify coverage >=97% - [ ] Run `nox` (all sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks are completed. - A commit is created and pushed to the correct branch. - A pull request is submitted, reviewed, and merged. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-10 02:20:42 +00:00
HAL9000 self-assigned this 2026-04-10 06:06:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#6824
No description provided.