Re-creating an action after archiving fails with "already exists" error #1254

Open
opened 2026-04-02 01:11:17 +00:00 by brent.edwards · 0 comments
Member

Metadata

  • Commit Message: fix(action): allow re-creating an action after archiving
  • Branch: bugfix/m1-action-archive-recreate

Background

The cleveragents action archive command is intended to retire an action so that it is no longer available for use. After archiving, the action name should be freed up — a user should be able to create a new action with the same name as one that was previously archived. This is standard lifecycle behavior: archive effectively removes the action from the active namespace.

Current Behavior

After archiving an action with cleveragents action archive local/test-action, attempting to re-create an action with the same name via cleveragents action create fails. The system reports Action with name 'local/test-action' already exists and retries repeatedly until exhaustion.

Reproduction Steps

In a fresh Docker container:

mkdir ~/test-20260401
cd ~/test-20260401
mkdir data
uv venv
source .venv/bin/activate
uv pip install -e /app
agents init --yes

cat << EOF > m1_test_action.yaml
name: local/test-action
description: "M1 E2E acceptance test action"
strategy_actor: openai/gpt-4o-mini
execution_actor: openai/gpt-4o-mini
definition_of_done: |
  Create a file called HELLO.md with a short greeting.
reusable: true
read_only: false
EOF

cleveragents action create --config ~/test-20260401/m1_test_action.yaml
cleveragents action archive local/test-action
cleveragents action create --config ~/test-20260401/m1_test_action.yaml

Actual Output

2026-04-02 00:59:32 [info     ] Creating action                name=local/test-action service=plan_lifecycle
2026-04-02 00:59:33 [debug    ] Starting attempt               attempt_number=1 outcome=None
/home/devuser/test/20260401/.venv/lib/python3.13/site-packages/structlog/_base.py:173: UserWarning: Remove `format_exc_info` from your processor chain if you want pretty exceptions.
  event_dict = proc(self._logger, method_name, event_dict)
2026-04-02 00:59:33 [debug    ] Attempt failed, will retry     attempt_number=1 wait_time=0
Action with name 'local/test-action' already exists
2026-04-02 00:59:33 [debug    ] Starting attempt               attempt_number=2 outcome=None
2026-04-02 00:59:33 [debug    ] Attempt failed, will retry     attempt_number=2 wait_time=0
Action with name 'local/test-action' already exists
2026-04-02 00:59:34 [debug    ] Starting attempt               attempt_number=3 outcome=None
2026-04-02 00:59:34 [debug    ] Attempt failed, will retry     attempt_number=3 wait_time=0
Action with name 'local/test-action' already exists

Expected Behavior

After archiving local/test-action, re-running cleveragents action create with the same name should succeed and produce a new action record:

2026-04-02 00:53:48 [info     ] Creating action                name=local/test-action service=plan_lifecycle
2026-04-02 00:53:48 [debug    ] Starting attempt               attempt_number=1 outcome=None
2026-04-02 00:53:48 [info     ] Action created                 action_name=local/test-action name=local/test-action service=plan_lifecycle
╭──────────────────── Action Created ────────────────────╮
│ Namespaced Name: local/test-action                     │
│ Short Name: test-action                                │
│ Description: M1 E2E acceptance                         │
│ State: available                                       │
│ Strategy Actor: openai/gpt-4o-mini                     │
│ Execution Actor: openai/gpt-4o-mini                    │
│ Reusable: yes                                          │
│ Read Only: no                                          │
│ Definition of Done:                                    │
│   Create a file called HELLO.md with a short greeting. │
│ Arguments:                                             │
│   (none)                                               │
│ Created: 2026-04-02 00:53:48.344761                    │
╰────────────────────────────────────────────────────────╯

Acceptance Criteria

  • cleveragents action create succeeds when creating an action whose name matches a previously archived action
  • The uniqueness check for action names excludes actions in the archived state
  • Previously archived action data is not corrupted or lost by the re-creation
  • cleveragents action list shows only the new (active) action, not the archived one
  • cleveragents action list --all (or equivalent) still shows the archived action alongside the new one

