agent project show fails to show a project. #590

Closed
opened 2026-03-05 01:02:10 +00:00 by brent.edwards · 5 comments
Member

Metadata

  • Commit Message: fix(project): show created project after creation
  • Branch: feature/m3-fix-project-show-after-create
Field Value
Type Bug
Priority Medium
MoSCoW Must Have
Points 3
Milestone v3.2.0
Assignee freemo
Parent Epic #401

Background and Context

agents project create project1 appears to succeed (shows "Project Created" panel) but the project is not persisted to the database. Subsequent agents project show local/project1 fails with "Project not found" after multiple retries. This is the same root cause as #589NamespacedProjectRepository.create() flushes but never commits.

Reported by Brent Edwards on Day 25.

Steps to reproduce:

cd ~
mkdir data
uv venv
source .venv/bin/activate
uv pip install -e /app
agents init
agents project create project1
agents project show local/project1
# Expected: project details appear
# Actual: "Project 'local/project1' not found" after retries

Expected Behavior

After agents project create project1, agents project show local/project1 displays the project details.

Acceptance Criteria

  • agents project show local/<name> returns the project immediately after creation.
  • The project record is committed to the database during creation.

Subtasks

  • Code: Fix the persistence issue so project records are committed (shared fix with #589).
  • Tests (Behave): Ensure failing tests from PR #593 now pass.
  • Tests (Robot): Ensure Robot smoke tests pass.
  • Quality: Verify coverage >=97% via nox -s coverage_report.
  • Quality: 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.
  • 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(project): show created project after creation` - **Branch**: `feature/m3-fix-project-show-after-create` | Field | Value | |-------|-------| | **Type** | Bug | | **Priority** | Medium | | **MoSCoW** | Must Have | | **Points** | 3 | | **Milestone** | v3.2.0 | | **Assignee** | freemo | | **Parent Epic** | #401 | ## Background and Context `agents project create project1` appears to succeed (shows "Project Created" panel) but the project is not persisted to the database. Subsequent `agents project show local/project1` fails with "Project not found" after multiple retries. This is the same root cause as #589 — `NamespacedProjectRepository.create()` flushes but never commits. Reported by Brent Edwards on Day 25. **Steps to reproduce:** ```bash cd ~ mkdir data uv venv source .venv/bin/activate uv pip install -e /app agents init agents project create project1 agents project show local/project1 # Expected: project details appear # Actual: "Project 'local/project1' not found" after retries ``` ## Expected Behavior After `agents project create project1`, `agents project show local/project1` displays the project details. ## Acceptance Criteria - [ ] `agents project show local/<name>` returns the project immediately after creation. - [ ] The project record is committed to the database during creation. ## Subtasks - [ ] Code: Fix the persistence issue so project records are committed (shared fix with #589). - [ ] Tests (Behave): Ensure failing tests from PR #593 now pass. - [ ] Tests (Robot): Ensure Robot smoke tests pass. - [ ] Quality: Verify coverage >=97% via `nox -s coverage_report`. - [ ] Quality: 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. - 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.
Author
Member

TDD Tests Submitted -- PR #593

Opened PR #593 with TDD failing tests that reproduce this bug.

Root Cause Analysis

Same root cause as #589. NamespacedProjectRepository.create() at repositories.py:2828-2855 calls session.flush() but never session.commit(). The show command at project.py:832 gets a fresh repo and calls repo.get(name), which cannot see the uncommitted row. The @database_retry decorator on get() wastefully retries 3 times (since ProjectNotFoundError inherits from DatabaseError) before surfacing the error.

Deliverables

  • 3 Behave BDD scenarios (@wip, @tdd, @bug590) -- all expected to fail until fix
  • Robot Framework integration smoke tests
  • ASV round-trip benchmark with found/not-found tracker
  • CHANGELOG entry

Next Steps

The fix for #589 (adding session.commit() to the create path) will also resolve this issue.

## TDD Tests Submitted -- PR #593 Opened PR #593 with TDD failing tests that reproduce this bug. ### Root Cause Analysis Same root cause as #589. `NamespacedProjectRepository.create()` at `repositories.py:2828-2855` calls `session.flush()` but never `session.commit()`. The `show` command at `project.py:832` gets a fresh repo and calls `repo.get(name)`, which cannot see the uncommitted row. The `@database_retry` decorator on `get()` wastefully retries 3 times (since `ProjectNotFoundError` inherits from `DatabaseError`) before surfacing the error. ### Deliverables - 3 Behave BDD scenarios (`@wip`, `@tdd`, `@bug590`) -- all expected to **fail** until fix - Robot Framework integration smoke tests - ASV round-trip benchmark with found/not-found tracker - CHANGELOG entry ### Next Steps The fix for #589 (adding `session.commit()` to the create path) will also resolve this issue.
freemo added this to the v3.2.0 milestone 2026-03-05 03:28:18 +00:00
Owner

PM Acknowledgment — Day 25 Review

Confirmed — same root cause as #589 (missing session.commit() in NamespacedProjectRepository.create()). Good additional observation about the @database_retry decorator wastefully retrying ProjectNotFoundError — that's worth a separate cleanup ticket if it persists after the fix.

Triage Notes

  • TDD PR #593 assigned to @freemo for review.
  • Fix ownership: @freemo — will be resolved by the same persistence fix as #589.
  • This issue will be retested and closed once the #589 fix merges.
## PM Acknowledgment — Day 25 Review Confirmed — same root cause as #589 (missing `session.commit()` in `NamespacedProjectRepository.create()`). Good additional observation about the `@database_retry` decorator wastefully retrying `ProjectNotFoundError` — that's worth a separate cleanup ticket if it persists after the fix. ### Triage Notes - **TDD PR #593** assigned to @freemo for review. - **Fix ownership**: @freemo — will be resolved by the same persistence fix as #589. - This issue will be retested and closed once the #589 fix merges.
Owner

Implementation Notes

Root Cause

Same as #589NamespacedProjectRepository.create() called session.flush() without session.commit(). The project show command opens a new session to retrieve the project, which can't see uncommitted records.

Fix Applied

Same database fix as #589 (add session.commit()). Additionally fixed an ambiguous Behave step matcher by renaming "I create a project named" to "I create a described project named" for the variant with description.

Verification

  • All nox sessions pass, coverage 97%
  • 8503 Behave scenarios, 1196 Robot tests (0 failures)

PR: #593 (updated with fix commit)

## Implementation Notes ### Root Cause Same as #589 — `NamespacedProjectRepository.create()` called `session.flush()` without `session.commit()`. The `project show` command opens a new session to retrieve the project, which can't see uncommitted records. ### Fix Applied Same database fix as #589 (add `session.commit()`). Additionally fixed an ambiguous Behave step matcher by renaming "I create a project named" to "I create a described project named" for the variant with description. ### Verification - All nox sessions pass, coverage 97% - 8503 Behave scenarios, 1196 Robot tests (0 failures) PR: #593 (updated with fix commit)
Member

PR !593 merged, this ticket is pending on the TTD ticket #633, marking this ticket as completed but not closed due to opening dependencies.

PR !593 merged, this ticket is pending on the TTD ticket #633, marking this ticket as completed but not closed due to opening dependencies.
Owner

PM Status — Day 29

Bug fix merged in PR #593. TDD counterpart #633 now also closed (tests already on master). Closing this issue as complete.

## PM Status — Day 29 Bug fix merged in PR #593. TDD counterpart #633 now also closed (tests already on master). Closing this issue as complete.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
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#590
No description provided.