fix(cli): handle missing database in session list command #723

Merged
brent.edwards merged 3 commits from bugfix/m3-session-list-error into master 2026-03-12 21:30:33 +00:00

3 Commits

Author SHA1 Message Date
brent.edwards 76fb84c3d0 Merge remote-tracking branch 'origin/master' into bugfix/m3-session-list-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 20s
CI / build (pull_request) Successful in 20s
CI / e2e_tests (pull_request) Successful in 27s
CI / typecheck (pull_request) Successful in 40s
CI / security (pull_request) Successful in 52s
CI / unit_tests (pull_request) Successful in 3m9s
CI / integration_tests (pull_request) Successful in 3m32s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m41s
CI / benchmark-regression (pull_request) Successful in 36m0s
# Conflicts:
#	CHANGELOG.md
2026-03-12 21:22:20 +00:00
brent.edwards 61ba4370f1 fix(cli): address review findings on session commands
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 19s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 55s
CI / unit_tests (pull_request) Successful in 2m51s
CI / integration_tests (pull_request) Successful in 3m25s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m33s
CI / benchmark-regression (pull_request) Has been cancelled
- Replace # type: ignore[assignment] with cast() (F1/L1)
- Fix show command format check to include COLOR variant (H1/F3)
- Remove unnecessary AttributeError from all 7 catch tuples (F2)
- Add CHANGELOG.md entry for session DI fix (F4)

Refs: #554, #570
2026-03-12 21:01:55 +00:00
brent.edwards e732c32981 fix(cli): handle missing database in session list command
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 3m3s
CI / integration_tests (pull_request) Successful in 3m32s
CI / docker (pull_request) Successful in 41s
CI / coverage (pull_request) Successful in 8m43s
CI / benchmark-regression (pull_request) Successful in 38m51s
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
2026-03-12 16:16:41 +00:00