Subtasks

  • Investigate the action name uniqueness query in the repository/service layer to determine where archived actions are included
  • Update the uniqueness check to exclude archived actions (likely in the action repository or creation service)
  • Verify that the archive state is correctly persisted and queryable
  • Tests (Behave): Add scenario for creating an action after archiving one with the same name
  • Tests (Robot): Add E2E test for the archive-then-recreate workflow
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
## Metadata - **Commit Message**: `fix(action): allow re-creating an action after archiving` - **Branch**: `bugfix/m1-action-archive-recreate` ## Background The `cleveragents action archive` command is intended to retire an action so that it is no longer available for use. After archiving, the action name should be freed up — a user should be able to create a new action with the same name as one that was previously archived. This is standard lifecycle behavior: archive effectively removes the action from the active namespace. ## Current Behavior After archiving an action with `cleveragents action archive local/test-action`, attempting to re-create an action with the same name via `cleveragents action create` fails. The system reports `Action with name 'local/test-action' already exists` and retries repeatedly until exhaustion. ### Reproduction Steps In a fresh Docker container: ```bash mkdir ~/test-20260401 cd ~/test-20260401 mkdir data uv venv source .venv/bin/activate uv pip install -e /app agents init --yes cat << EOF > m1_test_action.yaml name: local/test-action description: "M1 E2E acceptance test action" strategy_actor: openai/gpt-4o-mini execution_actor: openai/gpt-4o-mini definition_of_done: | Create a file called HELLO.md with a short greeting. reusable: true read_only: false EOF cleveragents action create --config ~/test-20260401/m1_test_action.yaml cleveragents action archive local/test-action cleveragents action create --config ~/test-20260401/m1_test_action.yaml ``` ### Actual Output ``` 2026-04-02 00:59:32 [info ] Creating action name=local/test-action service=plan_lifecycle 2026-04-02 00:59:33 [debug ] Starting attempt attempt_number=1 outcome=None /home/devuser/test/20260401/.venv/lib/python3.13/site-packages/structlog/_base.py:173: UserWarning: Remove `format_exc_info` from your processor chain if you want pretty exceptions. event_dict = proc(self._logger, method_name, event_dict) 2026-04-02 00:59:33 [debug ] Attempt failed, will retry attempt_number=1 wait_time=0 Action with name 'local/test-action' already exists 2026-04-02 00:59:33 [debug ] Starting attempt attempt_number=2 outcome=None 2026-04-02 00:59:33 [debug ] Attempt failed, will retry attempt_number=2 wait_time=0 Action with name 'local/test-action' already exists 2026-04-02 00:59:34 [debug ] Starting attempt attempt_number=3 outcome=None 2026-04-02 00:59:34 [debug ] Attempt failed, will retry attempt_number=3 wait_time=0 Action with name 'local/test-action' already exists ``` ## Expected Behavior After archiving `local/test-action`, re-running `cleveragents action create` with the same name should succeed and produce a new action record: ``` 2026-04-02 00:53:48 [info ] Creating action name=local/test-action service=plan_lifecycle 2026-04-02 00:53:48 [debug ] Starting attempt attempt_number=1 outcome=None 2026-04-02 00:53:48 [info ] Action created action_name=local/test-action name=local/test-action service=plan_lifecycle ╭──────────────────── Action Created ────────────────────╮ │ Namespaced Name: local/test-action │ │ Short Name: test-action │ │ Description: M1 E2E acceptance │ │ State: available │ │ Strategy Actor: openai/gpt-4o-mini │ │ Execution Actor: openai/gpt-4o-mini │ │ Reusable: yes │ │ Read Only: no │ │ Definition of Done: │ │ Create a file called HELLO.md with a short greeting. │ │ Arguments: │ │ (none) │ │ Created: 2026-04-02 00:53:48.344761 │ ╰────────────────────────────────────────────────────────╯ ``` ## Acceptance Criteria - [ ] `cleveragents action create` succeeds when creating an action whose name matches a previously archived action - [ ] The uniqueness check for action names excludes actions in the `archived` state - [ ] Previously archived action data is not corrupted or lost by the re-creation - [ ] `cleveragents action list` shows only the new (active) action, not the archived one - [ ] `cleveragents action list --all` (or equivalent) still shows the archived action alongside the new one ## Subtasks - [ ] Investigate the action name uniqueness query in the repository/service layer to determine where archived actions are included - [ ] Update the uniqueness check to exclude archived actions (likely in the action repository or creation service) - [ ] Verify that the archive state is correctly persisted and queryable - [ ] Tests (Behave): Add scenario for creating an action after archiving one with the same name - [ ] Tests (Robot): Add E2E test for the archive-then-recreate workflow - [ ] Verify coverage >=97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done.
brent.edwards added this to the v3.0.0 milestone 2026-04-02 01:11:17 +00:00
brent.edwards changed title from bug(action): cleveragents action archive does not allow one to create an action of the old name. to Re-creating an action after archiving fails with "already exists" error 2026-04-02 01:14:14 +00:00
freemo modified the milestone from v3.0.0 to v3.2.0 2026-04-02 08:10:53 +00:00
freemo self-assigned this 2026-04-02 18:45:27 +00:00
freemo removed this from the v3.2.0 milestone 2026-04-07 02:32: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.

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