project.py create command silently swallows all exceptions during project re-fetch #8410

Open
opened 2026-04-13 18:42:26 +00:00 by HAL9000 · 2 comments
Owner

Metadata

Commit: Build: Reinforced label enforcement, and ensure implementation workers dont continue work on a mergable PR.
Branch: main

Background and Context

In src/cleveragents/cli/commands/project.py, the create() command contains a bare except Exception: block that silently swallows all exceptions during the post-creation project re-fetch. This violates the project's Code Quality Standards which prohibit error suppression (bare except, pass in except).

Code evidence (project.py, create command):

# Re-fetch project for display
try:
    created = repo.get(project.namespaced_name)
except Exception:
    created = project

If repo.get() raises a DatabaseError, ValidationError, or any other exception (including infrastructure failures), the error is silently swallowed and the stale project object (without linked resources or server-assigned fields) is used for display. This means the user sees incorrect output (e.g., missing linked resources, wrong timestamps) with no indication that the re-fetch failed.

Expected Behavior

Per Code Quality Standards, bare except Exception: pass patterns are forbidden. The re-fetch failure should either:

  1. Log a warning and fall back to the local project object (with a visible warning to the user), OR
  2. Catch only specific expected exceptions (e.g., NotFoundError) and re-raise unexpected ones.

Example fix:

try:
    created = repo.get(project.namespaced_name)
except NotFoundError:
    # Project was just created; fall back to local object
    created = project

Acceptance Criteria

  • The bare except Exception: in create() is replaced with specific exception handling
  • Unexpected exceptions from repo.get() are not silently swallowed
  • If a NotFoundError occurs (race condition), the local project object is used as fallback with a logged warning
  • Existing BDD tests for agents project create continue to pass
  • New BDD scenario added for the re-fetch failure path

Subtasks

  • Replace bare except Exception: with except NotFoundError: (or appropriate specific exception)
  • Add a warning log/console message when falling back to the local project object
  • Add BDD scenario covering the re-fetch failure fallback
  • Run nox -s lint to confirm no bare-except violations remain

Definition of Done

The issue is closed when the bare except Exception: is replaced with specific exception handling, a warning is emitted on fallback, all existing tests pass, and a new BDD scenario covers the fallback path.


Automated by CleverAgents Bot
Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor

## Metadata **Commit:** `Build: Reinforced label enforcement, and ensure implementation workers dont continue work on a mergable PR.` **Branch:** `main` ## Background and Context In `src/cleveragents/cli/commands/project.py`, the `create()` command contains a bare `except Exception:` block that silently swallows all exceptions during the post-creation project re-fetch. This violates the project's Code Quality Standards which prohibit error suppression (bare `except`, `pass` in `except`). **Code evidence** (project.py, `create` command): ```python # Re-fetch project for display try: created = repo.get(project.namespaced_name) except Exception: created = project ``` If `repo.get()` raises a `DatabaseError`, `ValidationError`, or any other exception (including infrastructure failures), the error is silently swallowed and the stale `project` object (without linked resources or server-assigned fields) is used for display. This means the user sees incorrect output (e.g., missing linked resources, wrong timestamps) with no indication that the re-fetch failed. ## Expected Behavior Per Code Quality Standards, bare `except Exception: pass` patterns are forbidden. The re-fetch failure should either: 1. Log a warning and fall back to the local `project` object (with a visible warning to the user), OR 2. Catch only specific expected exceptions (e.g., `NotFoundError`) and re-raise unexpected ones. Example fix: ```python try: created = repo.get(project.namespaced_name) except NotFoundError: # Project was just created; fall back to local object created = project ``` ## Acceptance Criteria - [ ] The bare `except Exception:` in `create()` is replaced with specific exception handling - [ ] Unexpected exceptions from `repo.get()` are not silently swallowed - [ ] If a `NotFoundError` occurs (race condition), the local `project` object is used as fallback with a logged warning - [ ] Existing BDD tests for `agents project create` continue to pass - [ ] New BDD scenario added for the re-fetch failure path ## Subtasks - [ ] Replace bare `except Exception:` with `except NotFoundError:` (or appropriate specific exception) - [ ] Add a warning log/console message when falling back to the local project object - [ ] Add BDD scenario covering the re-fetch failure fallback - [ ] Run `nox -s lint` to confirm no bare-except violations remain ## Definition of Done The issue is closed when the bare `except Exception:` is replaced with specific exception handling, a warning is emitted on fallback, all existing tests pass, and a new BDD scenario covers the fallback path. --- **Automated by CleverAgents Bot** Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor
HAL9000 added this to the v3.2.0 milestone 2026-04-13 19:17:54 +00:00
Author
Owner

Verified — Silently swallowing exceptions in project create command hides real errors from users. MoSCoW: Should Have for v3.2.0 — proper error propagation is expected behavior. [AUTO-OWNR-1]


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Verified** — Silently swallowing exceptions in project create command hides real errors from users. **MoSCoW: Should Have** for v3.2.0 — proper error propagation is expected behavior. [AUTO-OWNR-1] --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Author
Owner

[AUTO-OWNR-2] Triage Decision

Status: Verified

MoSCoW: Should Have
Priority: Medium

Rationale: The bare except Exception: in project.py's create() command silently swallows all exceptions during the post-creation project re-fetch. This is a confirmed violation of the Code Quality Standards (no bare except, no silent error suppression) and a genuine user-facing bug — if repo.get() fails for any reason other than a race-condition NotFoundError, the user receives stale/incorrect output with no warning. This is more impactful than a pure code style issue because it actively hides errors from users, warranting Medium priority. It does not block v3.2.0 milestone features but should be resolved as part of ongoing code quality maintenance.

Next Steps: Replace the bare except Exception: with except NotFoundError: (or the appropriate specific exception type from the project's exception hierarchy). Add a warning log/console message when falling back to the local project object. Add a new BDD scenario covering the re-fetch failure fallback path. Run nox -s lint to confirm no bare-except violations remain. All existing agents project create BDD tests must continue to pass.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

## [AUTO-OWNR-2] Triage Decision **Status**: ✅ Verified **MoSCoW**: Should Have **Priority**: Medium **Rationale**: The bare `except Exception:` in `project.py`'s `create()` command silently swallows all exceptions during the post-creation project re-fetch. This is a confirmed violation of the Code Quality Standards (no bare `except`, no silent error suppression) and a genuine user-facing bug — if `repo.get()` fails for any reason other than a race-condition `NotFoundError`, the user receives stale/incorrect output with no warning. This is more impactful than a pure code style issue because it actively hides errors from users, warranting Medium priority. It does not block v3.2.0 milestone features but should be resolved as part of ongoing code quality maintenance. **Next Steps**: Replace the bare `except Exception:` with `except NotFoundError:` (or the appropriate specific exception type from the project's exception hierarchy). Add a warning log/console message when falling back to the local `project` object. Add a new BDD scenario covering the re-fetch failure fallback path. Run `nox -s lint` to confirm no bare-except violations remain. All existing `agents project create` BDD tests must continue to pass. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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#8410
No description provided.