Commit Graph

1065 Commits

Author SHA1 Message Date
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
Brent E. Edwards b5fc903425 test(cli): TDD failing tests for session list missing database (bug #680)
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 38s
CI / security (pull_request) Successful in 53s
CI / unit_tests (pull_request) Successful in 2m58s
CI / integration_tests (pull_request) Successful in 3m30s
CI / docker (pull_request) Successful in 1m9s
CI / coverage (pull_request) Successful in 5m30s
CI / benchmark-regression (pull_request) Successful in 35m22s
CI / lint (push) Successful in 13s
CI / build (push) Successful in 16s
CI / quality (push) Successful in 21s
CI / security (push) Successful in 35s
CI / typecheck (push) Successful in 48s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 3m25s
CI / unit_tests (push) Successful in 3m43s
CI / docker (push) Successful in 10s
CI / coverage (push) Successful in 5m39s
CI / benchmark-publish (push) Successful in 19m41s
Add Behave and Robot Framework TDD tests that exercise the session list
command when no database file exists.  Tagged @tdd_expected_fail so that
the tests pass CI while the bug is present (the Container has no db
provider, causing AttributeError).  Once the bugfix removes the tag,
these become permanent regression tests.

ISSUES CLOSED: #683
2026-03-11 22:50:37 +00:00
freemo 3959565723 Docs: Daily update to timeline
CI / lint (push) Successful in 14s
CI / build (push) Successful in 16s
CI / quality (push) Successful in 17s
CI / typecheck (push) Successful in 38s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 38s
CI / unit_tests (push) Successful in 3m12s
CI / integration_tests (push) Successful in 3m51s
CI / docker (push) Successful in 40s
CI / coverage (push) Successful in 5m45s
CI / benchmark-publish (push) Successful in 18m44s
2026-03-11 16:47:22 -04:00
freemo a8bb543f96 Docs: Updated contributings general section to include prohibition on integration test mocks
CI / lint (push) Successful in 15s
CI / build (push) Successful in 17s
CI / quality (push) Successful in 19s
CI / security (push) Successful in 36s
CI / typecheck (push) Successful in 39s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 5m16s
CI / unit_tests (push) Successful in 6m4s
CI / coverage (push) Successful in 5m53s
CI / docker (push) Successful in 52s
CI / benchmark-publish (push) Successful in 18m57s
2026-03-11 15:32:21 -04:00
freemo b16bd27667 Docs: daily update to timeline 2026-03-11 15:32:16 -04:00
CoreRasurae 4d3499dcfb feat(async): wire retry policies into services
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m43s
CI / integration_tests (pull_request) Successful in 3m20s
CI / docker (pull_request) Successful in 51s
CI / coverage (pull_request) Successful in 6m18s
CI / build (push) Successful in 14s
CI / lint (push) Successful in 21s
CI / quality (push) Successful in 29s
CI / typecheck (push) Successful in 35s
CI / security (push) Successful in 36s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 3m17s
CI / docker (push) Successful in 9s
CI / integration_tests (push) Successful in 3m29s
CI / coverage (push) Successful in 7m3s
CI / benchmark-publish (push) Successful in 19m50s
CI / benchmark-regression (pull_request) Successful in 40m6s
Wire per-service retry policies and circuit breakers into the service
layer via ServiceRetryWiring, backed by ServiceRetryPolicyRegistry and
configurable through Settings environment variables.

Production hardening from code review:
- Fix TOCTOU race in CircuitBreaker._on_success (half-open state)
- Add half-open probe limit to prevent unbounded concurrent requests
- Track all exception types for circuit breaker failure counting
- Detect async callables wrapped in functools.partial and callable objects
- Enforce spec-compliant 2s minimum for linear backoff strategy
- Enforce 0.1s floor for fixed backoff strategy
- Add retry amplification guard via contextvars nesting depth tracking
- Cap total retry wall-clock time at 300s (MAX_RETRY_TOTAL_TIMEOUT)
- Sanitize exception messages in retry logs to prevent secret leakage
- Fix wrap_service_method TOCTOU by holding cache lock for full operation
- Deep-copy default policies to prevent cross-policy mutation
- Warn on unknown override keys in apply_overrides
- Guard apply_overrides against non-dict and deeply nested JSON values
- Read circuit breaker state under lock in is_circuit_open
- Catch RecursionError in JSON config parsing
- Add total_timeout + nesting guard to retry_service_operation decorator
- Extend secret sanitization to Authorization headers, private_key,
  connection_string, and access_key patterns
- Enforce 0.1s floor on jitter backoff strategy
- Cache wait strategies per service in ServiceRetryWiring (M3)
- Reset failure_count to 0 when entering half-open from open (M6)
- Use cached _get_wait_strategy() in execute()/async_execute()
- Move circuit-open logging out of _on_failure lock scope to prevent
  holding the lock during potentially slow I/O (F1)
- Pass total_timeout=MAX_RETRY_TOTAL_TIMEOUT to wrap_service_method
  retry_service_operation call for consistency with execute() (F4)
- Capture failure_count into local variable inside lock scope before
  logging outside the lock, preventing stale reads from concurrent
  threads in CircuitBreaker.call() and async_call() (F1)
- Deep-copy module-level DEFAULT_DATABASE_RETRY and DEFAULT_CIRCUIT_BREAKER
  in ServiceRetryPolicyRegistry.get() for auto-generated unknown service
  policies, preventing shared mutable state corruption (F1)
- Unify CircuitBreaker to a single threading.Lock for sync and async (P1-1)
- Restore BaseException permit in half-open path to prevent permit leak (P1-6)
- Prevent CircuitBreakerOpen cascading into failure_count (S2)
- Protect all logger calls with contextlib.suppress (S3, S4)
- Replace time.time() with time.monotonic() for monotonic timing (S5)
- Add distinct log events for half-open and closed transitions (S11, S12)
- Track pre-existing services so second apply_settings_defaults only
  targets newly registered services (P1-2)
- Lazy circuit breaker creation via _get_or_create_cb() (P1-3)
- Reject async callables in sync execute() with TypeError (P1-5)
- Strengthen retry predicate to retry_if_exception_type(Exception) &
  retry_if_not_exception_type(CircuitBreakerOpen) (S1)
- Add lock on _get_wait_strategy cache access (P2-16)
- Truncate raw JSON to 80 chars in override warning (P2-17)
- Warn on non-dict JSON overrides (P2-29)
- Debug log for nesting guard bypass (S13)
- Deep-copy from get() and all_policies() in registry (P1-4)
- Thread-safe registry with threading.Lock (P2-15)
- Robust exception handling in apply_overrides get() (P2-18)
- Log ValidationError details on override failure (P2-19)
- Sanitize service_name via _safe_service_name() (P2-28)
- Warn on non-dict sub-key values in overrides (P2-30)
- Allowlist for is_read_only_plan_operation phases (P2-10)
- Cap retry_auto_debug sleep at 60s (P2-11)
- Use is-not-None instead of falsy checks for error values (P2-12)
- Extend secret regex with bearer, session_id, auth_token,
  refresh_token, client_secret patterns (P2-25)
- Pre-truncate error messages to 2000 chars before regex (P2-26)
- Add upper bounds on retry Settings fields (P2-7)
- Add cross-field validator max_delay >= base_delay (P2-8)
- Case-insensitive backoff strategy validation (P2-21)
- Add half_open_max_successes setting (S10)
- Remove phantom ContextFragment from services __all__ (ImportError fix)
- Export ServiceRetryWiring from application.services package
- Include sanitised error context in TypeError logging fallback
- Initialise RetryContext.attempt_count to 1 for bare context-manager usage
- Introduce CircuitBreakerState StrEnum replacing raw string literals
- Fix vacuous CircuitBreakerOpen propagation assertions in BDD steps
- Replace tautological logging test with structlog capture verification
- Assert circuit breaker existence instead of silently skipping on None
- Add Unicode control-char rejection validator to ServiceRetryPolicy.service_name
- Add name parameter with service= in all log calls
- Add extra="forbid" to all 3 Pydantic models
- Deep-copy _SERVICE_DEFAULTS construction
- Key normalisation (.strip()) in get() and apply_overrides()
- Add cooldown <= recovery_timeout validator
- Async guard on RetryContext.execute()
- Nesting guard on RetryContext.execute()/async_execute()
- stop_after_delay(300.0) on RetryContext
- retry_auto_debug async-only guard, dict result fix, sleep guard
- Retry-attempt logging in RetryContext
- Module-level docs for contextlib.suppress(TypeError) rationale
- Exhaustion log on retry failure
- Startup log in __init__; name=service_name to CircuitBreaker
- log_after_retry guarded to not fire on first-attempt success
- get_retry_decorator now includes logging callbacks
- Changed retry_backoff_strategy from str to RetryStrategy StrEnum

Closes #313
2026-03-11 17:42:13 +00:00
freemo d5b122d4a3 Docs: Updated to A2A and integrating rest standard
CI / lint (push) Successful in 14s
CI / quality (push) Successful in 21s
CI / security (push) Successful in 36s
CI / build (push) Successful in 36s
CI / typecheck (push) Successful in 39s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m57s
CI / integration_tests (push) Successful in 3m23s
CI / docker (push) Successful in 53s
CI / coverage (push) Successful in 5m58s
CI / benchmark-publish (push) Successful in 19m27s
2026-03-11 13:19:55 -04:00
freemo 674c5b8a6b Docs: Daily update to timeline
CI / lint (push) Successful in 23s
CI / build (push) Successful in 27s
CI / quality (push) Successful in 43s
CI / typecheck (push) Successful in 45s
CI / security (push) Successful in 45s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 3m38s
CI / unit_tests (push) Successful in 4m49s
CI / docker (push) Successful in 1m1s
CI / coverage (push) Successful in 5m33s
CI / benchmark-publish (push) Failing after 7m2s
2026-03-11 10:05:25 -04:00
freemo e98c8e6c79 Docs: Added and revised server-client protocol details
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
CI / security (push) Waiting to run
CI / quality (push) Waiting to run
CI / unit_tests (push) Waiting to run
CI / integration_tests (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / benchmark-regression (push) Blocked by required conditions
CI / benchmark-publish (push) Waiting to run
CI / build (push) Waiting to run
CI / docker (push) Blocked by required conditions
2026-03-11 10:02:27 -04:00
freemo 82def1112b docs(tui): promote TUI to top-level section and fix mkdocs nav warnings
CI / lint (push) Successful in 14s
CI / build (push) Successful in 16s
CI / quality (push) Successful in 18s
CI / typecheck (push) Successful in 38s
CI / security (push) Successful in 38s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 3m6s
CI / docker (push) Successful in 10s
CI / integration_tests (push) Successful in 3m26s
CI / coverage (push) Successful in 6m18s
CI / benchmark-publish (push) Successful in 18m34s
Restructure the TUI specification from a nested subsection under
"Behavior > UI / Interaction Model" to a top-level "## TUI" section,
giving it equal standing with Core Concepts, Behavior, Configuration,
and Architecture. All headings within the TUI section are promoted one
level (#### → ###, ##### → ####).

Fix mkdocs build nav warnings by adding ADR-044/045/046 to the
mkdocs.yml nav and registering three missing reference pages
(acms_fusion, context_indexing, resource_type_inheritance) in the
gen_ref_pages.py nav builder.
2026-03-11 00:39:57 -04:00
freemo c129ea5098 docs(tui): add exhaustive detail for block cursor, settings, notifications, per-window hotkeys, and secondary screens
Expand the TUI specification section with comprehensive detail that was
identified as missing in a gap analysis against the original design prompt
and Toad TUI feature inventory. The flat "Global Hotkey Reference" table
is replaced with 16 per-window/overlay hotkey tables.

New specification content:

Block Cursor and Context Menu:
- Block cursor navigation (alt+up/down, space, enter)
- Floating context menu with 7 actions: copy to clipboard (c), copy to
  prompt (p), export as Markdown (e), export as SVG (v), maximize (m),
  retry (r), show raw data (d)
- New diagram: context menu popup

Conversation Block Details:
- Tool call states with 4 lifecycle phases (pending, completed collapsed,
  completed expanded, failed) and tools.expand setting (never/always/
  success/fail/both)
- Actor thought block with collapsed (max 10 lines) and expanded states
- Permission question widget with allow/reject options and queue behavior
- New diagrams: tool call states, thought block, question widget

Prompt Architecture Detail:
- History navigation with per-mode JSONL files (prompt vs shell), up/down
  at start/end of TextArea, 10K entry cap
- Key passthrough from conversation Window to prompt on printable chars
- Multiline detection (newlines, triple backticks, shift+enter)
- Shell danger detection with heuristic patterns (rm -rf, chmod 777, dd,
  fork bombs, mkfs, sudo) and configurable shell.warn_dangerous setting

Notification System:
- Flash messages (4 semantic styles: default, success, warning, error)
- Desktop notifications via notifypy (never/on-blur/always), 5 trigger
  events, low-severity suppression
- Terminal title management with VT escape sequences, state-dependent
  icons, and configurable blink on input-needed
- Sound effects (4 event sounds, graceful degradation)

Clipboard Operations:
- Auto-copy on selection (ui.auto_copy), block copy via context menu,
  pyperclip with OSC 52 fallback

Session Persistence and Resume:
- SQLite storage schema (10 columns) at ~/.local/state/cleveragents/tui.db
- 6-step resume workflow via ctrl+r or /session:import

Sessions Screen:
- New diagram: sessions modal with active + saved session sections
- Time formatting, session state indicators, keyboard bindings

Settings Screen:
- New diagram: schema-driven settings modal with search
- Complete settings schema: 7 categories, 30+ settings with types,
  defaults, ranges, and descriptions (UI, notifications, sidebar, agent,
  tools, shell, diff)

Additional Features:
- Conversation content pruning (prune_low_mark/prune_excess thresholds)
- Double-tap safety (ctrl+c 5s quit window, escape 400ms terminal exit)
- Loading states (rainbow throbber + rotating quotes alternative)
- Conversation export (JSON, Markdown, per-block SVG)
- Column width and scrollbar configuration

Per-Window Hotkey Tables (16 tables replacing 1 flat table):
- Global, MainScreen prompt, MainScreen conversation/cursor, block context
  menu, terminal focused, sidebar visible, sidebar fullscreen, reference
  picker (search + tree modes), slash command overlay, plan detail modal,
  project detail modal, persona editor modal, permissions screen, settings
  screen, sessions screen, question widget, help panel
2026-03-11 00:39:57 -04:00
freemo 56f3b49725 docs(tui): add comprehensive TUI specification with 18 aligned ASCII mockup diagrams
Add the complete TUI (Terminal User Interface) specification section to
docs/specification.md, covering architecture, layout, navigation, persona
system, reference picker, slash commands, shell mode, session management,
and keyboard shortcuts. The section includes 18 HTML-styled ASCII mockup
diagrams using the Dracula color palette that render with actual colors
in MkDocs.

Key specification areas:
- MainScreen layout with right-side collapsible sidebar (3 states:
  hidden, visible, fullscreen cycled by shift+tab)
- Direct-to-chat launch with first-run actor selection overlay
- Persona system bundling actor + arguments + project/plan scope,
  cycled with tab; argument presets cycled with ctrl+tab
- @ reference picker with fuzzy search for projects/plans/resources
- / slash commands mirroring CLI noun:verb patterns (session:new,
  plan:list, project:show, actor:switch, etc.)
- ! shell mode for direct command execution
- Multi-session tabs with independent personas and conversations
- Escape-cascading navigation back to main screen
- Plan detail view with decision tree navigation
- Project detail view with resource DAG
- Permission approval workflow with diff view
- Complete keyboard shortcut reference table

New ADR files:
- ADR-044: TUI Architecture and Framework (Textual >= 1.0)
- ADR-045: TUI Persona System
- ADR-046: TUI Reference and Command System (CLI-aligned commands)

Also adds TUI mockup CSS classes to docs/stylesheets/extra.css for
Dracula-palette diagram rendering (.tui-primary, .tui-secondary,
.tui-success, .tui-warning, .tui-error, .tui-dim, .tui-bold,
.tui-bold-primary, .tui-bold-warning, .tui-primary-u, .tui-rainbow).
2026-03-11 00:39:57 -04:00
brent.edwards 76c3d5b731 Merge pull request 'fix(actor): handle empty actor list without validation error' (#594) from feature/m3-fix-actor-list-empty into master
CI / lint (push) Successful in 15s
CI / quality (push) Successful in 19s
CI / build (push) Successful in 21s
CI / typecheck (push) Successful in 38s
CI / security (push) Successful in 38s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m43s
CI / docker (push) Successful in 38s
CI / integration_tests (push) Successful in 3m57s
CI / coverage (push) Successful in 5m49s
CI / benchmark-publish (push) Successful in 18m36s
Reviewed-on: #594
Reviewed-by: Rui Hu <rui.hu@cleverthis.com>
2026-03-11 04:01:31 +00:00
brent.edwards f5b562c104 fix(test): remove @tdd_expected_fail tags since bug #592 is fixed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 21s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 39s
CI / unit_tests (pull_request) Successful in 2m58s
CI / integration_tests (pull_request) Successful in 3m28s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m27s
CI / benchmark-regression (pull_request) Successful in 36m5s
This branch contains the fix for bug #592 (actor name slash sanitisation).
The TDD tests from PR #655 are tagged @tdd_expected_fail which expects
the bug to be present, but since the fix is on this branch the tests
pass unexpectedly, causing CI failures.

Remove the @tdd_expected_fail tags from both Behave and Robot test files
so the tests run as normal regression tests alongside the fix.

ISSUES CLOSED: #592
2026-03-11 03:54:46 +00:00
brent.edwards f2e44b2cf1 Merge remote-tracking branch 'origin/master' into feature/m3-fix-actor-list-empty
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 36s
CI / unit_tests (pull_request) Failing after 2m55s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 3m28s
CI / coverage (pull_request) Successful in 5m33s
CI / benchmark-regression (pull_request) Has been cancelled
# Conflicts:
#	features/mocks/fake_provider.py
2026-03-11 03:40:37 +00:00
brent.edwards 5b9f0554c0 Merge pull request 'test(actor): add TDD failing tests for actor list empty validation error' (#655) from tdd/actor-list-validation into master
CI / lint (push) Successful in 14s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 18s
CI / security (push) Successful in 36s
CI / typecheck (push) Successful in 38s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m37s
CI / docker (push) Successful in 9s
CI / integration_tests (push) Successful in 3m22s
CI / coverage (push) Successful in 5m29s
CI / benchmark-publish (push) Successful in 20m39s
Reviewed-on: #655
Reviewed-by: Hamza Khyari <hamza.khyari@cleverthis.com>
2026-03-11 03:37:23 +00:00
brent.edwards 1a1d0a7fbb fix(test): remove self-inversion from actor list Robot helper
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 18s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 57s
CI / unit_tests (pull_request) Successful in 2m50s
CI / docker (pull_request) Successful in 9s
CI / integration_tests (pull_request) Successful in 3m23s
CI / coverage (pull_request) Successful in 5m26s
CI / benchmark-regression (pull_request) Successful in 35m30s
The helper was written before the tdd_expected_fail_listener existed and
inverted pass/fail internally.  After merging master the listener is now
active, causing a double inversion that made all three tdd_bug_592 Robot
tests fail with 'bug appears to be fixed — remove the tag'.

Switch to the real-outcome convention: exit 0 + sentinel when the bug is
fixed, exit 1 when the bug is still present, and let the listener handle
inversion.

ISSUES CLOSED: #634
2026-03-11 03:21:50 +00:00
brent.edwards 205e94eb52 Merge remote-tracking branch 'origin/master' into feature/m3-fix-actor-list-empty
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 39s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 3m6s
CI / integration_tests (pull_request) Successful in 3m19s
CI / docker (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 5m24s
CI / benchmark-regression (pull_request) Has been cancelled
# Conflicts:
#	CHANGELOG.md
#	noxfile.py
2026-03-11 03:12:52 +00:00
brent.edwards 5c5de082f2 Merge remote-tracking branch 'origin/master' into tdd/actor-list-validation
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 17s
CI / typecheck (pull_request) Successful in 38s
CI / security (pull_request) Successful in 51s
CI / unit_tests (pull_request) Successful in 2m43s
CI / docker (pull_request) Successful in 9s
CI / integration_tests (pull_request) Failing after 3m38s
CI / coverage (pull_request) Successful in 5m29s
CI / benchmark-regression (pull_request) Has been cancelled
# Conflicts:
#	benchmarks/tdd_session_create_di_bench.py
#	features/steps/tdd_session_create_di_steps.py
#	robot/helper_tdd_session_create_di.py
#	robot/tdd_session_create_di.robot
2026-03-11 03:07:42 +00:00
brent.edwards 70da5572a6 Merge pull request 'test(session): add TDD failing tests for session create DI error' (#654) from tdd/session-create-di-error into master
CI / lint (push) Successful in 16s
CI / build (push) Successful in 17s
CI / quality (push) Successful in 18s
CI / security (push) Successful in 36s
CI / typecheck (push) Successful in 38s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m48s
CI / integration_tests (push) Successful in 3m17s
CI / docker (push) Successful in 40s
CI / coverage (push) Successful in 5m44s
CI / benchmark-publish (push) Successful in 18m40s
Reviewed-on: #654
2026-03-11 02:50:22 +00:00
brent.edwards aa5d5eeaf5 test(session): add TDD failing tests for session create DI error
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 18s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m42s
CI / integration_tests (pull_request) Successful in 3m13s
CI / docker (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 6m15s
CI / benchmark-regression (pull_request) Successful in 34m51s
Implement TDD bug-capture tests for bug #570 where `agents session create`
fails because `_get_session_service()` calls `container.db()` which does
not exist on the DI Container class (AttributeError). Same root cause as
bug #554.

Behave BDD scenarios tagged @tdd_bug @tdd_bug_570 @tdd_expected_fail
exercise the real DI path (no mocks). Includes Robot Framework integration
smoke tests with self-inverting helper and ASV benchmark baseline.

ISSUES CLOSED: #631
2026-03-11 02:42:13 +00:00
hamza.khyari afaae615f2 Merge pull request 'feat(acms): implement Temporal Data Model (Revision-Aware RDF) with 3 storage tiers' (#615) from feature/m6-temporal-data-model-revision-aware-rdf into master
CI / lint (push) Successful in 15s
CI / build (push) Successful in 16s
CI / quality (push) Successful in 17s
CI / typecheck (push) Successful in 39s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 51s
CI / unit_tests (push) Successful in 2m39s
CI / docker (push) Successful in 40s
CI / integration_tests (push) Successful in 3m28s
CI / coverage (push) Successful in 5m30s
CI / benchmark-publish (push) Successful in 18m31s
Reviewed-on: #615
Reviewed-by: Brent Edwards <brent.edwards@cleverthis.com>
2026-03-11 01:43:38 +00:00
hamza.khyari d5f7f15215 feat(acms): implement Temporal Data Model (Revision-Aware RDF) with 3 storage tiers
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 14s
CI / quality (pull_request) Successful in 20s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 39s
CI / unit_tests (pull_request) Successful in 2m50s
CI / integration_tests (pull_request) Successful in 3m22s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m49s
CI / benchmark-regression (pull_request) Successful in 35m15s
Temporal metadata fields (validFrom, validUntil, isCurrent, isRevisionOf)
on UKO InformationUnit nodes enable revision chain tracking: when code
changes, old nodes are marked historical and new revision nodes are
created with back-links. Three storage tiers (hot/warm/cold) filter
nodes by temporal scope (current/recent/all) with configurable retention
(warm_retention_hours default 24h, cold_retention_days default 90d).

Includes TemporalMetadata, TemporalNode, RevisionChain, TierQueryResult,
TierRetentionConfig frozen domain models, TemporalBackend protocol,
InMemoryTemporalBackend stub, TemporalService with structlog and DI,
BackendSet.temporal typing upgrade from object|None to TemporalBackend|None.
67 Behave scenarios, 8 Robot Framework tests, ASV benchmarks, and
reference documentation.

ISSUES CLOSED: #577
2026-03-11 01:36:06 +00:00
hamza.khyari 95808fdf77 Merge pull request 'feat(acms): implement Real-time Index Sync / UKOIndexer with pluggable analyzers' (#612) from feature/m5-realtime-index-sync-ukoindexer into master
CI / lint (push) Successful in 13s
CI / build (push) Successful in 17s
CI / quality (push) Successful in 21s
CI / security (push) Successful in 35s
CI / typecheck (push) Successful in 37s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 3m6s
CI / integration_tests (push) Successful in 3m24s
CI / docker (push) Successful in 1m1s
CI / coverage (push) Successful in 6m20s
CI / benchmark-publish (push) Has been cancelled
Reviewed-on: #612
Reviewed-by: Brent Edwards <brent.edwards@cleverthis.com>
2026-03-11 01:33:38 +00:00
hamza.khyari 12b026e100 Merge remote-tracking branch 'origin/master' into feature/m5-realtime-index-sync-ukoindexer
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 34s
CI / typecheck (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 2m40s
CI / integration_tests (pull_request) Successful in 3m20s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m35s
CI / benchmark-regression (pull_request) Successful in 34m56s
2026-03-11 01:26:26 +00:00
brent.edwards 0a7892b030 Merge pull request 'test(session): add TDD failing tests for session list DI error' (#653) from tdd/session-list-di-error into master
CI / quality (push) Successful in 18s
CI / lint (push) Successful in 21s
CI / build (push) Successful in 22s
CI / security (push) Successful in 36s
CI / typecheck (push) Successful in 38s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m49s
CI / docker (push) Successful in 9s
CI / integration_tests (push) Successful in 3m47s
CI / coverage (push) Successful in 6m20s
CI / benchmark-publish (push) Successful in 18m36s
Reviewed-on: #653
Reviewed-by: Aditya Chhabra <aditya.chhabra@cleverthis.com>
2026-03-11 00:49:26 +00:00
Brent E. Edwards bed7072dde fix(tdd): restore tdd_expected_fail tags and fix Robot helper inversion
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 21s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 42s
CI / unit_tests (pull_request) Successful in 2m35s
CI / docker (pull_request) Successful in 8s
CI / integration_tests (pull_request) Successful in 3m30s
CI / coverage (pull_request) Successful in 5m17s
CI / benchmark-regression (pull_request) Successful in 35m10s
Bug #554 is NOT yet fixed — the DI container still lacks a db provider.
The previous commit incorrectly removed tdd_expected_fail tags, exposing
the real failures in Behave unit tests (13 scenarios).

Root cause: the Robot helper had its own pass/fail inversion (a workaround
from before tdd_expected_fail_listener existed).  The master merge brought
in the listener, causing double inversion that made Robot tests appear to
pass.  This commit:

- Rewrites the helper to report real outcomes (exit 0 = bug fixed)
- Restores tdd_expected_fail on all 16 Robot + Behave scenarios
- Lets the listener (Robot) and environment.py (Behave) handle inversion
2026-03-11 00:40:35 +00:00
hamza.khyari 1e606553d4 feat(acms): implement Real-time Index Sync / UKOIndexer with pluggable analyzers
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m32s
CI / integration_tests (pull_request) Successful in 3m18s
CI / docker (pull_request) Successful in 49s
CI / coverage (pull_request) Successful in 5m29s
CI / benchmark-regression (pull_request) Successful in 33m48s
Implement the UKOIndexer service that produces UKO triples from resources
using pluggable domain-specific analyzers, wraps each triple with provenance
metadata, and simultaneously indexes into text, vector, and graph backends.

Key design decisions and components:

- UKOIndexer orchestrates the full index lifecycle: add_resource,
  update_resource (remove-then-add), remove_resource, and maintenance
  triggers. Each operation fires lifecycle hooks (on_indexed, on_removed,
  on_error) so callers can observe progress.

- Analyzer selection is pluggable via ContentAnalyzer protocol. The indexer
  accepts a registry mapping resource types to analyzers. PythonAnalyzer
  and MarkdownAnalyzer are provided as built-in implementations.

- LocationContentReader protocol abstracts file I/O with a base_dir
  parameter for path-traversal prevention (post-resolve validation rejects
  paths escaping the base directory and non-regular files).

- UKOTriple model includes a @model_validator ensuring at least one of
  object_uri or object_value is populated, preventing empty triples at
  construction time.

- Triple removal uses scoped deletion via uko:sourceResource predicate to
  avoid shared-subject collision — only triples originating from the
  specific resource are removed, not all triples for a shared subject.

- _resource_subjects.pop is deferred until after all backend removal
  operations succeed, preventing inconsistent state on partial failure.

- analyzer.analyze() is wrapped in try/except so that analyzer errors
  produce an IndexResult with error details rather than propagating
  exceptions to callers.

- All lifecycle hook calls are guarded via _fire_on_indexed,
  _fire_on_removed, and _fire_on_error helpers that catch and log hook
  exceptions without disrupting the indexing pipeline.

- max_triples parameter (default 50,000) bounds analyzer output size to
  prevent runaway resource consumption.

- ResourceFileWatcher monitors filesystem paths via watchdog and triggers
  re-indexing callbacks on file changes with configurable debouncing.
  Emits RESOURCE_MODIFIED domain events via EventBus when file changes
  are detected. Debounce timers coalesce rapid edits into a single
  callback invocation. Thread-safe design with daemon threads for clean
  shutdown.

- SearchResult.__post_init__ validates score is in [0.0, 1.0], correctly
  rejecting NaN values.

- Placeholder embedding uses [1.0] instead of [float(len(content))] to
  avoid leaking content size information.

- isinstance check on graph_backend ensures GraphIndexBackend protocol
  compliance at runtime.

- Test doubles extracted to features/mocks/uko_indexer_mocks.py for reuse
  across BDD steps and Robot helpers.

Spec reference: Architecture > ACMS > Real-time Index Synchronization
(specification.md lines ~43205-43300).

ISSUES CLOSED: #578
2026-03-11 00:40:07 +00:00
Brent E. Edwards 3c7915099f fix(tdd): remove tdd_expected_fail tags — bug #554 is fixed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 22s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 39s
CI / unit_tests (pull_request) Failing after 2m39s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m30s
CI / coverage (pull_request) Successful in 5m23s
CI / benchmark-regression (pull_request) Has been cancelled
The merge from master brought in the DI container fix for bug #554.
All 16 session-list TDD tests now pass, so the tdd_expected_fail
tags are removed per the TDD listener protocol.
2026-03-11 00:07:07 +00:00
Brent E. Edwards 6bce5479f3 Merge branch 'master' into tdd/session-list-di-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / build (pull_request) Successful in 18s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 2m41s
CI / integration_tests (pull_request) Failing after 3m19s
CI / docker (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 5m19s
CI / benchmark-regression (pull_request) Has been cancelled
# Conflicts:
#	features/environment.py
#	noxfile.py
2026-03-10 23:34:36 +00:00
brent.edwards 72c7574e10 Merge pull request 'test(cli): add failing tests for session list DI container error (#554)' (#596) from feature/m3-fix-session-list-error into master
CI / lint (push) Successful in 14s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 19s
CI / security (push) Successful in 35s
CI / typecheck (push) Successful in 37s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m51s
CI / integration_tests (push) Successful in 3m22s
CI / docker (push) Successful in 40s
CI / coverage (push) Successful in 7m5s
CI / benchmark-publish (push) Successful in 18m38s
Reviewed-on: #596
Reviewed-by: Rui Hu <rui.hu@cleverthis.com>
2026-03-10 23:30:07 +00:00
brent.edwards de379d4a33 Merge remote-tracking branch 'origin/master' into feature/m3-fix-session-list-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 18s
CI / typecheck (pull_request) Successful in 37s
CI / security (pull_request) Successful in 50s
CI / unit_tests (pull_request) Successful in 2m49s
CI / integration_tests (pull_request) Successful in 3m27s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m16s
CI / benchmark-regression (pull_request) Successful in 34m45s
# Conflicts:
#	CHANGELOG.md
2026-03-10 23:12:20 +00:00
Brent E. Edwards 73d5552467 fix(actor): handle empty actor list without validation error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 13s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 2m37s
CI / docker (pull_request) Successful in 39s
CI / integration_tests (pull_request) Successful in 4m42s
CI / coverage (pull_request) Successful in 7m0s
CI / benchmark-regression (pull_request) Successful in 32m19s
ActorRegistry._actor_name() built names via f"{provider}/{model}", which
produced names with multiple slashes when providers included models
containing "/" (e.g. OpenRouter's "anthropic/claude-sonnet-4-20250514").
The resulting name violated the spec pattern ^[a-z0-9_-]+/[a-z0-9_-]+$
and triggered a ValidationError during actor upsert.

Now sanitises both provider and model components by replacing "/" with "-"
and lowercasing, so multi-slash provider models no longer break actor
listing.

Includes 6 Behave BDD regression scenarios (covering zero-provider,
multi-slash, consecutive-slash, leading-slash, and name-validation
cases), Robot Framework integration smoke tests, and ASV benchmarks.

ISSUES CLOSED: #592
2026-03-10 23:11:22 +00:00
brent.edwards 832b8a8b5a Merge pull request 'test(cli): add failing tests for session create DI container error (#570)' (#595) from feature/m3-fix-session-create-error into master
CI / lint (push) Successful in 14s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 19s
CI / security (push) Successful in 34s
CI / typecheck (push) Successful in 38s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m34s
CI / docker (push) Successful in 39s
CI / integration_tests (push) Successful in 3m21s
CI / coverage (push) Successful in 5m11s
CI / benchmark-publish (push) Successful in 19m46s
Reviewed-on: #595
Reviewed-by: Rui Hu <rui.hu@cleverthis.com>
2026-03-10 23:08:20 +00:00
brent.edwards 8d235c97fc Merge branch 'tdd/session-create-di-error' into tdd/actor-list-validation 2026-03-10 22:57:24 +00:00
brent.edwards 142895e34d Merge remote-tracking branch 'origin/master' into feature/m3-fix-session-create-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 18s
CI / quality (pull_request) Successful in 21s
CI / typecheck (pull_request) Successful in 39s
CI / security (pull_request) Successful in 39s
CI / unit_tests (pull_request) Successful in 4m22s
CI / integration_tests (pull_request) Successful in 5m2s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m9s
CI / benchmark-regression (pull_request) Successful in 34m47s
# Conflicts:
#	CHANGELOG.md
2026-03-10 22:56:43 +00:00
brent.edwards 2365f9a355 test(actor): add TDD failing tests for actor list empty validation error
Behave BDD scenarios (3) tagged @tdd_bug @tdd_bug_592 @tdd_expected_fail
exercise the real ActorRegistry._actor_name() code path with a provider
whose default model contains '/' separators. The tests assert correct
behaviour (exit 0, single-slash names, valid JSON) and fail while the
bug is present; the @tdd_expected_fail handler inverts results so CI
stays green.

Includes Robot Framework integration smoke tests (3), ASV benchmarks (3),
and a shared FakeProviderInfo/FakeProviderRegistry mock in
features/mocks/fake_provider.py.

ISSUES CLOSED: #634
2026-03-10 22:40:15 +00:00
brent.edwards 4fff7f67c5 fix(test): use scoped_session to prevent GC-induced data loss in r2cov
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 16s
CI / lint (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m35s
CI / docker (pull_request) Successful in 39s
CI / integration_tests (pull_request) Successful in 3m22s
CI / coverage (pull_request) Successful in 6m4s
CI / benchmark-regression (pull_request) Has been cancelled
SQLite in-memory engines use SingletonThreadPool, giving every Session
the same underlying connection.  Repository methods create a new
Session via the factory, flush, then return — letting the Session go
out of scope.  Under high memory pressure (e.g. 32 parallel behave
workers) Python's garbage collector closes these orphaned Sessions,
issuing an implicit ROLLBACK on the shared connection and wiping
flushed-but-uncommitted rows written by other Sessions.

Replace the plain sessionmaker with scoped_session in the r2cov
Background step so that every factory() call returns the same Session
instance.  A single long-lived Session per scenario eliminates the
premature close/rollback window entirely.

Verified: 3 consecutive green runs with --processes 32 (10 099
scenarios, 0 failures each).

Refs: #570
2026-03-10 22:27:37 +00:00
Brent E. Edwards 1e116e3fec Merge branch 'master' into tdd/session-list-di-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 18s
CI / quality (pull_request) Successful in 19s
CI / security (pull_request) Successful in 37s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m50s
CI / docker (pull_request) Successful in 9s
CI / integration_tests (pull_request) Successful in 3m31s
CI / coverage (pull_request) Successful in 5m27s
CI / benchmark-regression (pull_request) Successful in 32m48s
2026-03-10 22:22:25 +00:00
Brent E. Edwards 1be8dd9cb9 Merge branch 'master' into feature/m3-fix-session-list-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 13s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 4m32s
CI / docker (pull_request) Successful in 16s
CI / integration_tests (pull_request) Successful in 5m9s
CI / coverage (pull_request) Successful in 6m26s
CI / benchmark-regression (pull_request) Successful in 33m0s
2026-03-10 22:22:01 +00:00
Brent E. Edwards d0689573e0 test(cli): add failing tests for session create DI container error
CI / lint (pull_request) Successful in 13s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 18s
CI / build (pull_request) Successful in 32s
CI / security (pull_request) Successful in 48s
CI / typecheck (pull_request) Successful in 55s
CI / unit_tests (pull_request) Failing after 2m41s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m25s
CI / coverage (pull_request) Successful in 5m56s
CI / benchmark-regression (pull_request) Successful in 33m35s
Add TDD regression tests for bug #570 where `_get_session_service()`
calls `container.db()` but the DI `Container` class has no `db`
provider, raising `AttributeError`.  Same root cause as bug #554.

Includes 4 Behave BDD scenarios tagged `@tdd_bug @tdd_bug_570
@tdd_expected_fail`, Robot Framework integration smoke tests with
`--format plain`, and ASV service-layer benchmarks.  Tests exercise the
real DI path by resetting `_service = None` and using a file-based
SQLite database.

Implements the `@tdd_expected_fail` inversion infrastructure:
- Behave: `after_scenario` hook in `features/environment.py` inverts
  pass/fail for scenarios tagged `@tdd_expected_fail`
- Robot: `robot/tdd_expected_fail_listener.py` listener (API v3)
  performs the same inversion for Robot test cases
- `noxfile.py`: registers the listener via `--listener` in both the
  `integration_tests` and `slow_integration_tests` sessions

Migrates 18 existing TDD scenarios across 5 feature files from the old
`@tdd @bugNNN` convention to the standardised `@tdd_bug @tdd_bug_NNN`
tags per CONTRIBUTING.md § TDD Bug Test Tags.

Refs: #570
2026-03-10 21:39:31 +00:00
Brent E. Edwards 4c5589da4e test(cli): add failing TDD tests for session list DI container error
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 18s
CI / typecheck (pull_request) Successful in 37s
CI / security (pull_request) Successful in 39s
CI / unit_tests (pull_request) Successful in 3m11s
CI / integration_tests (pull_request) Successful in 3m15s
CI / docker (pull_request) Successful in 9s
CI / coverage (pull_request) Successful in 5m15s
CI / benchmark-regression (pull_request) Successful in 32m13s
Add 10 Behave BDD scenarios (@tdd_bug @tdd_bug_554 @tdd_expected_fail)
for the session list DI wiring bug where _get_session_service() calls
container.db() but the Container has no db provider (AttributeError).
Scenarios cover empty list, format validation (JSON/YAML/plain/rich),
init-then-list lifecycle, and post-create list paths.

Implement @tdd_expected_fail infrastructure: Behave after_scenario hook
inverts FAIL→PASS (expected) and PASS→FAIL (unexpected fix), plus Robot
Framework listener (Listener API v3) with identical semantics registered
via --listener in both integration_tests and slow_integration_tests nox
sessions.

Migrate 18 existing TDD scenarios across 5 feature files from legacy
@tdd @bugNNN convention to @tdd_bug @tdd_bug_NNN per CONTRIBUTING.md
§ TDD Bug Test Tags.

Includes Robot Framework integration smoke tests and ASV service-layer
benchmarks.

Refs: #554
2026-03-10 21:24:42 +00:00
brent.edwards 471426f5b6 Merge branch 'master' into tdd/session-create-di-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 51s
CI / unit_tests (pull_request) Successful in 2m40s
CI / docker (pull_request) Successful in 39s
CI / integration_tests (pull_request) Successful in 3m21s
CI / coverage (pull_request) Successful in 6m38s
CI / benchmark-regression (pull_request) Successful in 32m8s
2026-03-10 21:08:17 +00:00
freemo c054675167 feat(resource): add database resources
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 18s
CI / build (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 38s
CI / security (pull_request) Successful in 40s
CI / integration_tests (pull_request) Successful in 4m5s
CI / unit_tests (pull_request) Successful in 4m56s
CI / coverage (pull_request) Successful in 5m13s
CI / docker (pull_request) Successful in 1m10s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 19s
CI / build (push) Successful in 17s
CI / security (push) Successful in 37s
CI / typecheck (push) Successful in 40s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m59s
CI / integration_tests (push) Successful in 3m24s
CI / docker (push) Successful in 40s
CI / coverage (push) Successful in 5m14s
CI / benchmark-publish (push) Successful in 17m55s
CI / benchmark-regression (pull_request) Successful in 34m15s
Implement database resource types (postgres, mysql, sqlite, duckdb)
with connection args, auth handling, and transaction-based sandbox
strategy using BEGIN/ROLLBACK/COMMIT wrappers.

Key changes:
- Add DatabaseResourceHandler with 4 database type definitions
- Implement TransactionSandbox for transaction_rollback strategy
- Wire TransactionSandbox into SandboxFactory
- Register database types in bootstrap_builtin_types
- Add connection validation with credential masking
- Add Behave BDD tests, Robot integration tests, ASV benchmarks

ISSUES CLOSED: #342
2026-03-10 19:29:27 +00:00
brent.edwards 9ee4c4aa2d Merge pull request 'fix(test): resolve race condition in M4 validation integration test' (#619) from fix/m4-validation-race-condition into master
CI / lint (push) Successful in 15s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 19s
CI / typecheck (push) Successful in 39s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 44s
CI / unit_tests (push) Failing after 2m39s
CI / docker (push) Has been skipped
CI / integration_tests (push) Successful in 3m25s
CI / coverage (push) Successful in 5m4s
CI / benchmark-publish (push) Successful in 18m47s
Reviewed-on: #619
Reviewed-by: Rui Hu <rui.hu@cleverthis.com>
2026-03-10 19:13:22 +00:00
brent.edwards b80a9232fa test(session): add TDD failing tests for session create DI error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 28s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 38s
CI / security (pull_request) Successful in 1m11s
CI / typecheck (pull_request) Successful in 1m15s
CI / unit_tests (pull_request) Successful in 6m16s
CI / docker (pull_request) Successful in 10s
CI / integration_tests (pull_request) Successful in 6m39s
CI / coverage (pull_request) Successful in 5m24s
CI / benchmark-regression (pull_request) Successful in 32m27s
Implement TDD bug-capture tests for bug #570 where `agents session create`
fails because `_get_session_service()` calls `container.db()` which does
not exist on the DI Container class (AttributeError). Same root cause as
bug #554.

Behave BDD scenarios tagged @tdd_bug @tdd_bug_570 @tdd_expected_fail
exercise the real DI path (no mocks). Includes Robot Framework integration
smoke tests with self-inverting helper and ASV benchmark baseline.

ISSUES CLOSED: #631
2026-03-10 19:05:18 +00:00
brent.edwards 06bbe48a9c test(session): add TDD failing tests for session list DI error
CI / lint (pull_request) Successful in 21s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 36s
CI / build (pull_request) Successful in 24s
CI / typecheck (pull_request) Successful in 59s
CI / security (pull_request) Successful in 1m14s
CI / unit_tests (pull_request) Successful in 3m27s
CI / docker (pull_request) Successful in 40s
CI / integration_tests (pull_request) Successful in 6m40s
CI / coverage (pull_request) Successful in 5m12s
CI / benchmark-regression (pull_request) Successful in 32m46s
Implement TDD bug-capture tests for bug #554 where `agents session list`
fails because `_get_session_service()` calls `container.db()` which does
not exist on the DI Container class (AttributeError).

Behave BDD scenarios tagged @tdd_bug @tdd_bug_554 @tdd_expected_fail
exercise the real DI path (no mocks) and assert correct behavior. The
@tdd_expected_fail handler in environment.py inverts failed→passed while
the bug is present, keeping CI green.

Also adds:
- @tdd_expected_fail infrastructure in features/environment.py
  (tag validation + status inversion in after_scenario hook)
- behave-parallel exit logic fix to use summary-based failure
  detection (compatible with TDD status inversion)
- Robot Framework integration smoke tests with self-inverting helper
- ASV benchmark baseline for session list command throughput

ISSUES CLOSED: #630
2026-03-10 19:05:12 +00:00
Brent E. Edwards d88dad94f6 fix(test): resolve race condition in M4 validation integration test
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 25s
CI / quality (pull_request) Successful in 25s
CI / build (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 1m9s
CI / security (pull_request) Successful in 1m18s
CI / integration_tests (pull_request) Successful in 3m43s
CI / unit_tests (pull_request) Successful in 4m8s
CI / docker (pull_request) Successful in 43s
CI / coverage (pull_request) Successful in 5m35s
CI / benchmark-regression (pull_request) Successful in 32m44s
Three-pronged fix for intermittent pabot-parallel race condition in
M4 validation integration tests:

1. Composable Setup Database Isolation keyword in common.resource
   gives each suite a unique CLEVERAGENTS_DATABASE_URL so concurrent
   pabot workers never contend on the same SQLite file.

2. Per-suite CLEVERAGENTS_HOME directories prevent shared temp
   directory cleanup from racing between workers.

3. Centralised reset_global_state() in robot/helpers_common.py clears
   Settings singleton, DI container, provider registry, and engine
   cache between chained CLI invocations in helper processes.

Also:
- Setup Test Environment now accepts optional mock_ai and
  auto_apply_migrations arguments (default TRUE) for backward
  compatibility while allowing suites to opt out.
- Added Suite Teardown to cli_plan_context_commands.robot.
- Fixed _COMMANDS typing in two helpers to eliminate type: ignore.
- Updated docs/development/testing.md to reflect helpers_common
  delegation pattern.
- Added timeout=30s to all Run Process calls in
  m4_e2e_verification.robot.

Fixes: #563
2026-03-10 19:04:57 +00:00
freemo 876217d0ca feat(guardrails): implement Per-Session and Per-Org Cost Budgets
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 24s
CI / typecheck (pull_request) Successful in 37s
CI / security (pull_request) Successful in 44s
CI / unit_tests (pull_request) Successful in 2m40s
CI / integration_tests (pull_request) Successful in 3m19s
CI / docker (pull_request) Successful in 42s
CI / coverage (pull_request) Successful in 5m10s
CI / lint (push) Successful in 12s
CI / build (push) Successful in 16s
CI / quality (push) Successful in 21s
CI / security (push) Successful in 32s
CI / typecheck (push) Successful in 37s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Failing after 2m36s
CI / docker (push) Has been skipped
CI / integration_tests (push) Successful in 3m16s
CI / coverage (push) Successful in 5m3s
CI / benchmark-publish (push) Successful in 17m54s
CI / benchmark-regression (pull_request) Successful in 31m55s
Implements Forgejo issue #584: three-tier budget hierarchy
(per-plan -> per-session -> per-org) with tightest limit winning.

Domain models:
- BudgetLevel enum (PLAN, SESSION, ORG)
- BudgetCheckResult (frozen Pydantic model with exceeded_level, warning)
- SessionCostBudget (tracks per-session accumulated cost)
- OrgCostAccumulator (tracks per-org accumulated cost)
- ThreadSafeOrgCostAccumulator (thread-safe wrapper with snapshot)

Application services:
- CostBudgetService: manages budget state, enforces hierarchy,
  emits BUDGET_WARNING (once per session) and BUDGET_EXCEEDED events
- AutonomyGuardrailService: extended with associate_plan_with_session,
  check_budget_hierarchy, record_plan_cost_to_session methods

Configuration:
- Settings: session_max_cost_usd, org_max_cost_usd, budget_warning_threshold

Integration:
- Session model: cost_budget field, as_cli_dict includes budget data
- DI container: CostBudgetService registered as Singleton
- CLI session show: cost budget panel display

Tests:
- 54 Behave scenarios (features/cost_budgets.feature)
- 11 Robot Framework integration tests (robot/cost_budgets.robot)
- ASV benchmarks (benchmarks/bench_budget_check.py)

All nox stages pass: lint, typecheck, unit_tests, coverage_report (98%).

CLOSES #584
2026-03-10 14:18:04 -04:00