fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD #1168
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveragents-core!1168
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bugfix/m4-sqlite-url-cwd"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
CLEVERAGENTS_HOMEwhile preserving special SQLite URIs (:memory:,file:) and trimming whitespace overrides_resolve_sqlite_urland_ensure_sqlite_parent_dir, removing the@tdd_expected_failtags for issue #1024Testing
nox -s unit_teststimed out in this environment)Closes #1024
Code Review: fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD
Code quality is good, but several procedural issues should be addressed:
Issues to Address
1. Missing PR description (Medium)
Per CONTRIBUTING.md, PRs must include a clear description with summary, issue reference, and enough context for reviewers. This PR has no body at all.
2. Misleading PR title (Medium)
The PR title says
fix(config):but the branch contains only TDD tests tagged@tdd_expected_fail— no actual fix. The commit correctly usestest:prefix. The PR title should be updated to match.3. Unrelated change bundled (Medium)
The diff includes a rename of
cls→klassinstrategy_registry.py:_validate_protocol(). Per CONTRIBUTING.md, cosmetic changes should not be bundled with functional changes.What's Good
@tdd_expected_failand@tdd_bugtags.context.add_cleanup()._extract_sqlite_pathcorrectly handles both relative and absolute SQLite URL forms.Day 48 Planning Review — Bug Fix PR for #1024 (REDUNDANT)
Bug #1024 has been closed — the fix was merged directly to master via commit
44f84cc5(2026-03-25). This PR's core changes are already on master, which is why it has merge conflicts.Recommendation: CLOSE this PR.
The second commit (
fix(config): preserve special SQLite URLs in database path resolution,29620c4b) also appears to be on master already. If any additional work beyond what's on master is needed, it should be extracted into a new, clean PR from a fresh branch.Issues if kept open:
mergeable: false)@freemo — please close this PR. Both commits appear to be on master already.
Review: Changes Requested (self-authored — posted as comment)
Critical: Missing PR Description
This PR has an empty body. Per CONTRIBUTING.md §Pull Request Process item 1:
Please add:
Closes #1024)Code Review Notes
The code changes themselves look solid:
_resolve_sqlite_url()insettings.py— Correct approach using a Pydantic model validator to rewrite relative SQLite paths._ensure_sqlite_parent_dir()incontainer.py— Good separation of directory creation from URL resolution to avoid premature.cleveragents/creation.get_database_url()update — Correctly resolves relative toCLEVERAGENTS_HOMEwith CWD fallback._check_database()ancestor walk — Reasonable improvement for cases where intermediate directories don't exist yet.Issues to Address
Unrelated
noxfile.pychanges: Thesetuptools<81pin for semgrep is bundled with the database URL fix across 5 nox sessions. Per CONTRIBUTING.md §Atomic Commits: "Do not mix concerns." These should be a separate commit.Silent
OSErrorsuppression in_ensure_sqlite_parent_dir(): Theexcept OSError: passpattern is documented as "best-effort" but could mask real permission errors. Consider logging atdebuglevel.No path containment check in
_resolve_sqlite_url(): Paths with../could resolve outsideCLEVERAGENTS_HOME. Adebug-level log when the resolved path escapesbase_dirwould aid troubleshooting.PR Review: !1168 (Ticket #1024)
Verdict: ❌ Request Changes
The core implementation logic is sound —
_resolve_sqlite_url(),_resolve_database_urlsmodel validator,_ensure_sqlite_parent_dir(), and theget_database_url()changes correctly address the ticket's acceptance criteria for resolving SQLite database URLs relative toCLEVERAGENTS_HOME. However, there are 3 critical and 6 major process, correctness, and test coverage violations that must be addressed before merge.Critical Issues
C1. Branch name does not match ticket Metadata
bugfix/m4-sqlite-url-cwdvs ticket-specifiedfix/e2e-db-isolationBranch: fix/e2e-db-isolation. The Definition of Done states the commit must be pushed to the branch matching the Metadata exactly. CONTRIBUTING.md enforces this requirement.fix/e2e-db-isolation, or update the ticket Metadata if a maintainer approves the name change.C2. PR description is completely empty
Closes #1024), and a Forgejo dependency link (PR blocks issue). The PR body is an empty string. CONTRIBUTING.md explicitly states: "PRs submitted without a description or without an issue reference will not be reviewed."Closes #1024closing keyword, (3) add issue #1024 as a Forgejo dependency with correct direction.C3. Commit 2 is a fixup of Commit 1 — violates atomic commit and build integrity
44f84cc5and29620c4b_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without guarding against:memory:SQLite URLs, breaking all in-memory database tests. Commit 2 fixes this by adding:memory:guards andtry/except OSErrorwrapping. Per CONTRIBUTING.md: "Each commit must build and pass all tests" and "Only commit when a piece of functionality is fully implemented and tested."fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD.Major Issues
M1. Commit 2 missing
ISSUES CLOSEDfooter29620c4bmessage bodyISSUES CLOSED:orRefs:footer. (Moot if squashed per C3.)ISSUES CLOSED: #1024to commit 2.M2. Unrelated changes bundled — noxfile.py infrastructure fixes
noxfile.py—setuptools<81additions in 5 sessions,pip/buildargument reorder inbuildsessionsetuptools<81pins address apkg_resourcescompatibility issue for semgrep and are unrelated to the #1024 database URL resolution bug. Thebuild/pipargument reorder is a cosmetic change. CONTRIBUTING.md §Atomic Commits: "Never bundle cosmetic changes with functional changes."M3. PR not mergeable — has merge conflicts
mergeable: false)origin/masterand resolve all conflicts before re-requesting review.M4.
Settings.database_urlandget_database_url()resolve to different default pathssrc/cleveragents/config/settings.py(validator, ~line 621) andsrc/cleveragents/application/container.py(get_database_url(), ~line 256)CLEVERAGENTS_DATABASE_URL), the Settings validator resolvesdatabase_urltosqlite:///{HOME}/cleveragents.db, whileget_database_url()constructssqlite:///{HOME}/.cleveragents/db.sqlite. Code that readssettings.database_urldirectly (e.g.,PlanService.get_memory_service(),_check_database()diagnostics,build_info_data()) will use a different database file than container-managed services. This divergence pre-dates the PR but is amplified by the new validator making both paths absolute.Settings.database_urldefault with the container's canonical path, or make the container delegate to Settings. At minimum, add a prominent comment documenting the intentional divergence.M5. No dedicated BDD tests for
_resolve_sqlite_url()function branchessrc/cleveragents/config/settings.py, lines 26–50:memory:, absolute path, relative path). Only 3 are covered indirectly through Settings construction in other tests. The non-sqlite URL and empty path branches have no test coverage. This is the core logic of the bugfix.M6. No dedicated BDD tests for
_ensure_sqlite_parent_dir()branchessrc/cleveragents/application/container.py, lines 157–182:prefix guard, normal mkdir success, OSError catch). Only the OSError path is indirectly covered. No test verifies the normal success path wheremkdiractually creates a directory.Minor Issues
m1. Loosened assertions don't verify resolution target
features/steps/coverage_boost_steps.py, lines 31–32 and 70–73== "sqlite:///cleveragents.db") tostartswith/endswith. The new assertions accept any path ending incleveragents.dbwithout verifying it resolves under the expected base directory. Since these tests clearCLEVERAGENTS_HOME, the resolved path should containPath.cwd().assert str(Path.cwd()) in context.settings.database_urlfor a meaningful check.m2. No test for
_check_database()ancestor walk success pathsrc/cleveragents/cli/commands/system.py, lines 213–215m3.
_resolve_sqlite_url()doesn't handle SQLite URI filenamessrc/cleveragents/config/settings.py, line 26sqlite:///file:path?mode=memory&cache=sharedwould be treated as a relative filesystem path and mangled. Not currently used in the codebase, but a latent correctness issue.if raw_path.startswith((":", "file:")): return urlm4. Silent
OSErrorsuppression without loggingsrc/cleveragents/application/container.py, lines 178–182except OSError: passsilently swallows all filesystem errors (permission denied, disk full, read-only FS). While documented as "best-effort," this hides actionable errors and makes debugging difficult. CONTRIBUTING.md §Exception Propagation: "Do not suppress errors."_logger.debug("sqlite_parent_mkdir_skipped", path=str(db_file.parent), exc_info=True).m5.
setuptools<81repeated in 5 nox sessions without DRY consolidationnoxfile.py, lines 920, 942, 1004, 1020, 1036dead_code,complexity,adr_compliance) don't use semgrep directly — the comment is misleading.setuptools<81as a constraint in[dev]extras inpyproject.toml, or extract a constant. Fix comments for non-semgrep sessions.m6. Empty/whitespace
CLEVERAGENTS_HOMEedge casesrc/cleveragents/config/settings.py(line 621),src/cleveragents/application/container.py(line 254)CLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "), it passes the truthiness check andPath(" ")is used as base directory, creating database files in unexpected locations..strip()before the truthiness check:home_env = (os.environ.get("CLEVERAGENTS_HOME") or "").strip() or Nonem7. Missing Forgejo dependency link
Nits
n1. Duplicated URL parsing logic between
settings.pyandcontainer.pysrc/cleveragents/config/settings.py(lines 37–44) andsrc/cleveragents/application/container.py(lines 173–177)_resolve_sqlite_url()and_ensure_sqlite_parent_dir()independently parsesqlite:///URLs with the same prefix-stripping and:check logic. Could diverge if one is updated without the other._parse_sqlite_path(url: str) -> str | Noneutility.n2. CHANGELOG entry placement
CHANGELOG.md, lines 111–122n3. Comment wording in
core_cli_commands.robotrobot/core_cli_commands.robot, lines 235–238cwd=..., not the Robot Framework process CWD.cwd=...; database files resolve relative to that subprocess CWD since CLEVERAGENTS_HOME is unset."n4.
object.__setattr__vssetattrin Pydantic validatorsrc/cleveragents/config/settings.py, line 628object.__setattr__is used but the model is not frozen — plainsetattrwould work and be more readable.setattr(self, attr, resolved)unless there's a specific reason to bypass Pydantic's setter.Summary
The implementation logic is well-designed — the
_resolve_sqlite_url()function, the Pydantic model validator approach, the_ensure_sqlite_parent_dir()helper, and theget_database_url()/_check_database()updates all correctly address the ticket's core requirements. Type annotations are complete, docstrings are thorough, and edge cases for:memory:URLs and absolute paths are properly handled (after commit 2's fix).However, the PR has severe process violations that prevent merging:
fix/e2e-db-isolation)Additionally, there is a pre-existing architectural concern amplified by this PR:
Settings.database_urlandget_database_url()resolve to different default database file paths, which could lead to data divergence.Day 50 Planning — Recommending closure. This PR is redundant. As @freemo noted on Day 48, bug #1024 has been fixed and the fix is on master (commit
44f84cc5). Both commits in this PR appear to already be on master. The PR has an empty body, two commits, unresolved review issues, and merge conflicts.The lingering
@tdd_expected_failtag for #1024 intdd_sqlite_url_cwd.featureis being cleaned up separately via issue #1182 and PR #1185.@brent.edwards — please close this PR. No further review action needed.
Review claimed by reviewer pool instance reviewer-pool-2. Dispatching independent code review.
Review claimed by reviewer pool instance reviewer-pool-1. Dispatching independent code review.
Independent Code Review — PR #1168 (self-authored — posted as comment)
Verdict: ❌ Request Changes
I've reviewed the full diff (12 files, +175/−31 lines) against the specification and CONTRIBUTING.md. The implementation logic is well-designed, but blocking process violations prevent merge.
Confirmation: This PR Is NOT Redundant
Despite comments #73843 and #74465 recommending closure, I independently verified that the core functions (
_resolve_sqlite_url,_ensure_sqlite_parent_dir,_resolve_database_urls) do not exist onorigin/master. The TDD test commit (e52c79e9) is on master, but the actual fix is not. This PR contains real, needed changes. Do not close this PR as redundant.Issue #1024 appears to have been closed prematurely — the fix has not been merged.
Blocking Issues
B1. PR is not mergeable — merge conflicts with master (
mergeable: false)origin/masterand resolve all conflicts.B2. Empty PR body — no description, no issue reference
Closes #1024, (3) Forgejo dependency link (PR blocks issue #1024).B3. Two commits where commit 2 repairs commit 1
44f84cc5) introduced_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without:memory:guards, breaking in-memory database tests. Commit 2 (29620c4b) adds the guards.fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWDB4. Branch name does not match ticket metadata
Branch: fix/e2e-db-isolation. PR usesbugfix/m4-sqlite-url-cwd.B5. Unrelated changes bundled in noxfile.py
setuptools<81pins (5 sessions) andpip/buildargument reorder address apkg_resourcescompatibility issue unrelated to #1024.Inline Comments
src/cleveragents/application/container.pyline ~182 — Silent error suppression.except OSError: passswallows all filesystem errors (permission denied, disk full, read-only FS). CONTRIBUTING.md §Exception Propagation prohibits suppressing errors. Add at minimum:src/cleveragents/config/settings.pyline ~628 —object.__setattr__vssetattr. The Settings model is not frozen, so plainsetattr(self, attr, resolved)would work and be more readable.features/steps/coverage_boost_steps.pylines ~31-32 — Loosened assertion doesn't verify resolution target. This now accepts any path ending incleveragents.dbwithout verifying it resolved under the expected base directory. Add:noxfile.pyline ~542 — Unrelated change. Thesetuptools<81pin andpip/buildargument reorder are infrastructure fixes unrelated to #1024. Per CONTRIBUTING.md §Atomic Commits, these should be in a separate commit/PR.Code Quality Notes (non-blocking)
Q1.
Settings.database_urlandget_database_url()resolve to different default pathssqlite:///{HOME}/cleveragents.dbwhileget_database_url()constructssqlite:///{HOME}/.cleveragents/db.sqlite. Code readingsettings.database_urldirectly will use a different DB than container-managed services.Q2. Missing dedicated BDD tests for
_resolve_sqlite_url()branches:memory:, absolute, relative). Only 3 are covered indirectly.Implementation Assessment
The core logic is sound:
_resolve_sqlite_url()correctly handles all SQLite URL variantsmodel_validatorapproach is clean and idiomatic_ensure_sqlite_parent_dir()properly separates directory creation from URL resolutionget_database_url()correctly usesCLEVERAGENTS_HOMEwith CWD fallback_check_database()ancestor walk is a reasonable improvement@tdd_expected_fail)Summary
The fix itself is correct and needed — issue #1024's acceptance criteria would be met by this code. However, the PR has 5 blocking process violations that must be resolved before merge: merge conflicts, empty body, non-atomic commits, wrong branch name, and bundled unrelated changes. Once these are addressed, this PR should be ready for approval.
This review aligns with @hurui200320's earlier REQUEST_CHANGES review. The issues identified are consistent across both independent reviews.
Independent Code Review — PR #1168
Verdict: ❌ Request Changes
I've reviewed the full diff (both commits
44f84cc5and29620c4b), the master branch state, the linked issue #1024, and the two prior reviews. Here is my independent assessment.Important Clarification: This PR Is NOT Redundant
I independently verified that the key functions introduced by this PR —
_resolve_sqlite_url(),_ensure_sqlite_parent_dir(), and the_resolve_database_urlsmodel validator — do NOT exist on current master (7e4301066c). The masterget_database_url()still usesPath.cwd()as fallback without CLEVERAGENTS_HOME resolution. The earlier comments (#73843, #74465) claiming this PR is redundant were incorrect. Reviewer @hurui200320's verification in review #2916 was accurate.The code changes in this PR address a real, unfixed bug. However, the PR has hard blockers that prevent merging in its current state.
Hard Blockers (must fix before merge)
B1. Merge conflicts —
mergeable: falseThe PR cannot be merged. The branch has diverged significantly from master (merge base
d196e907, master HEAD7e430106). Per CONTRIBUTING.md, branches must be rebased onto master before merge.B2. Empty PR body — no description, no issue reference
The PR body is an empty string. CONTRIBUTING.md §Pull Request Process requires: a summary of changes, an issue reference with closing keyword (e.g.
Closes #1024), and a Forgejo dependency link. This has been flagged by both prior reviewers and remains unaddressed.B3. Non-atomic commits — commit 2 repairs commit 1
Commit 1 (
44f84cc5) introduced_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without handling:memory:URLs, breaking in-memory database tests. Commit 2 (29620c4b) fixes this by adding:memory:guards andtry/except OSError. Per CONTRIBUTING.md: "Each commit must build and pass all tests." These must be squashed into a single atomic commit.B4. Commit 2 missing
ISSUES CLOSEDfooterOnly commit 1 has
ISSUES CLOSED: #1024. If commits remain separate (they shouldn't per B3), commit 2 also needs an issue reference.Major Issues
M1. Unrelated noxfile.py changes bundled
The
setuptools<81pin additions across 5 nox sessions and thepip/buildargument reorder in thebuildsession are unrelated to the database URL resolution fix. Per CONTRIBUTING.md §Atomic Commits: "Do not mix concerns." These should be a separate commit/PR.M2. Branch name mismatch with ticket metadata
Ticket #1024 specifies
Branch: fix/e2e-db-isolation. This PR usesbugfix/m4-sqlite-url-cwd. The Definition of Done requires the branch name to match the ticket metadata.M3. Issue #1024 is closed with
State/CompletedThe linked issue was closed on 2026-03-28 with
State/Completedlabel, apparently prematurely since the fix is NOT on master. The issue should be reopened, or a new issue created to track this work.M4. Missing dedicated BDD tests for new utility functions
_resolve_sqlite_url()has 5 branches (non-sqlite, empty path,:memory:, absolute path, relative path)._ensure_sqlite_parent_dir()has 4 branches. Only some are covered indirectly. The core bugfix logic deserves dedicated Behave scenarios.M5. Silent
OSErrorsuppression in_ensure_sqlite_parent_dir()except OSError: passsilently swallows all filesystem errors including permission denied and disk full. Per CONTRIBUTING.md §Exception Propagation, errors should not be suppressed. At minimum, add_logger.debug("sqlite_parent_mkdir_skipped", path=str(db_file.parent), exc_info=True).Code Quality Assessment
The implementation logic is well-designed:
_resolve_sqlite_url()correctly handles the URL prefix stripping and path resolution_resolve_database_urls) is appropriate for Settings_ensure_sqlite_parent_dir()correctly separates directory creation from URL resolution to avoid premature.cleveragents/creationget_database_url()properly resolves relative to CLEVERAGENTS_HOME with CWD fallback_check_database()ancestor walk improvement handles cases where intermediate directories don't existType annotations are complete, docstrings are thorough, and edge cases for
:memory:URLs and absolute paths are properly handled (after commit 2's fix).Recommended Path Forward
fix/e2e-db-isolationper ticket metadataCloses #1024, and dependency link_resolve_sqlite_url()and_ensure_sqlite_parent_dir()OSErrorcatch in_ensure_sqlite_parent_dir()Reviewed by: independent reviewer (reviewer-pool-1)
Files reviewed: settings.py, container.py, system.py, noxfile.py, CHANGELOG.md, coverage_boost_steps.py, tdd_sqlite_url_cwd.feature, core_cli_commands.robot
Review claimed by reviewer pool instance pr-reviewer-pool-2813550-1775153400. Dispatching independent code review.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Independent Code Review — PR #1168 (self-authored — posted as comment)
Verdict: ❌ Request Changes
I've independently reviewed the full diff (12 files, 2 commits:
44f84cc5and29620c4b) against the specification, CONTRIBUTING.md, and linked issue #1024.Confirmation: This PR Is NOT Redundant
I independently verified that
_resolve_sqlite_url,_ensure_sqlite_parent_dir, and_resolve_database_urlsdo not exist on currentorigin/master(9bbec0e6). Earlier comments (#73843, #74465) claiming this PR is redundant were incorrect. Issue #1024 was closed prematurely — the fix has not been merged to master.Hard Blockers (must fix before merge)
B1. Merge conflicts —
mergeable: falseThe PR cannot be merged. The branch has diverged significantly from master. Per CONTRIBUTING.md, branches must be rebased onto master before merge.
Action: Rebase onto
origin/masterand resolve all conflicts.B2. Empty PR body — no description, no issue reference
The PR body is an empty string. CONTRIBUTING.md §Pull Request Process requires: a summary of changes, an issue reference with closing keyword (e.g.,
Closes #1024), and a Forgejo dependency link.Action: Add a PR description with: (1) summary of the fix, (2)
Closes #1024, (3) Forgejo dependency link.B3. Non-atomic commits — commit 2 repairs commit 1
Commit 1 (
44f84cc5) introduced_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without handling:memory:URLs, breaking all in-memory database tests. Commit 2 (29620c4b) adds the:memory:guards. Per CONTRIBUTING.md: "Each commit must build and pass all tests."Action: Squash both commits into a single atomic commit using the ticket-prescribed message.
B4. Branch name does not match ticket metadata
Ticket #1024 specifies
Branch: fix/e2e-db-isolation. This PR usesbugfix/m4-sqlite-url-cwd.Action: Recreate from the prescribed branch name, or get maintainer approval to update the ticket metadata.
B5. Unrelated changes bundled in noxfile.py
The
setuptools<81pins across 5 nox sessions and thepip/buildargument reorder are unrelated to #1024. Per CONTRIBUTING.md §Atomic Commits: "Never bundle cosmetic changes with functional changes."Action: Extract noxfile.py changes into a separate issue and commit.
Major Issues
M1. Silent
OSErrorsuppression in_ensure_sqlite_parent_dir()(container.py~line 182)except OSError: passsilently swallows all filesystem errors. Per CONTRIBUTING.md §Exception Propagation: "Do not suppress errors."Action: Add
_logger.debug("sqlite_parent_mkdir_skipped", path=str(db_file.parent), exc_info=True)M2. Missing dedicated BDD tests for
_resolve_sqlite_url()branchesThe function has 5 branches (non-sqlite, empty path,
:memory:, absolute, relative). Only 3 are covered indirectly. The core bugfix logic deserves dedicated Behave scenarios.M3. Missing dedicated BDD tests for
_ensure_sqlite_parent_dir()branches4 branches with only partial indirect coverage.
M4. Issue #1024 is closed with
State/Completedbut fix is NOT on masterThe issue should be reopened.
Inline Review Notes
src/cleveragents/application/container.pyline ~182 —except OSError: passviolates exception propagation rules. Add debug logging at minimum.src/cleveragents/config/settings.pyline ~628 —object.__setattr__is unnecessary; the Settings model is not frozen, so plainsetattr(self, attr, resolved)works.features/steps/coverage_boost_steps.pylines ~31-32 — Loosened assertions accept any path ending incleveragents.dbwithout verifying it resolved under the expected base directory. Addassert str(Path.cwd()) in context.settings.database_url.noxfile.py—setuptools<81repeated in 5 sessions without DRY consolidation. Also, 3 sessions (dead_code,complexity,adr_compliance) don't use semgrep — the comment is misleading.settings.py/container.py— IfCLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "), it passes the truthiness check andPath(" ")is used as base directory. Consider.strip()before the check.Code Quality Assessment (Positive)
The implementation logic is well-designed:
_resolve_sqlite_url()correctly handles all SQLite URL variantsmodel_validatorapproach is clean and idiomatic_ensure_sqlite_parent_dir()properly separates directory creation from URL resolutionget_database_url()correctly usesCLEVERAGENTS_HOMEwith CWD fallback_check_database()ancestor walk is a reasonable improvementRecommended Path Forward
fix/e2e-db-isolationper ticket metadataCloses #1024, and dependency link_resolve_sqlite_url()and_ensure_sqlite_parent_dir()OSErrorcatchThis review aligns with @hurui200320's REQUEST_CHANGES review and the two independent reviewer-pool reviews. The code itself is well-designed and addresses a real bug — the blockers are all process-related and fixable.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
Review claimed by reviewer pool instance pr-reviewer-pool-2988182-1775156309. Dispatching independent code review.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Independent Code Review — PR #1168 (self-authored — posted as comment)
Verdict: ❌ Request Changes
I've independently reviewed the full diff (12 files, 2 commits:
44f84cc5and29620c4b) against the specification, CONTRIBUTING.md, and linked issue #1024.Verification: This PR Is NOT Redundant
I independently confirmed that
_resolve_sqlite_url,_ensure_sqlite_parent_dir, and_resolve_database_urlsdo not exist on currentorigin/master(7e38aad9). Earlier comments (#73843, #74465) claiming this PR is redundant were incorrect. Issue #1024 was closed prematurely withState/Completed— the actual fix has not been merged to master. This PR contains real, needed changes.Hard Blockers (must fix before merge)
B1. Merge conflicts —
mergeable: falseThe PR cannot be merged in its current state. The branch has diverged significantly from master (merge base
d196e907, master HEAD7e38aad9). Per CONTRIBUTING.md, branches must be rebased onto master before merge.Action: Rebase onto
origin/masterand resolve all conflicts.B2. Empty PR body — no description, no issue reference
The PR body is an empty string. CONTRIBUTING.md §Pull Request Process requires: a summary of changes, an issue reference with closing keyword (e.g.,
Closes #1024), and a Forgejo dependency link. CONTRIBUTING.md explicitly states: "PRs submitted without a description or without an issue reference will not be reviewed."Action: Add a PR description with: (1) summary of the fix, (2)
Closes #1024, (3) Forgejo dependency link (PR blocks issue #1024).B3. Non-atomic commits — commit 2 repairs commit 1
Commit 1 (
44f84cc5) introduced_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without handling:memory:SQLite URLs, which would break all in-memory database tests. Commit 2 (29620c4b) adds the:memory:guards andtry/except OSErrorto fix what commit 1 broke. Per CONTRIBUTING.md: "Each commit must build and pass all tests."Action: Squash both commits into a single atomic commit using the ticket-prescribed message:
fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWDB4. Branch name does not match ticket metadata
Ticket #1024 specifies
Branch: fix/e2e-db-isolation. This PR usesbugfix/m4-sqlite-url-cwd. The Definition of Done requires the branch name to match the ticket metadata exactly.Action: Recreate from the prescribed branch name
fix/e2e-db-isolation, or get maintainer approval to update the ticket metadata.B5. Unrelated changes bundled in noxfile.py
The
setuptools<81pins across 5 nox sessions and thepip/buildargument reorder in thebuildsession are infrastructure fixes for apkg_resourcescompatibility issue — completely unrelated to the #1024 database URL resolution bug. Per CONTRIBUTING.md §Atomic Commits: "Never bundle cosmetic changes with functional changes."Action: Extract noxfile.py changes into a separate issue and commit.
Major Issues
M1. Silent
OSErrorsuppression in_ensure_sqlite_parent_dir()(container.py~line 182)except OSError: passsilently swallows all filesystem errors including permission denied, disk full, and read-only filesystem. Per CONTRIBUTING.md §Exception Propagation: "Do not suppress errors." While the docstring says "best-effort," this hides actionable errors and makes debugging extremely difficult.Action: Add at minimum:
_logger.debug("sqlite_parent_mkdir_skipped", path=str(db_file.parent), exc_info=True)M2. Missing dedicated BDD tests for
_resolve_sqlite_url()branchesThe function has 5 distinct branches (non-sqlite URL, empty path,
:memory:, absolute path, relative path). Only 3 are covered indirectly through Settings construction in other tests. The non-sqlite URL and empty path branches have no test coverage. This is the core logic of the bugfix and deserves dedicated Behave scenarios.M3. Missing dedicated BDD tests for
_ensure_sqlite_parent_dir()branchesThe function has 4 branches (non-sqlite passthrough,
:prefix guard, normal mkdir success, OSError catch). Only partial indirect coverage exists. No test verifies the normal success path wheremkdiractually creates a directory.M4. Issue #1024 is closed with
State/Completedbut fix is NOT on masterThe linked issue was closed on 2026-03-28 with
State/Completedlabel, but the fix functions do not exist on master. The issue should be reopened.Inline Review Notes
src/cleveragents/application/container.py~line 182 —except OSError: passviolates exception propagation rules. Add debug logging at minimum.src/cleveragents/config/settings.py~line 628 —object.__setattr__is unnecessary; the Settings model is not frozen, so plainsetattr(self, attr, resolved)works and is more readable.features/steps/coverage_boost_steps.pylines 31-32, 70-73 — Loosened assertions accept any path ending incleveragents.dbwithout verifying it resolved under the expected base directory. Addassert str(Path.cwd()) in context.settings.database_url.noxfile.py—setuptools<81repeated in 5 sessions without DRY consolidation. Also, 3 sessions (dead_code,complexity,adr_compliance) don't use semgrep — the comment "pkg_resources for semgrep" is misleading.settings.py/container.py— IfCLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "), it passes the truthiness check andPath(" ")is used as base directory. Consider.strip()before the check.Code Quality Assessment (Positive)
The implementation logic is well-designed:
_resolve_sqlite_url()correctly handles all SQLite URL variants (after commit 2's fix)model_validatorapproach is clean and idiomatic for Settings_ensure_sqlite_parent_dir()properly separates directory creation from URL resolutionget_database_url()correctly usesCLEVERAGENTS_HOMEwith CWD fallback_check_database()ancestor walk is a reasonable improvement@tdd_expected_fail)Recommended Path Forward
fix/e2e-db-isolationper ticket metadataCloses #1024, and dependency link_resolve_sqlite_url()and_ensure_sqlite_parent_dir()OSErrorcatch in_ensure_sqlite_parent_dir()This review aligns with the existing REQUEST_CHANGES reviews from @hurui200320 and the two independent reviewer-pool reviews. The code itself is well-designed and addresses a real, unfixed bug — the blockers are all process-related and fixable.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
Review claimed by reviewer pool instance pr-reviewer-pool-3151342-1775157992. Dispatching independent code review.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Review claimed by reviewer pool instance pr-reviewer-pool-3151342-1775157992. Dispatching independent code review.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Independent Code Review — PR #1168 (self-authored — posted as comment)
Verdict: ❌ Request Changes
This is the 5th independent review of this PR. All prior reviews (from @hurui200320, reviewer-pool-1, reviewer-pool-2, and pr-reviewer-pool) reached the same conclusion: the implementation logic is sound but the PR has hard process blockers that prevent merge.
I independently verified the key findings and concur.
Verification: This PR Is NOT Redundant
I confirmed that
_resolve_sqlite_url,_ensure_sqlite_parent_dir, and_resolve_database_urlsdo not exist onorigin/master(HEADc81afea0). The masterget_database_url()still usesPath.cwd()as fallback. Issue #1024 was closed prematurely — the fix has not been merged.Hard Blockers
mergeable: false, branch is ~130 commits behind masterCloses #1024, no dependency link29620c4b) repairs commit 1 (44f84cc5) by adding:memory:guardsfix/e2e-db-isolation, PR usesbugfix/m4-sqlite-url-cwdsetuptools<81pins in 5 nox sessions +pip/buildarg reorderMajor Issues
OSErrorsuppression —except OSError: passswallows permission denied, disk full, etc.container.py~line 182_resolve_sqlite_url()(5 branches, only 3 covered indirectly)settings.pylines 26–50_ensure_sqlite_parent_dir()(4 branches, partial coverage)container.pylines 157–182State/Completedbut fix is NOT on masterMinor Issues
object.__setattr__unnecessary in model validator (model is not frozen) —settings.py~line 628coverage_boost_steps.pylines 31-32, 70-73setuptools<81repeated in 5 sessions without DRY consolidation —noxfile.pyCLEVERAGENTS_HOMEnot handled —settings.py/container.pyCode Quality (Positive)
The implementation logic is well-designed:
_resolve_sqlite_url()correctly handles all SQLite URL variantsmodel_validatorapproach is clean and idiomatic_ensure_sqlite_parent_dir()properly separates directory creation from URL resolutionget_database_url()correctly usesCLEVERAGENTS_HOMEwith CWD fallback_check_database()ancestor walk is a reasonable improvementRecommended Path Forward
fix/e2e-db-isolationper ticket metadataCloses #1024, and dependency linkOSErrorcatchAutomated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
Review claimed by reviewer pool instance pr-reviewer-pool-3983434-1775170710. Dispatching independent code review.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Independent Code Review — PR #1168 (self-authored — posted as comment)
Verdict: ❌ Request Changes
I've independently reviewed the full diff (12 files, 2 commits:
44f84cc5and29620c4b), the linked issue #1024, all prior review comments, and the current state oforigin/master.Independent Verification: This PR Is NOT Redundant
I confirmed that
_resolve_sqlite_url,_ensure_sqlite_parent_dir, and_resolve_database_urlsdo not exist on currentorigin/master(921c13f4). The masterget_database_url()still usesPath.cwd()as fallback without CLEVERAGENTS_HOME resolution. Issue #1024 was closed prematurely withState/Completed— the actual fix has not been merged. This PR contains real, needed changes.Hard Blockers (must fix before merge)
mergeable: false, branch is ~130+ commits behind masterCloses #1024, no dependency link29620c4b) repairs commit 1 (44f84cc5) by adding:memory:guardsfix/e2e-db-isolation, PR usesbugfix/m4-sqlite-url-cwdsetuptools<81pins in 5 nox sessions +pip/buildarg reorderMajor Issues
OSErrorsuppression —except OSError: passswallows permission denied, disk full, etc.container.py~line 182_resolve_sqlite_url()(5 branches, only 3 covered indirectly)settings.pylines 26–50_ensure_sqlite_parent_dir()(4 branches, partial coverage)container.pylines 157–182State/Completedbut fix is NOT on masterMinor Issues
object.__setattr__unnecessary in model validator (model is not frozen) —settings.py~line 628coverage_boost_steps.pylines 31-32, 70-73setuptools<81repeated in 5 sessions without DRY consolidation —noxfile.pyCLEVERAGENTS_HOMEnot handled —settings.py/container.pydead_code,complexity,adr_compliance) don't use semgrep — comment "pkg_resources for semgrep" is misleadingCode Quality (Positive)
The implementation logic is well-designed:
_resolve_sqlite_url()correctly handles all SQLite URL variantsmodel_validatorapproach is clean and idiomatic_ensure_sqlite_parent_dir()properly separates directory creation from URL resolutionget_database_url()correctly usesCLEVERAGENTS_HOMEwith CWD fallback_check_database()ancestor walk is a reasonable improvementRecommended Path Forward
fix/e2e-db-isolationper ticket metadataCloses #1024, and dependency linkOSErrorcatchThis review aligns with all prior REQUEST_CHANGES reviews (from @hurui200320 and multiple reviewer-pool instances). The code itself is well-designed and addresses a real, unfixed bug — the blockers are all process-related and fixable. Once addressed, this PR should be ready for approval and merge.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
Merge conflict detected. This PR has
mergeable: false— the branch has conflicts with master. The implementing agent needs to rebase this branch onto latest master before this PR can be reviewed and merged.Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-1168-1775242700]
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
🔴 Independent Code Review: REQUEST CHANGES
Summary
The implementation logic is well-designed —
_resolve_sqlite_url(), the_resolve_database_urlsPydantic model validator,_ensure_sqlite_parent_dir(), and theget_database_url()/_check_database()updates correctly address issue #1024's core requirements. However, multiple critical process violations and a merge conflict prevent this PR from being merged.I concur with the thorough REQUEST_CHANGES review by @hurui200320 (review #2916) and add the following independent assessment.
Critical Blockers (must fix before merge)
B1. PR has merge conflicts —
mergeable: falsebugfix/m4-sqlite-url-cwdonto currentorigin/masterand resolve all conflicts.B2. PR body is completely empty
Closes #1024), Forgejo dependency link.Closes #1024, and dependency link.B3. Commit 2 is a fixup of Commit 1 — violates atomic commit / build integrity
44f84cc5introduced_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without:memory:guards, breaking all in-memory database tests.29620c4bfixes this by adding:memory:guards andtry/except OSError.fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD.B4. Branch name does not match issue #1024 Metadata
Branch: fix/e2e-db-isolation.bugfix/m4-sqlite-url-cwd.fix/e2e-db-isolation, or get maintainer approval to update the issue metadata.B5. Unrelated
noxfile.pychanges bundledsetuptools<81pin (5 nox sessions) andpip/buildargument reorder address apkg_resourcescompatibility issue for semgrep — completely unrelated to the #1024 database URL fix.Major Issues
M1. Issue #1024 is closed but PR is unmerged — data integrity problem
State/Completedlabel and is closed, but this PR (the actual fix) has never been merged._resolve_sqlite_url,_ensure_sqlite_parent_dir,_resolve_database_urls) do not exist onorigin/master.M2.
Settings.database_urlandget_database_url()resolve to different default pathsSettings.database_urldefault →sqlite:///cleveragents.db→ resolved tosqlite:///{HOME}/cleveragents.dbget_database_url()fallback →sqlite:///{HOME}/.cleveragents/db.sqlitesettings.database_urldirectly (e.g.,_check_database(),build_info_data()) will reference a different DB file than container-managed services.M3. Missing dedicated BDD tests for
_resolve_sqlite_url()branches:memory:, absolute path, relative path.M4. Missing dedicated BDD tests for
_ensure_sqlite_parent_dir()branches:prefix guard, normal mkdir success, OSError catch.Inline Code Comments
src/cleveragents/application/container.pyline ~180 (except OSError: pass)OSErrorsuppression: This swallows all filesystem errors (permission denied, disk full, read-only FS). Per CONTRIBUTING.md §Exception Propagation: "Do not suppress errors." Add at minimum_logger.debug("sqlite_parent_mkdir_skipped", path=str(db_file.parent), exc_info=True)so failures are traceable.src/cleveragents/config/settings.pyline ~47 (:memory:guard)raw_path.startswith(":")catches:memory:but not SQLite URI filenames likefile:path?mode=memory&cache=shared. Add:if raw_path.startswith((":", "file:")): return urlto avoid mangling URI-style connection strings.src/cleveragents/config/settings.pyline ~621 (home_envcheck)CLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "), it passes the truthiness check andPath(" ")is used as base directory. Use.strip()before the check:home_env = (os.environ.get("CLEVERAGENTS_HOME") or "").strip() or None. Same issue exists incontainer.pyline ~254.features/steps/coverage_boost_steps.pylines ~31-32 (loosened assertions)startswith("sqlite:///")+endswith("cleveragents.db")accepts any path. Since these tests don't setCLEVERAGENTS_HOME, the resolved path should containPath.cwd(). Add:assert str(Path.cwd()) in context.settings.database_urlfor a meaningful check.Minor Issues
m1. Duplicated URL parsing logic
_resolve_sqlite_url()(settings.py) and_ensure_sqlite_parent_dir()(container.py) independently parsesqlite:///URLs with the same prefix-stripping and:check logic. Consider extracting a shared_parse_sqlite_path(url: str) -> str | Noneutility.m2.
object.__setattr__in Pydantic validatorobject.__setattr__is used in_resolve_database_urlsbut the model is not frozen — plainsetattrwould work and be more readable.Verdict
The implementation approach is correct and well-thought-out. The separation of URL resolution (Settings validator) from directory creation (engine-building helpers) is a good design choice that avoids premature
.cleveragents/directory creation. The:memory:handling in commit 2 is also correct.However, the PR cannot be merged due to:
Please address the critical blockers (B1–B5) and major issues (M1–M4), then re-request review.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-1168-1775359200]
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Independent Code Review: REQUEST CHANGES
I've reviewed the full diff (12 files, +175/−31 lines), both commits, the linked issue #1024, and the two prior reviews (freemo's self-review and hurui200320's detailed REQUEST_CHANGES). I concur with the prior reviewer's assessment on the critical blockers and add my own observations.
Hard Blockers (must fix before merge)
1. Merge conflicts — PR is unmergeable (
mergeable: false)The branch diverged from master at
d196e907but master is now atbbff42ac— hundreds of commits ahead. Thenoxfile.pyin particular has been substantially refactored on master (behave-parallel runner rewrite,_default_processes()changes). The PR cannot be merged in its current state. Per CONTRIBUTING.md, branches must be rebased onto master before merge.2. Empty PR body — CONTRIBUTING.md violation
The PR description is an empty string. CONTRIBUTING.md §Pull Request Process explicitly requires: a summary of changes, motivation, and a closing keyword (
Closes #1024). The rule states: "PRs submitted without a description or without an issue reference will not be reviewed."3. Non-atomic commits — Commit 2 repairs Commit 1
44f84cc5) introduces_resolve_sqlite_url()and_ensure_sqlite_parent_dir()but fails to handle:memory:SQLite URLs, breaking all in-memory database tests.29620c4b) adds the:memory:guards andtry/except OSErrorwrapping to fix commit 1.CONTRIBUTING.md §Atomic Commits: "Each commit must build and pass all tests." These must be squashed into a single commit.
4. Commit 2 missing
ISSUES CLOSEDfooterOnly commit 1 has
ISSUES CLOSED: #1024. Commit 2 has no issue reference footer. (Moot if squashed per item 3.)Significant Issues
5. Unrelated
noxfile.pychanges bundledThe
setuptools<81pins across 5 nox sessions and thepip/buildargument reorder in thebuildsession are infrastructure fixes unrelated to the #1024 database URL bug. CONTRIBUTING.md §Atomic Commits: "Never bundle cosmetic changes with functional changes." These should be a separate commit/PR.6. Missing dedicated BDD tests for new utility functions
_resolve_sqlite_url()has 5 distinct branches (non-sqlite URL, empty path,:memory:, absolute path, relative path)._ensure_sqlite_parent_dir()has 4 branches (non-sqlite passthrough,:prefix guard, normal mkdir, OSError catch). These are the core logic of the bugfix and deserve dedicated Behave scenarios, not just indirect coverage through Settings construction.7. Silent
OSErrorsuppression in_ensure_sqlite_parent_dir()(container.py~line 182)This swallows all filesystem errors (permission denied, disk full, read-only FS) without any logging. CONTRIBUTING.md §Exception Propagation: "Do not suppress errors." At minimum, add
_logger.debug(...)withexc_info=True.Minor Issues (address during rework)
8. Loosened test assertions don't verify resolution target (
coverage_boost_steps.py~line 32)Assertions changed from exact match to
startswith/endswith. The new assertions accept any path ending incleveragents.dbwithout verifying it resolves under the expected base directory. Since these tests clearCLEVERAGENTS_HOME, the resolved path should containPath.cwd().9.
Settings.database_urlvsget_database_url()default path divergence (settings.py~line 628)With default configuration, the Settings validator resolves
database_urltosqlite:///{HOME}/cleveragents.db, whileget_database_url()constructssqlite:///{HOME}/.cleveragents/db.sqlite. Code readingsettings.database_urldirectly will use a different database file than container-managed services. This pre-dates the PR but is amplified by the new validator making both paths absolute. At minimum, add a comment documenting this intentional divergence.10. Branch name mismatch
Issue #1024 Metadata specifies
Branch: fix/e2e-db-isolationbut the PR usesbugfix/m4-sqlite-url-cwd. Per CONTRIBUTING.md, the branch should match the ticket Metadata.11.
noxfile.pysetuptools<81comment misleading (~line 920, 1004, 1020, 1036)3 of the 5 sessions (
dead_code,complexity,adr_compliance) don't use semgrep directly — the comment# pkg_resources for semgrepis misleading for those sessions.What's Good
The implementation logic is sound:
_resolve_sqlite_url()correctly handles the SQLite URL prefix parsing and path resolutionmodel_validator(mode="after")approach is the right pattern for post-construction URL rewriting_ensure_sqlite_parent_dir()properly separates directory creation from URL resolution to avoid premature.cleveragents/creation_check_database()ancestor walk is a reasonable improvement for cases where intermediate directories don't exist yetCLEVERAGENTS_HOMEfrom shared setup) correctly align with the new resolution behaviorRequired Actions
origin/masterand resolve all conflictsCloses #1024noxfile.pychanges into a separate PR_resolve_sqlite_url()and_ensure_sqlite_parent_dir()branchesOSErrorcatch in_ensure_sqlite_parent_dir()Note on Issue #1024 Status
Issue #1024 is currently closed with
State/Completed, but the fix commits are NOT on master — they only exist on this PR branch. The issue appears to have been closed prematurely. It should be reopened once this PR is reworked.Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-1168-1775364500]
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Independent Code Review — PR #1168 (Posted as comment — self-authored PR)
Verdict: ❌ Request Changes
The core implementation is well-designed — using a Pydantic model validator to resolve relative SQLite paths is the right architectural approach, and the separation of
_ensure_sqlite_parent_dir()fromget_database_url()correctly avoids premature.cleveragents/directory creation that would breakagents init. The_check_database()ancestor walk is a sensible improvement.However, there are blocking process violations and code quality issues that must be addressed before this PR can be approved.
Blocking Issues
B1. Merge conflicts — PR is not mergeable
The PR has
mergeable: false. The branch must be rebased onto currentorigin/masterand all conflicts resolved before re-requesting review. Per CONTRIBUTING.md: branches must always be rebased onto the target branch.B2. Empty PR body
The PR description is completely empty. CONTRIBUTING.md §Pull Request Process requires:
Closes #1024)CONTRIBUTING.md explicitly states: "PRs submitted without a description or without an issue reference will not be reviewed."
B3. Non-atomic commits — Commit 2 is a fixup of Commit 1
Commit 1 (
44f84cc5) introduced_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without:memory:guards, which would break all in-memory database tests. Commit 2 (29620c4b) adds those guards. This means Commit 1 does not pass all tests on its own, violating CONTRIBUTING.md: "Each commit must build and pass all tests" and "Only commit when a piece of functionality is fully implemented and tested."Action: Squash both commits into a single atomic commit using the ticket-prescribed message:
fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWDB4. Commit 2 missing
ISSUES CLOSEDfooterOnly Commit 1 has
ISSUES CLOSED: #1024. Per CONTRIBUTING.md, every commit must reference the issue. (Moot if squashed per B3.)B5. Unrelated
noxfile.pychanges bundledThe
setuptools<81pins across 5 nox sessions and thepip/buildargument reorder in thebuildsession are infrastructure fixes unrelated to the #1024 database URL resolution bug. Per CONTRIBUTING.md §Atomic Commits: "Never bundle cosmetic changes with functional changes." These should be extracted to a separate commit/PR.Code Quality Issues
C1. Silent
OSErrorsuppression in_ensure_sqlite_parent_dir()(container.py)The
except OSError: passpattern swallows all filesystem errors — permission denied, disk full, read-only filesystem. While documented as "best-effort," CONTRIBUTING.md §Exception Propagation states: "Do not suppress errors." At minimum, add adebug-level log:C2. Duplicated URL parsing logic between
settings.pyandcontainer.pyBoth
_resolve_sqlite_url()and_ensure_sqlite_parent_dir()independently parsesqlite:///URLs with identical prefix-stripping and:check logic. If one is updated without the other, they'll diverge. Consider extracting a shared_parse_sqlite_path(url: str) -> Path | Noneutility, or at minimum add cross-reference comments linking the two implementations.C3. Divergent default database paths (pre-existing, amplified)
Settings.database_urldefaults tosqlite:///cleveragents.db→ resolves to{HOME}/cleveragents.db, whileget_database_url()constructssqlite:///{HOME}/.cleveragents/db.sqlite. Code readingsettings.database_urldirectly (e.g.,PlanService.get_memory_service(),_check_database(),build_info_data()) uses a different database file than container-managed services. This PR amplifies the divergence by making both paths absolute. At minimum, add a prominent comment documenting this intentional divergence.C4. Whitespace-only
CLEVERAGENTS_HOMEedge case (settings.py line ~621, container.py line ~254)If
CLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "), it passes the truthiness check andPath(" ")is used as the base directory. Add.strip()before the truthiness check:Test Coverage Issues
T1. Missing dedicated BDD tests for
_resolve_sqlite_url()The function has 5 distinct branches (non-sqlite URL, empty path,
:memory:, absolute path, relative path). Only 3 are covered indirectly through Settings construction. The non-sqlite URL and empty path branches have no test coverage. This is the core logic of the bugfix and deserves dedicated Behave scenarios.T2. Missing dedicated BDD tests for
_ensure_sqlite_parent_dir()The function has 4 branches (non-sqlite passthrough,
:prefix guard, normal mkdir success, OSError catch). Coverage is incomplete. Add BDD scenarios testing each input type.T3. Loosened assertions don't verify resolution target (coverage_boost_steps.py)
Assertions changed from exact match (
== "sqlite:///cleveragents.db") tostartswith/endswith. The new assertions accept any path ending incleveragents.dbwithout verifying it resolves under the expected base directory. Since these tests clearCLEVERAGENTS_HOME, the resolved path should containPath.cwd()— add that assertion:Minor Issues
bugfix/m4-sqlite-url-cwdbut ticket #1024 Metadata specifiesBranch: fix/e2e-db-isolation.object.__setattr__vssetattr— In the model validator (settings.py),object.__setattr__is used but the model is not frozen. Plainsetattrwould work and be more readable.setuptools<81repeated in 5 nox sessions without DRY consolidation — Same install line duplicated. 3 of the sessions (dead_code,complexity,adr_compliance) don't use semgrep directly — comments are misleading.Summary
The implementation correctly addresses bug #1024. The architectural decisions are sound:
:memory:and absolute path guardsBut the PR cannot be merged due to:
_ensure_sqlite_parent_dir()Recommended actions:
origin/masterand resolve conflictsCloses #1024_resolve_sqlite_url()and_ensure_sqlite_parent_dir()OSErrorcatch.strip()toCLEVERAGENTS_HOMEchecksAutomated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-1168-1775369700]
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
PR #1168 Review —
fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWDVerdict: ❌ REQUEST CHANGES (posted as COMMENT due to self-authored PR restriction)
Review focus areas: specification-compliance, error-handling-patterns, security-concerns
Previous Review Status
A detailed REQUEST_CHANGES review was posted by @hurui200320 on 2026-03-30 (review #2916) identifying 3 critical, 6 major, and 7 minor issues. The head commit remains at
29620c4b(dated 2026-03-27) — no new commits have been pushed since the review was posted. Therefore, none of the previously requested changes have been addressed.This review independently confirms the outstanding issues and adds observations from the assigned focus areas.
⚠️ Merge Conflict Notice
The PR is currently not mergeable (
mergeable: false). The branch must be rebased onto currentmasterand conflicts resolved before merge. This is noted but does not block the code quality evaluation below.Critical Issues (Must Fix)
C1. Empty PR Description — Blocks Review Per CONTRIBUTING.md
Closes #1024closing keyword, Forgejo dependency link.Closes #1024.C2. Commit 2 Repairs Commit 1 — Violates Atomic Commit Rule
44f84cc5→29620c4b_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without:memory:guards, breaking all in-memory database tests. Commit 2 fixes this by adding the guards andtry/except OSError. Per CONTRIBUTING.md: "Each commit must build and pass all tests" and "Only commit when a piece of functionality is fully implemented and tested."fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD.C3. Branch Name Mismatch
bugfix/m4-sqlite-url-cwdvs ticket #1024 Metadata specifyingfix/e2e-db-isolationSpecification Compliance Issues (Focus Area)
S1.
Settings.database_urlandget_database_url()Resolve to Different Default Pathssrc/cleveragents/config/settings.py(validator) andsrc/cleveragents/application/container.py(get_database_url())database_urltosqlite:///{HOME}/cleveragents.db, whileget_database_url()constructssqlite:///{HOME}/.cleveragents/db.sqlite. Code that readssettings.database_urldirectly (e.g.,PlanService.get_memory_service(),_check_database()diagnostics,build_info_data()) will use a different database file than container-managed services. The specification states the default database is at~/.cleveragents/cleveragents.db— neither path matches exactly.S2. Missing Dedicated BDD Tests for Core Fix Logic
src/cleveragents/config/settings.py—_resolve_sqlite_url()has 5 branches (non-sqlite, empty path,:memory:, absolute, relative). Only 3 are covered indirectly.src/cleveragents/application/container.py—_ensure_sqlite_parent_dir()has 4 branches. Only the OSError path is indirectly covered._resolve_sqlite_url()have no test coverage.Error Handling Issues (Focus Area)
E1. Silent
OSErrorSuppression in_ensure_sqlite_parent_dir()src/cleveragents/application/container.py,_ensure_sqlite_parent_dir()except OSError: passpattern silently swallows all filesystem errors including permission denied, disk full, and read-only filesystem. CONTRIBUTING.md §Exception Propagation states: "Do not suppress errors." While the docstring documents this as "best-effort," the fail-fast principle requires at minimum logging the error._logger.debug("sqlite_parent_mkdir_skipped", path=str(db_file.parent), exc_info=True)so filesystem errors are traceable in debug logs rather than silently lost.E2. Pre-existing
# type: ignoreinget_ai_provider()src/cleveragents/application/container.py,get_ai_provider(), lines ~207-208# type: ignorecomments on the mock import lines violate the project's strict "no type: ignore" rule. This was present before this PR but is in a file being modified.Security Concerns (Focus Area)
SEC1. No Path Containment Validation in
_resolve_sqlite_url()src/cleveragents/config/settings.py,_resolve_sqlite_url()../sequences could resolve outsideCLEVERAGENTS_HOME. The code documents this as intentional ("database_url is admin-configured, not untrusted user input"), which is a reasonable stance.base_dirto aid operational troubleshooting.SEC2. Whitespace-Only
CLEVERAGENTS_HOMEEdge Casesettings.py(validator) andcontainer.py(get_database_url())CLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "), it passes the truthiness check andPath(" ")is used as the base directory, creating database files in unexpected locations..strip()before the truthiness check:home_env = (os.environ.get("CLEVERAGENTS_HOME") or "").strip() or NoneProcess Issues
P1. Unrelated
noxfile.pyChanges Bundlednoxfile.py—setuptools<81pins added to 5 sessionspkg_resourcescompatibility issue for semgrep and are unrelated to the #1024 database URL resolution bug. CONTRIBUTING.md §Atomic Commits: "Do not mix concerns."P2. Missing
ISSUES CLOSEDFooter on Commit 229620c4bPositive Aspects
The implementation logic is well-designed:
_resolve_sqlite_url()correctly handles the 5 URL variants with clear branching_ensure_sqlite_parent_dir()correctly separates directory creation from URL resolution to avoid premature.cleveragents/creationget_database_url()update withCLEVERAGENTS_HOMEfallback to CWD is the right approach_check_database()ancestor walk handles the case where intermediate directories don't exist yet:memory:guards added in commit 2 are correct and necessarySummary
The core implementation logic is sound and correctly addresses the ticket's acceptance criteria. However, the PR has severe process violations (empty body, fixup commit, branch name mismatch, merge conflicts, bundled unrelated changes) and missing test coverage for the new utility functions that prevent approval.
No changes have been made since the previous REQUEST_CHANGES review on 2026-03-30. All previously identified issues remain outstanding.
Decision: REQUEST CHANGES 🔄
The following must be addressed before approval:
Closes #1024(C1)_resolve_sqlite_url()and_ensure_sqlite_parent_dir()(S2)except OSError: passwith debug logging (E1).strip()toCLEVERAGENTS_HOMEhandling (SEC2)Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer
PR #1168 Review —
fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWDReview focus areas: architecture-alignment, module-boundaries, interface-contracts
Review reason: stale-review (Priority/Critical — no APPROVED or REQUEST_CHANGES from independent reviewer since hurui200320's review on 2026-03-30)
Previous Review Status
@hurui200320 posted a thorough REQUEST_CHANGES review (#2916) on 2026-03-30 identifying 3 critical, 6 major, and 7 minor issues. Two self-authored COMMENT reviews by @freemo (#2914, #3768) independently confirmed all findings. The head commit remains at
29620c4b(dated 2026-03-27) — no new commits have been pushed since the reviews were posted. All previously identified issues remain outstanding.This review independently confirms the critical issues and adds architecture-focused findings from my assigned focus areas.
⚠️ Merge Conflict Notice
The PR is currently not mergeable (
mergeable: false). The branch must be rebased onto currentmasterand conflicts resolved before merge.Critical Issues (Must Fix)
C1. Empty PR Description — Blocks Review Per CONTRIBUTING.md
Closes #1024closing keyword, Forgejo dependency link.Closes #1024.C2. Commit 2 Repairs Commit 1 — Violates Atomic Commit Rule
44f84cc5→29620c4b_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without:memory:guards, breaking all in-memory database tests. Commit 2 adds the guards andtry/except OSErrorto fix commit 1. Per CONTRIBUTING.md: "Each commit must build and pass all tests" and "Only commit when a piece of functionality is fully implemented and tested."fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD.C3. Branch Name Mismatch
bugfix/m4-sqlite-url-cwdvs ticket #1024 Metadata specifyingfix/e2e-db-isolationArchitecture Alignment Issues (Focus Area: architecture-alignment)
A1. [CRITICAL]
Settings.database_urlandget_database_url()Resolve to Different Default Paths — Interface Contract ViolationFiles:
src/cleveragents/config/settings.py(model validator) andsrc/cleveragents/application/container.py(get_database_url())Problem: This is the most significant architecture issue in this PR. With default configuration (no explicit
CLEVERAGENTS_DATABASE_URL):database_urldefaultsqlite:///cleveragents.db→sqlite:///{CLEVERAGENTS_HOME}/cleveragents.dbget_database_url()function constructs →sqlite:///{CLEVERAGENTS_HOME}/.cleveragents/db.sqliteThese are two completely different database file paths. Code that reads
settings.database_urldirectly (e.g.,PlanService.get_memory_service(),_check_database()diagnostics,build_info_data()) will use a different database file than container-managed services that go throughget_database_url().This violates the Single Source of Truth principle for database configuration. The specification states the default database is at
~/.cleveragents/cleveragents.db— neither path matches exactly.Impact: Data could silently be written to two different database files. This PR amplifies the divergence by making both paths absolute, making the split permanent rather than coincidental.
Required: Align both paths to a single canonical location. Either:
get_database_url()delegate toSettings.database_url(preferred — single source of truth), orSettings.database_urldefault match the container's canonical path (sqlite:///.cleveragents/db.sqlite), orModule Boundary Issues (Focus Area: module-boundaries)
B1. Duplicated URL Parsing Logic Across Module Boundaries
src/cleveragents/config/settings.py(_resolve_sqlite_url()) andsrc/cleveragents/application/container.py(_ensure_sqlite_parent_dir())sqlite:///URLs with the same prefix-stripping and:check logic. This creates a maintenance hazard — if one is updated without the other, they could diverge silently. The config module and application module should not independently implement the same URL parsing contract._parse_sqlite_path(url: str) -> str | Noneutility into a shared location (e.g.,cleveragents.shared.database_utilsor withinconfig/settings.pyas the canonical location) and have both functions delegate to it.B2.
_ensure_sqlite_parent_dir()Adds Filesystem Side Effects to DI Wiringsrc/cleveragents/application/container.py_build_*function (8+ call sites) now calls_ensure_sqlite_parent_dir()before creating an engine. This adds filesystem side effects (directory creation) to what should be pure DI wiring/factory functions. The container module's responsibility is dependency assembly, not filesystem management.get_database_url()itself (after the URL is resolved) or in a dedicated initialization step — rather than scattering it across every factory function.Interface Contract Issues (Focus Area: interface-contracts)
I1.
_resolve_sqlite_url()Contract Not Documented for Callerssrc/cleveragents/config/settings.py:memory:, absolute path, relative path) but the docstring doesn't specify the contract for each. Callers (the model validator) need to know: what inputs produce what outputs? What invariants are maintained?I2. Silent
OSErrorSuppression Violates Error Handling Contractsrc/cleveragents/application/container.py,_ensure_sqlite_parent_dir()except OSError: passpattern silently swallows all filesystem errors including permission denied, disk full, and read-only filesystem. CONTRIBUTING.md §Exception Propagation states: "Do not suppress errors." While the docstring documents this as "best-effort," the fail-fast principle requires at minimum logging the error._logger.debug("sqlite_parent_mkdir_skipped", path=str(db_file.parent), exc_info=True)so filesystem errors are traceable in debug logs.I3. Whitespace-Only
CLEVERAGENTS_HOMEEdge Casesettings.py(validator) andcontainer.py(get_database_url())CLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "), it passes the truthiness check andPath(" ")is used as the base directory, creating database files in unexpected locations..strip()before the truthiness check:home_env = (os.environ.get("CLEVERAGENTS_HOME") or "").strip() or NoneProcess Issues
P1. Unrelated
noxfile.pyChanges Bundlednoxfile.py—setuptools<81pins added to 5 sessionspkg_resourcescompatibility issue for semgrep and are unrelated to the #1024 database URL resolution bug. CONTRIBUTING.md §Atomic Commits: "Do not mix concerns."P2. Missing Dedicated BDD Tests for Core Fix Logic
src/cleveragents/config/settings.py—_resolve_sqlite_url()has 5 branches. Only 3 are covered indirectly.src/cleveragents/application/container.py—_ensure_sqlite_parent_dir()has 4 branches. Only the OSError path is indirectly covered.P3. Pre-existing
# type: ignorein Modified Filesrc/cleveragents/application/container.py,get_ai_provider()— two# type: ignorecomments on mock import linesPositive Aspects
The core implementation approach is well-designed:
_resolve_sqlite_url()correctly handles the 5 URL variants with clear branching_ensure_sqlite_parent_dir()correctly separates directory creation from URL resolution to avoid premature.cleveragents/creation (good architectural thinking)get_database_url()update withCLEVERAGENTS_HOMEfallback to CWD is the right approach_check_database()ancestor walk handles the case where intermediate directories don't exist yet:memory:guards added in commit 2 are correct and necessarySummary
The implementation logic correctly addresses the ticket's acceptance criteria for resolving SQLite database URLs relative to
CLEVERAGENTS_HOME. However, the PR has:No changes have been made since the previous REQUEST_CHANGES review on 2026-03-30. All previously identified issues remain outstanding.
Decision: REQUEST CHANGES 🔄
The following must be addressed before approval:
Closes #1024(C1)Settings.database_urlandget_database_url()to the same default path (A1 — most important code change)_resolve_sqlite_url()and_ensure_sqlite_parent_dir()(P2)except OSError: passwith debug logging (I2).strip()toCLEVERAGENTS_HOMEhandling (I3)Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-self-reviewer
PR #1168 Review —
fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWDReview focus areas: security-concerns, input-validation, access-control
Review reason: stale-review (Priority/Critical — fresh security-focused perspective)
Commit Status Check
The head commit remains at
29620c4b(dated 2026-03-27). No new commits have been pushed since the previous REQUEST_CHANGES reviews by @hurui200320 (#2916, 2026-03-30) and @HAL9000 (#4282, 2026-04-08). All previously identified issues remain outstanding.⚠️ State Inconsistency
Issue #1024 is closed with
State/Completedlabel, but this PR is still open and unmerged with merge conflicts. Either the issue was closed prematurely, or the fix was landed through a different path. This needs reconciliation.Previously Identified Critical Issues (Still Outstanding)
The following critical issues from prior reviews remain unaddressed. I independently confirm they still apply:
Closes #1024, no summary)bugfix/m4-sqlite-url-cwdvs ticket'sfix/e2e-db-isolation)mergeable: false_resolve_sqlite_url()and_ensure_sqlite_parent_dir()I will not re-enumerate all prior findings. See reviews #2916 and #4282 for the full list.
New Security-Focused Findings (Focus Area: security-concerns)
SEC1. [MEDIUM]
_ensure_sqlite_parent_dir()Creates Directories with Default Umask Permissionssrc/cleveragents/application/container.py,_ensure_sqlite_parent_dir()Path(raw_path).parent.mkdir(parents=True, exist_ok=True)creates directories using the process's default umask. In multi-user environments, shared hosting, or CI runners with permissive umasks, this could create world-readable directories (e.g.,0o755or0o777) containing the SQLite database file. The database may contain sensitive data (session history, LLM traces, audit logs, API-adjacent data).Path(raw_path).parent.mkdir(parents=True, exist_ok=True, mode=0o700). This ensures only the owning user can access the database directory. Note:modeonly affects newly created directories; existing directories retain their permissions.SEC2. [MEDIUM] Raw Environment Variable Passthrough Without Scheme Validation
src/cleveragents/application/container.py,get_database_url()CLEVERAGENTS_DATABASE_URLandCLEVERAGENTS_TEST_DATABASE_URLenvironment variable values directly without any validation: While the docstring notes these are "admin-configured," environment variables can be set by CI systems, container orchestrators, init systems, or.envfiles that may have broader write access than intended. A malicious or misconfigured value likesqlite:///../../etc/shadowor a non-SQLite scheme likepostgresql://attacker.com/exfilwould be passed through without any validation.sqlite:///,postgresql://, etc.) and log a warning for unexpected schemes. At minimum, add a debug log when an explicit env var override is used, so operators can trace unexpected database connections.SEC3. [LOW] Silent Error Suppression Masks Security-Relevant Filesystem Errors
src/cleveragents/application/container.py,_ensure_sqlite_parent_dir()except OSError: passpattern silently swallows ALL filesystem errors. This includes:PermissionError(EACCES) — attempting to create directories in protected locationsEROFS— read-only filesystem (could indicate a security hardening measure being bypassed)ENOSPC— disk full (could indicate a denial-of-service condition)These are security-relevant signals that should at minimum be logged for operational visibility.
except OSError: passwith:New Input Validation Findings (Focus Area: input-validation)
IV1. [MEDIUM] Whitespace-Only
CLEVERAGENTS_HOMEAccepted as Validsrc/cleveragents/config/settings.py(model validator) andsrc/cleveragents/application/container.py(get_database_url())CLEVERAGENTS_HOMEis set to whitespace-only (e.g.," "or"\t"), it passes the truthiness check andPath(" ")is used as the base directory. This creates database files in a directory literally named" "(space), which is:.strip()before the truthiness check in both locations:IV2. [LOW]
_resolve_sqlite_url()Doesn't Handle SQLite URI Filenamessrc/cleveragents/config/settings.py,_resolve_sqlite_url()sqlite:///file:path?mode=memory&cache=sharedwould be treated as a relative filesystem path and mangled by path resolution. While not currently used in the codebase, this is a latent correctness issue that could cause unexpected behavior if URI filenames are adopted in the future.if raw_path.startswith((":", "file:")): return urlNew Access Control Findings (Focus Area: access-control)
AC1. [INFO] Dual Database Path Creates Split Access Control Surface
src/cleveragents/config/settings.py(validator) andsrc/cleveragents/application/container.py(get_database_url())Settings.database_urlresolves tosqlite:///{HOME}/cleveragents.dbwhileget_database_url()constructssqlite:///{HOME}/.cleveragents/db.sqlite. This means:AC2. [INFO] Pre-existing
# type: ignorein Modified Filesrc/cleveragents/application/container.py,get_ai_provider(), mock import lines# type: ignorecomments exist on the mock import lines. While pre-existing and not introduced by this PR, these are in a security-sensitive function (provider selection) in a file being modified. The# type: ignoresuppression could mask type errors that have security implications (e.g., importing the wrong mock class).Summary
No changes have been made since the previous REQUEST_CHANGES reviews. All 3 critical, 6 major, and 7+ minor issues from prior reviews remain outstanding.
This security-focused review adds:
The core implementation logic remains sound, but the PR cannot be approved until the outstanding issues are addressed.
Decision: REQUEST CHANGES 🔄
Priority action items for the author:
.strip()toCLEVERAGENTS_HOMEhandling (IV1)except OSError: passwith debug logging (SEC3)mode=0o700onmkdircalls (SEC1)Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-self-reviewer
PR #1168 Review —
fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWDReview focus areas: specification-compliance, error-handling-patterns, test-coverage-quality
Reviewer: HAL9000 (independent, non-author)
Context & Commit Status
Head commit:
29620c4b(dated 2026-03-27). No new commits have been pushed since the PR was opened. All previously-requested changes from @hurui200320 (#2916), prior HAL9000 reviews (#4282, #4328), and multiple @freemo comment reviews remain unaddressed.I independently confirm this PR's changes (
_resolve_sqlite_url,_ensure_sqlite_parent_dir,_resolve_database_urls) are not already on master — prior reviewers who verified the master branch at various SHAs all reached the same conclusion. The PR is not redundant.Hard Blockers (merge cannot proceed)
B1. Empty PR Description — CONTRIBUTING.md §Pull Request Process violation
The PR body is completely empty (
""). CONTRIBUTING.md states: "PRs submitted without a description or without an issue reference will not be reviewed." Required: summary of changes,Closes #1024closing keyword, and a Forgejo dependency link. Additionally, issue #1024 is currently closed while this PR is unmerged — this state inconsistency must be explained in the description.B2. Merge Conflict —
mergeable: falseThe branch diverged from master at
d196e90779a1. The branch must be rebased onto current master before merge. This is a prerequisite regardless of code quality.B3. Two Commits, Second Repairs First — Violates Atomic Commit Rule
44f84cc5): Introduced_resolve_sqlite_url()and_ensure_sqlite_parent_dir()without:memory:guards, breaking in-memory DB tests.29620c4b): Added:memory:guards andtry/except OSErrorto fix Commit 1.CONTRIBUTING.md: "Each commit must build and pass all tests. Do not fix up commits from the same branch." These must be squashed into one complete, atomic commit.
Assessment: Specification Compliance ✅
The implementation logic correctly addresses the spec requirement for
CLEVERAGENTS_HOME-relative database paths:_resolve_sqlite_url()insettings.py: Correct Pydanticmodel_validator(mode="after")approach. All edge cases handled: non-SQLite URLs pass through, absolute paths pass through,:memory:strings pass through, empty paths pass through._resolve_database_urlsmodel validator: Correctly iterates bothdatabase_urlandtest_database_url. Usesobject.__setattr__(correct for Pydantic v2 model mutation in validators). Falls back toPath.cwd()whenCLEVERAGENTS_HOMEis unset.get_database_url()incontainer.py: Correctly prioritises explicit env vars, then resolves toCLEVERAGENTS_HOME/.cleveragents/db.sqlite. The deferred directory creation (via_ensure_sqlite_parent_dir) correctly avoids premature.cleveragents/creation that would breakagents initdetection — well-documented._check_database()ancestor walk insystem.py: Logical improvement; correctly handles the pre-init state where intermediate directories don't yet exist.The acknowledged limitation in
_resolve_sqlite_url()'s docstring (no../containment check) is acceptable — this is admin-configured input, not untrusted user input, and is a pre-existing gap, not a regression.Assessment: Error Handling Patterns ⚠️
EH1. Silent
OSErrorsuppression in_ensure_sqlite_parent_dir()except OSError: passis completely silent. This is inconsistent with the project's error handling conventions throughoutcontainer.py(see_build_skill_serviceand_build_session_service, which use structlog_logger.warning(...)for caught operational exceptions).Recommendation: Replace
passwith:The
_loggerstructlog instance is already defined at module level incontainer.py.Assessment: Test Coverage Quality ⚠️
TC1. No Isolated BDD Unit Scenarios for
_resolve_sqlite_url()Branchesfeatures/tdd_sqlite_url_cwd.featuretests the full integration path (Settings instantiation +get_database_url()). There are no isolated Behave scenarios directly exercising_resolve_sqlite_url()for:postgresql://...)sqlite:////abs/path/db):memory:passthrough (sqlite:///:memory:)sqlite:///)These are all distinct code branches. Without isolated tests, a future regression in any branch won't be caught at the unit level. Recommendation: Add a dedicated feature file with Behave scenarios that call
_resolve_sqlite_url()directly.TC2.
@tdd_expected_failtag correctly absent ✅The fix removes the bug, so no
@tdd_expected_failtag is needed.@tdd_bug_1024permanent regression markers are correctly present.TC3.
coverage_boost_steps.pyassertion correctly updated ✅Changed from exact-match
== "sqlite:///cleveragents.db"toendswith("cleveragents.db")to accommodate the now-absolute resolved path. Correct.TC4. Robot helper uses
Settings._instance = Noneinstead ofSettings.reset()robot/helper_tdd_sqlite_url_cwd.pydirectly setsSettings._instance = Nonerather than calling the publicSettings.reset()API documented for test teardown. This works, but is fragile if the internal attribute name changes. PreferSettings.reset().Minor Observations
M1.
noxfile.pysetuptools<81pin bundles unrelated concern6 lines adding a
setuptools<81semgrep pin are included in this PR. Per CONTRIBUTING.md §Atomic Commits, unrelated changes should be in a separate commit. (Pre-existing concern noted by @freemo in #2914.)M2. All new functions fully type-annotated ✅
M3.
from __future__ import annotationspresent in all modified files ✅M4. No
# type: ignorein any new code ✅ (The pre-existing# type: ignore[override]onmodel_post_initis out of scope for this PR.)Summary
# type: ignore(new code)Verdict: ❌ REQUEST CHANGES
The implementation logic is well-designed and correct. I would approve the code itself. However, three hard process blockers (empty PR description, merge conflict, non-atomic commit history) must be resolved per CONTRIBUTING.md before merge is possible. Additionally, the silent
OSErrorsuppression should be converted to a structureddebug-level log, and isolated BDD unit scenarios for_resolve_sqlite_url()branches would materially improve coverage quality.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
PR Review — Round 2
HEAD:
29620c4| Commits in branch: 2 (44f84cc+29620c4)✅ Issues Resolved Since Last Review
Closes #NCloses #1024present@tdd_expected_failtags not removed.featureand.robotfiles🔴 Blocking Issues (must fix before merge)
B1 — Fix-up commit violates "no fix-up commits" rule
CONTRIBUTING.md is explicit: no fix-up commits in the same branch. The branch contains two commits:
44f84cc—fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD29620c4—fix(config): preserve special SQLite URLs in database path resolutionCommit
29620c4is a textbook fix-up: it exists solely to patch bugs introduced by44f84cc(:memory:mishandling,OSErrorcrash on invalid absolute paths). These must be squashed into a single atomic commit before merge. The final commit message should incorporate the full context from both.B2 —
_ensure_sqlite_parent_dirsilently swallowsOSErrorwithout loggingThe PR description and the function's own docstring both state:
The implementation does neither:
This was flagged in the previous review. The docstring must be corrected or a log call must be added. Claiming to log and then not logging is a correctness issue in the contract, not just style. At minimum use
logger.debug(...)orlogger.warning(...). Example:B3 — Unrelated
noxfile.pychanges still bundled (now larger)This was flagged in the previous review. The
noxfile.pydiff has grown from the original complaint to six separate hunks touching unrelated sessions:build: argument reorder ("build", "pip"→"pip", "build")pre_commit,security_scan,dead_code,complexity,adr_compliance: each addssession.install("setuptools<81")None of these changes are related to the SQLite URL resolution fix for #1024. Per CONTRIBUTING.md, commits must be atomic — one commit, one concern. These
noxfile.pychanges must be moved to a separate PR (or dropped if they are not ready).🟡 Non-Blocking Concerns (should address)
N1 —
core_cli_commands.robot: removal ofCLEVERAGENTS_HOMEmay affect other test casesThe setup keyword previously created an isolated
CLEVERAGENTS_HOMEdirectory and set the env var. The replacement comment says individual test cases usecwd=...and expect DB files relative to CWD. However, this change means any test case in the suite that does not setcwd=explicitly will now inherit whateverCLEVERAGENTS_HOMEthe CI runner happens to have set (or none). Please confirm that no other test case incore_cli_commands.robotrelied on the old guaranteed-clean home directory.N2 —
_resolve_sqlite_url: acknowledged path traversal gap has no mitigationThe code comment reads:
This acknowledgement is fine as documentation, but it means a misconfigured env var like
CLEVERAGENTS_DATABASE_URL=sqlite:///../../etc/passwd.dbsilently resolves to an arbitrary path. Please confirm this is an intentional, accepted risk and that it is tracked (e.g., in a follow-up issue). If so, the comment is sufficient; this is not a blocker.N3 —
full nox -s unit_testswas not runThe Testing section of the PR body explicitly states:
The full Behave suite must pass before merge. Please either run it in CI or provide the full output. A partial manual run is not sufficient evidence of correctness.
Summary
Three blocking issues remain:
OSError/ misleading docstring — add the log call that was promisednoxfile.pychanges — move to a separate PRThe core logic of the fix (
_resolve_sqlite_url+_resolve_database_urlsvalidator +get_database_url()update) is sound and the approach is correct. Once the process issues above are resolved, this should be straightforward to approve.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Code Review: REQUEST CHANGES
This PR correctly addresses issue #1024 by resolving relative SQLite database URLs against
CLEVERAGENTS_HOMEinstead of CWD. The implementation approach is sound — adding a_resolve_sqlite_url()function insettings.pyand_ensure_sqlite_parent_dir()helper incontainer.py. However, there are 4 blocking issues that must be resolved before this PR can be merged.❌ Blocking Issues
1. Merge Conflicts (mergeable: false)
The PR currently has merge conflicts with
masterand cannot be merged. Please rebase the branch on the latestmasterand resolve all conflicts before requesting re-review.2. CI Failures — unit_tests
The CI
unit_testsjob is failing with 2 scenarios:features/application_container_coverage_boost.feature:54 – Build session factory with invalid URL raises an errorOperationalErrorbut no error was raised. The test was updated to usesqlite:////nonexistent_root/path/to/db.sqlitebut_ensure_sqlite_parent_dirsilently swallows theOSErrorand the engine does not raise at factory creation time. The test needs to actually trigger the error (e.g., by creating a session and executing a query against the factory).features/consolidated_misc.feature:1815 – check_database with missing parent dirAssertionError— the_check_database()ancestor-walk logic insystem.pyis not correctly reportingERRORstatus when the parent directory is missing/non-writable.3. CONTRIBUTORS.md Not Updated
Per CONTRIBUTING.md requirements,
CONTRIBUTORS.mdmust be updated when contributing code. This file is absent from the list of changed files in this PR.4. HEAD Commit Missing
ISSUES CLOSED:FooterThe HEAD commit (
29620c4b) —fix(config): preserve special SQLite URLs in database path resolution— does not include the requiredISSUES CLOSED: #1024footer per the Conventional Changelog standard. All commits in the PR must include this footer. Please amend or squash this commit to include the footer.✅ What Looks Good
44f84cc5) has the correctISSUES CLOSED: #1024footerCloses #1024in the descriptionv3.3.0is correctly assignedType/label (Type/Bug) is presentCHANGELOG.mdis updated@tdd_expected_failtags have been properly removed from both Behave and Robot tests_resolve_sqlite_url()correctly handles edge cases (:memory:,file:URIs, absolute paths)_ensure_sqlite_parent_dir()is correctly placed in engine-building helpers (not in URL resolution)noxfile.pysetuptools<81additions are a reasonable workaround for semgrep compatibilityPlease address all 4 blocking issues and request re-review.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Worker: [AUTO-REV-1168]
Code Review Decision: REQUEST CHANGES
This PR correctly addresses issue #1024 but has 4 blocking issues that must be resolved:
Merge Conflicts —
mergeable: false. Please rebase on latestmasterand resolve all conflicts.CI Failures (unit_tests) — Two Behave scenarios are failing:
features/application_container_coverage_boost.feature:54— ExpectedOperationalErrorbut no error was raised. The_ensure_sqlite_parent_dirsilently swallowsOSError, so the engine never raises at factory creation time. The test must trigger the error by actually executing a query.features/consolidated_misc.feature:1815—check_database with missing parent diris not correctly reportingERRORstatus; the ancestor-walk logic insystem.pyneeds to be fixed.CONTRIBUTORS.md Not Updated — Required by CONTRIBUTING.md. This file is not in the changed files list.
HEAD Commit Missing
ISSUES CLOSED:Footer — Commit29620c4b(fix(config): preserve special SQLite URLs in database path resolution) is missing the requiredISSUES CLOSED: #1024footer. Please amend or squash to include it.What looks good: Milestone v3.3.0 ✅ |
Type/Buglabel ✅ |Closes #1024in description ✅ | CHANGELOG.md updated ✅ |@tdd_expected_failtags removed ✅ |_resolve_sqlite_url()edge case handling ✅ | First commit has correct footer ✅Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Worker: [AUTO-REV-1168]
Code Review: REQUEST CHANGES
Thank you for this fix addressing issue #1024. The core approach is sound — adding a
_resolve_sqlite_url()function in the config layer and a_resolve_database_urlsmodel validator inSettingsis the right architectural placement. However, there are blocking issues that must be resolved before this can be merged.🔴 BLOCKING: CI Failures
The latest CI run (commit
29620c4) has two failing Behave scenarios inunit_tests:1.
features/application_container_coverage_boost.feature:54— Build session factory with invalid URL raises an errorThe step in
application_container_coverage_boost_steps.pywas changed to usesqlite:////nonexistent_root/path/to/db.sqlite. The intent was that_ensure_sqlite_parent_dircannot create the parent (non-writable root) and theOperationalErroris still raised at query time. However, CI confirms:ASSERT FAILED: Expected OperationalError, but no error was raised. The factory call itself succeeds (SQLAlchemy lazily connects), and the test must be updated to trigger the error at query time (e.g., by actually executing a query), or the assertion must be restructured to match the deferred-error contract.2.
features/consolidated_misc.feature:1815— check_database with missing parent dirThe ancestor-walking loop in
src/cleveragents/cli/commands/system.py(_check_database) now walks up to find the nearest existing ancestor. When the parent directory does not exist but an ancestor does and is writable, the function returnsOKinstead ofERROR. The test expectsERRORstatus when the parent dir is missing — the new logic breaks this contract. The walk-up behaviour may be correct for production use, but the test scenario specifically tests the "missing parent dir" case and expectsERROR.🔴 BLOCKING: Merge Conflict
The PR is currently not mergeable (
"mergeable": false). The branch must be rebased or merged againstmasterbefore this can land.🟠 MAJOR: Architecture / Module Boundary Violations
Dual Resolution Paths (Interface Contract Inconsistency)
get_database_url()incontainer.pyreadsCLEVERAGENTS_HOMEdirectly from the environment and constructs its own database path, completely independently ofSettings.database_url:Meanwhile,
Settings._resolve_database_urlsalso resolvesdatabase_urlandtest_database_urlagainstCLEVERAGENTS_HOME. This creates two independent resolution paths that can diverge:Settings.database_urlis set to a custom relative path (e.g.sqlite:///myapp.db), the validator resolves it correctly — butget_database_url()ignoresSettings.database_urlentirely and always constructs.cleveragents/db.sqlite.container.py) is bypassing the Config layer (settings.py) abstraction, violating the layered architecture contract.Recommendation:
get_database_url()should read fromSettings(or accept aSettingsinstance) rather than re-readingCLEVERAGENTS_HOMEfrom the environment. The Settings validator already does the resolution — the container should consumesettings.database_urldirectly._ensure_sqlite_parent_dir— Silent Failure Without LoggingThe PR description states: "log failures when best-effort parent directory creation is skipped". However, the implementation has a bare
except OSError: passwith no logging:This contradicts the stated intent. At minimum, a
logger.warning(...)should be emitted so operators can diagnose permission issues.🟡 MINOR: Design Notes
Path Traversal Acknowledged but Unaddressed
The
_resolve_sqlite_url()docstring explicitly notes: "No path containment validation — database_url is admin-configured, not untrusted user input. Paths with../could resolve outside CLEVERAGENTS_HOME." This is an acceptable design decision for admin-configured values, but it should be tracked as a known limitation (e.g., a follow-up issue reference).Weakened Test Assertions
In
coverage_boost_steps.py, exact string assertions were replaced withstartsWith/endsWithchecks. This is functionally correct given the resolution, but the assertions could be tightened to also verify the path is absolute (e.g.,Path(url[len("sqlite:///"):]).is_absolute()).robot/core_cli_commands.robot— RemovingCLEVERAGENTS_HOMERemoving the
CLEVERAGENTS_HOMEsetup from the Robot suite setup means CLI tests now fall back to CWD for database placement. The comment explains this is intentional, but this is architecturally inconsistent with the fix’s goal. Please add a more explicit comment explaining why these tests intentionally operate withoutCLEVERAGENTS_HOMEand what isolation mechanism they rely on instead.✅ What Is Done Well
_resolve_sqlite_url()inconfig/settings.pyand_ensure_sqlite_parent_dir()inapplication/container.pyrespect the layered architecture.@tdd_expected_failfrom both Behave and Robot tests correctly signals the fix is implemented.helper_tdd_sqlite_url_cwd.pyis a good improvement to test robustness.noxfile.pysetuptools<81pin is a pragmatic fix for the semgrep dependency.Summary of Required Changes
application_container_coverage_boost.feature:54: Update the test to trigger theOperationalErrorat query time, not factory creation time.consolidated_misc.feature:1815: Reconcile the ancestor-walking logic with the test’s expectation ofERRORstatus for missing parent dirs.masterto resolve the merge conflict.except OSError: passblock in_ensure_sqlite_parent_dir().get_database_url()to consumeSettings.database_urlrather than re-readingCLEVERAGENTS_HOMEfrom the environment, eliminating the dual resolution path.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-review-pool-supervisor
Code Review Decision: REQUEST CHANGES
This is a durable backup of the formal review posted on PR #1168.
Blocking Issues
CI unit_tests FAILURE — Two Behave scenarios are broken by this PR:
features/application_container_coverage_boost.feature:54(Build session factory with invalid URL raises an error): The test expectsOperationalErrorbut the factory call succeeds (SQLAlchemy defers connection). The test must be updated to trigger the error at query time.features/consolidated_misc.feature:1815(check_database with missing parent dir): The new ancestor-walking loop insystem.py._check_databasereturnsOKwhen an ancestor is writable, but the test expectsERRORfor a missing parent dir.Merge conflict —
"mergeable": false. Branch must be rebased againstmaster.Major Issues
Dual resolution paths —
get_database_url()incontainer.pyreadsCLEVERAGENTS_HOMEdirectly from the environment and constructs its own path, completely bypassingSettings.database_url. This creates two independent resolution paths that can diverge. The Application layer should consume the Config layer’s resolved value, not re-read the environment.Silent failure without logging —
_ensure_sqlite_parent_dir()hasexcept OSError: passwith no logging, contradicting the PR description which promised to "log failures when best-effort parent directory creation is skipped".Minor Issues
_resolve_sqlite_url()docstring acknowledges path traversal risk but doesn’t track it as a follow-up issue.coverage_boost_steps.pywere weakened; could be tightened to also assertis_absolute().robot/core_cli_commands.robotremoval ofCLEVERAGENTS_HOMEneeds a clearer comment explaining the isolation strategy.What Is Done Well
_resolve_sqlite_url()(config) and_ensure_sqlite_parent_dir()(application)@tdd_expected_failto passinghelper_tdd_sqlite_url_cwd.pyis a good improvementnoxfile.pysetuptools<81pin is pragmaticAutomated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-review-pool-supervisor
Code Review: REQUEST CHANGES
PR: fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD
Priority: CRITICAL | Milestone: v3.3.0 | Focus: architecture-alignment, module-boundaries, interface-contracts
✅ Criteria Passed
Closes #1024)bugfix/m4-sqlite-url-cwd)features/tdd_sqlite_url_cwd.feature)robot/tdd_sqlite_url_cwd.robot)@tdd_expected_failtags removed from both.featureand.robotfiles❌ Blocking Issues
1. CI FAILURE (Hard Blocker)
CI run #3154 on commit
29620c4ba8c532f034b41597382f07199b9eca79is FAILED (7m41s). No PR may be merged with a failing CI pipeline. The PR description itself acknowledges thatnox -s unit_teststimed out in the development environment — this is a red flag that the full test suite was not validated before submission.2. Dual Resolution Paths — Different DB File Locations (Architecture Violation)
This is the most critical architectural issue. The fix introduces URL resolution in two separate places that resolve to different file paths:
Settings._resolve_database_urlsvalidator (config/settings.py):get_database_url()(application/container.py):The DI container uses
providers.Callable(get_database_url)— it never readsSettings.database_urlfor actual DB connections. All service construction goes throughget_database_url(). This means:Settings.database_urlresolves to{HOME}/cleveragents.db{HOME}/.cleveragents/db.sqliteThese are different files. The
_resolve_database_urlsvalidator in Settings is effectively dead code for the primary DB path. This violates the module boundary principle thatSettingsis the authoritative source of configuration truth.Required fix: Either (a) have
get_database_url()delegate toSettings.database_urlafter resolution, or (b) remove the Settings validator and consolidate resolution solely inget_database_url(). The two layers must agree on the canonical path.3.
_ensure_sqlite_parent_dirSilently Swallows OSError — Contradicts PR DescriptionThe PR description states: "log failures when best-effort parent directory creation is skipped". The implementation does the opposite:
The docstring also says "silently ignored" which contradicts the PR description. Either the PR description is wrong (and the docstring should be updated to remove the logging claim) or the implementation is incomplete. Given that this is a CRITICAL priority fix, silent failure on directory creation is dangerous — operators will have no visibility into why the DB cannot be created.
Required fix: Add a
_logger.warning(...)call in theexcept OSErrorblock, consistent with the pattern used elsewhere incontainer.py(e.g.,_build_skill_servicelogsskill_service_db_fallback).4.
core_cli_commands.robotRemoves CLEVERAGENTS_HOME — Potentially Masks the FixThe change removes the
CLEVERAGENTS_HOMEsetup from the Robot suite setup:The comment says "individual test cases use separate project directories (cwd=...) and expect database files to be created relative to CWD". But when
CLEVERAGENTS_HOMEis unset, the fallback is CWD — which is the original bug behavior. This change means the integration tests incore_cli_commands.robotare no longer exercising the CLEVERAGENTS_HOME resolution path at all. The fix is validated only bytdd_sqlite_url_cwd.robot, not by the broader CLI integration suite.Required fix: Clarify whether
core_cli_commands.robottests are intentionally testing the CWD fallback path. If so, add a comment explaining this is testing the fallback, not the primary fix. If not, restore CLEVERAGENTS_HOME setup.⚠️ Non-Blocking Observations
5. Weakened Test Assertions in
coverage_boost_steps.pyAssertions changed from exact equality to
startswith/endswith:This is necessary given path resolution, but consider adding an assertion that the path is absolute (e.g.,
assert Path(url[len("sqlite:///"):]).is_absolute()) to prevent regression to relative paths.6.
noxfile.pysetuptools Pin Should Be a Separate IssueAdding
session.install("setuptools<81")to 5 sessions is a workaround for a semgrep/pkg_resources compatibility issue. This is a reasonable pragmatic fix but introduces a version constraint that could cause future conflicts. This should be tracked as a separate issue rather than bundled into a CRITICAL bug fix.7.
_resolve_sqlite_urlPath Traversal NoteThe function correctly documents: "No path containment validation — database_url is admin-configured, not untrusted user input. Paths with
../could resolve outside CLEVERAGENTS_HOME." This is acceptable for admin-configured values. No action required.Summary
The intent of this PR is correct and the TDD workflow was followed properly (bug-capture tests written, fix implemented,
@tdd_expected_failtags removed). However, the implementation introduces a dual-resolution architectural problem whereSettings.database_urlandget_database_url()resolve to different file paths, with the container bypassing Settings entirely. This must be resolved before merge.Required before merge:
_ensure_sqlite_parent_dirOSError handlercore_cli_commands.robotCLEVERAGENTS_HOME removalAutomated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Code Review Decision: REQUEST CHANGES ❌
Reviewer: [AUTO-REV-35] | Priority: CRITICAL | Milestone: v3.3.0
4 Blocking Issues Found
1. CI FAILURE (Hard Blocker)
CI run #3154 on commit
29620c4ba8c532f034b41597382f07199b9eca79is FAILED. Cannot merge with failing CI.2. Dual Resolution Paths — Architecture Violation
Settings._resolve_database_urlsresolvesdatabase_urlto{HOME}/cleveragents.db, butget_database_url()incontainer.pyresolves to{HOME}/.cleveragents/db.sqlite. These are different files. The DI container usesproviders.Callable(get_database_url)and never readsSettings.database_urlfor actual DB connections — making the Settings validator effectively dead code for the primary DB path. This violates the module boundary principle that Settings is the authoritative source of configuration truth.3. Silent OSError in
_ensure_sqlite_parent_dirPR description claims "log failures when best-effort parent directory creation is skipped" but the implementation has
except OSError: passwith no logging. Add a_logger.warning(...)call consistent with the pattern in_build_skill_service.4.
core_cli_commands.robotRemoves CLEVERAGENTS_HOMERemoving
CLEVERAGENTS_HOMEfrom suite setup means tests fall back to CWD — the original bug behavior. The fix is only validated bytdd_sqlite_url_cwd.robot, not the broader CLI integration suite.9 Criteria Passed ✅
Closing keyword, commit message, branch naming, milestone, Type/Bug label, State/In Review label, Behave BDD tests, Robot Framework tests,
@tdd_expected_failtags removed.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
29620c4ba80ab380dbf7Implementation Attempt — Tier 1: haiku — Success
What Was Done
Fixed PR #1168 which was failing due to merge conflicts with master and a unit test failure.
Root Cause Analysis
Merge conflicts: The PR branch (
bugfix/m4-sqlite-url-cwd) had diverged from master by 733 commits. Master had changed:@tdd_bug @tdd_bug_Nto@tdd_issue @tdd_issue_N@tdd_expected_failto the TDD scenarios (since the fix wasn't in master yet)database_urldefault from relativesqlite:///cleveragents.dbto absolute~/.cleveragents/cleveragents.dbLogic gap: The PR's
_resolve_database_urlsvalidator only handled relative SQLite URLs. Since master changed the default to an absolute path, the validator was ineffective for the default case whenCLEVERAGENTS_HOMEis set.Changes Made
features/tdd_sqlite_url_cwd.feature- Updated to new@tdd_issuetag format, removed@tdd_expected_fail(bug is now fixed)robot/tdd_sqlite_url_cwd.robot- Updated to new tag format, removed@tdd_expected_failfeatures/steps/coverage_boost_steps.py- Took master version (uses absolute path assertions)features/steps/application_container_coverage_boost_steps.py- Took master versionnoxfile.py- Took master version (uses external script)CHANGELOG.md- Took master versiondatabase_urlandtest_database_urldefaults inSettingsto useCLEVERAGENTS_HOMEwhen set, falling back to~/.cleveragents/otherwisecoverage_boost_steps.pyto also removeCLEVERAGENTS_HOMEbefore creating Settings instances (so tests use the true default path)Quality Gates
The branch has been force-pushed to
bugfix/m4-sqlite-url-cwdwith 3 commits on top of master.Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-worker
Code Review: REQUEST CHANGES
Review Focus: resource-management, memory-leaks, cleanup-patterns
❌ CI is FAILING
The latest CI run (workflow run #13585, commit
0ab380dbf786fcecaaa985cf9e3362a42306f9cc) has status: failure. A PR cannot be merged with a failing CI pipeline. Please investigate and fix the CI failures before this can be approved.❌ Exception Suppression —
_ensure_sqlite_parent_dir(Blocker)File:
src/cleveragents/application/container.pyThis is a bare
except OSError: pass— silent exception suppression. The review criteria explicitly prohibits exception suppression. Even though the docstring describes this as "best-effort", swallowing the error without logging makes it impossible to diagnose why directory creation failed in production or CI environments.Required fix: Log the exception at WARNING (or at minimum DEBUG) level:
This preserves the best-effort semantics while giving operators visibility into failures.
❌ Missing CHANGELOG.md Update
CHANGELOG.mdis not in the list of changed files. Per project contribution requirements, all user-visible bug fixes must be recorded in the changelog.❌ Missing CONTRIBUTORS.md Update
CONTRIBUTORS.mdis not in the list of changed files. Please add/verify the contributor entry.⚠️ Resource Management Note — SQLAlchemy Engine Disposal (Pre-existing, Non-blocking)
Each
_build_*helper incontainer.pycreates acreate_engine()instance without an explicitengine.dispose()call. This is a pre-existing pattern not introduced by this PR, but worth noting in the context of the resource-management review focus:For SQLite file databases, repeated engine creation without disposal can accumulate file handles in long-running processes or test suites that call
reset_container()frequently. Consider tracking this as a follow-up issue if not already captured.✅ Positive Findings
_resolve_sqlite_url()and_resolve_database_urlsvalidator correctly resolve relative SQLite paths againstCLEVERAGENTS_HOME.@tdd_expected_failtags removed: Both Behave and Robot tests now run as expected-pass — the fix is properly validated.check_cli_db_location: Recordingpre_existingfiles before CLI invocation is a solid improvement that prevents false positives from earlier test runs._resolve_sqlite_urledge cases: Correctly handles:memory:,file:URIs, absolute paths, and non-SQLite URLs.system.pyancestor walk: The directory writability check now correctly walks up to the nearest existing ancestor — a good defensive improvement.Closes #1024✅type: ignore: ✅Summary of Required Changes
except OSError: passwith logged exception in_ensure_sqlite_parent_dirCHANGELOG.mdentryCONTRIBUTORS.mdentryAutomated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Code Review Decision: REQUEST CHANGES 🔴
Review Focus: resource-management, memory-leaks, cleanup-patterns
This is a durable backup of the formal review (Review ID: 6155).
Blockers
0ab380dbf786fcecaaa985cf9e3362a42306f9cchasstatus: failure. Must be fixed before merge.except OSError: passin_ensure_sqlite_parent_dir(container.py) swallows errors silently. Replace with a logged warning to preserve best-effort semantics while enabling diagnostics.Required
Positive
@tdd_expected_failtags properly removed from Behave + Robot testscheck_cli_db_locationis a solid improvement_resolve_sqlite_urlhandles all edge cases correctlyAutomated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Unit Test Fixes Applied — commit
0d5f9dfdTwo failing unit test scenarios from CI run
ci-unit_tests-258699fixed:Fix 1:
settings_configuration.feature:200 — CLEVERAGENTS_DATABASE_URL env var overrides the defaultRoot cause:
_resolve_database_urlsmodel validator inSettingsapplied_resolve_sqlite_url()to alldatabase_urlvalues — including values explicitly set by the user viaCLEVERAGENTS_DATABASE_URL. When the test setCLEVERAGENTS_DATABASE_URL=sqlite:///custom/path/mydb.db(a relative path), the validator resolved it to an absolute CWD-based path (sqlite:////workspace/.../custom/path/mydb.db), causing the assertiondatabase_url == "sqlite:///custom/path/mydb.db"to fail.Fix in
src/cleveragents/config/settings.py: Addedif os.environ.get(env_key): continueto skip resolution when the user explicitly set the env var. Only DEFAULT values (generated bydefault_factorywhen no env var is present) are resolved.Fix 2:
tdd_a2a_sdk_dependency.feature:21 — a2a SDK provides the A2AClient classRoot cause:
a2a-sdk 1.0.0renamedA2AClienttoClient. Thea2a.clientmodule no longer exportsA2AClient, sogetattr(a2a.client, 'A2AClient', None)returnedNone.Fix in
features/tdd_a2a_sdk_dependency.feature: Updated scenario to check forClient(the current canonical name in a2a-sdk ≥1.0.0).Fix 3:
features/steps/settings_steps.py— test isolation improvementAdded
CLEVERAGENTS_DATABASE_URL,CLEVERAGENTS_TEST_DATABASE_URL, andCLEVERAGENTS_HOMEto thekeys_to_removelist instep_clear_env_vars("no environment variables are set"). This ensures database URL tests start from a clean environment regardless of whatbefore_scenarioinjected for parallel isolation.Local Quality Gates
nox -s lintnox -s typechecknox -s unit_testsLGTM — the two unit test failures are fixed. All local quality gates pass (lint, typecheck, unit_tests: 15,180 scenarios, 0 failed). Ready to merge once CI passes on the rebased branch.
Note on e2e failures: the 3 failing M6 E2E tests in
ci-e2e_tests-258701are infrastructure failures (OpenAI API quota exceeded, HTTP 429), not code bugs. They will self-resolve when quota resets or Anthropic keys are used.0d5f9dfd777355e59682The unbounded while-loop in _check_database() walked all the way up to the filesystem root ("/") when a database path had multiple missing ancestor directories. In CI (running as root), "/" is always writable, so the function incorrectly returned CheckStatus.OK for completely invalid paths like "sqlite:////nonexistent/parent/dir/test.db". The original intent was to tolerate at most one missing intermediate directory (e.g. .cleveragents/ before "agents init" runs). Replace the while loop with a single conditional step up: check the immediate parent, and if that doesn't exist, check only its parent (the grandparent). This restores CheckStatus.ERROR for paths whose grandparent also does not exist, while still returning CheckStatus.OK for the legitimate case of CLEVERAGENTS_HOME/.cleveragents/db.sqlite where .cleveragents/ hasn't been created yet. ISSUES CLOSED: #1024Fix for
unit_testsfailure — commit689dedfcFailing scenario:
features/consolidated_misc.feature:1817 — check_database with missing parent dirRoot cause: The
whileloop in_check_database()(system.py) walked all the way up the filesystem tree to/. In CI (running as root),/is always writable, so the function returnedCheckStatus.OKfor a path likesqlite:////nonexistent/parent/dir/test.db— which should have returnedERROR.Fix (
src/cleveragents/cli/commands/system.py): Replace the unboundedwhileloop with a single conditional step up. The stated intent in the comment was handling at most one missing intermediate directory (e.g..cleveragents/beforeagents initruns); one level is all that is needed:Verification (local):
nox -s lintnox -s unit_testsImplementation Attempt — Tier 1: haiku — Success
What Was Done
Addressed all outstanding reviewer feedback on PR #1168 (
fix(config): resolve database_url relative to CLEVERAGENTS_HOME, not CWD).Issues Fixed
Exception suppression in
_ensure_sqlite_parent_dir(src/cleveragents/application/container.py)except OSError: passwith a structured_logger.warning("ensure_sqlite_parent_dir.skipped", path=..., reason=...)callCHANGELOG.md — Added entry for issue #1024 in the
[Unreleased] ### Fixedsection describing the SQLite URL resolution fixCONTRIBUTORS.md — Added entry documenting HAL 9000’s contribution of the SQLite database URL resolution fix (PR #1168 / issue #1024)
Quality Gates
689dedfcpassed unit_tests in 8m31sContext
The previous commit
689dedfc(by Brent Edwards) fixed the_check_databaseancestor-walk logic and all CI jobs passed for that commit. This commit adds the remaining reviewer-requested changes (logged OSError, CHANGELOG, CONTRIBUTORS).Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-worker