forked from cleveragents/cleveragents-core
e732c32981
Register PersistentSessionService in the DI Container so that 'agents session list' (and all other session subcommands) no longer throw AttributeError due to a missing 'db' provider. Changes: - Add _build_session_service() factory and session_service provider to Container, with targeted table creation for session/session_messages only (avoids bypassing Alembic for the full schema). - Add auto_commit parameter to SessionRepository and SessionMessageRepository; when True each method commits and closes its own database session, preventing resource leaks in CLI context. - Rewrite _get_session_service() to resolve via container.session_service() with module-level caching. - Add (DatabaseError, AttributeError) error handling with logging to all seven session subcommands (list, create, show, delete, export, import, tell). - Remove @tdd_expected_fail tags from all session test files so they run as proper regression tests. ISSUES CLOSED: #554, #570, #680
27 lines
1.2 KiB
Gherkin
27 lines
1.2 KiB
Gherkin
@tdd_bug @tdd_bug_570
|
|
Feature: TDD Bug #570 — session create DI container missing db provider
|
|
As a developer
|
|
I want to verify that `agents session create` fails due to the
|
|
DI container missing a `db` provider
|
|
So that the bug is captured and will be caught by a regression test
|
|
|
|
The root cause is shared with bug #554: `_get_session_service()` in
|
|
session.py calls `container.db()`, but the Container class has no `db`
|
|
provider, causing an AttributeError at runtime.
|
|
|
|
Scenario: Session create command succeeds via DI container
|
|
Given a CLI runner using the real session DI path
|
|
When I invoke the session create command
|
|
Then the session create command should exit successfully
|
|
|
|
Scenario: Session create with actor succeeds via DI container
|
|
Given a CLI runner using the real session DI path
|
|
When I invoke the session create command with actor "openai/gpt-4"
|
|
Then the session create command should exit successfully
|
|
|
|
Scenario: Session create command produces structured output via DI
|
|
Given a CLI runner using the real session DI path
|
|
When I invoke the session create command with format json
|
|
Then the session create command should exit successfully
|
|
And the session create output should be valid JSON
|