Commit Graph

40 Commits

Author SHA1 Message Date
aditya c02f3842ae feat(tui): implement persona system and reference/command input modes
- Add `agents tui` command wiring and Textual app scaffolding for interactive TUI startup.
- Implement TUI persona schema/registry/state with local YAML persistence and per-session persona binding.
- Add three input-mode flows: Normal (`@` references), Command (`/` slash commands), and Shell (`!` passthrough).
- Introduce TUI widgets/overlays for prompt, persona bar, reference picker, and slash command interactions.
- Extend REPL command routing to support persona/session commands and reference/shell dispatch behavior.
- Add test coverage: Behave features + step definitions, Robot TUI smoke test, and ASV fuzzy-reference benchmark.

ISSUES CLOSED: #695
2026-03-18 10:09:05 +00:00
CoreRasurae 4d3499dcfb feat(async): wire retry policies into services
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 74772280e6 perf(tests): optimize coverage instrumentation and reporting pipeline
Replace coverage.py (sys.settrace-based) with slipcover (bytecode-based
instrumentation) for significantly faster coverage collection:

- Each behave-parallel worker runs under slipcover, producing per-feature
  JSON coverage files with unique UUIDs to avoid write contention.
- After all workers finish, slipcover --merge combines per-worker data
  into a single build/coverage.json report.
- XML report generated via slipcover --merge --xml for CI tooling.
- Terminal report with --fail-under=97 threshold enforcement.
- Robust JSON key-fallback logic handles both slipcover and coverage.py
  output formats.
- CI workflow (ci.yml, nightly-quality.yml) updated with defensive key
  lookup instead of hardcoded coverage.py format.
- Documentation updated to reflect slipcover as the coverage tool.
- CHANGELOG.md updated.

ISSUES CLOSED: #482
2026-03-02 02:01:27 +00:00
brent.edwards 69a86858a7 feat(cli): add config get/set/list commands 2026-02-19 23:48:40 +00:00
Jeffrey Phillips Freeman ee5f0376d7 Replaced hand written Reference section with one generated from docstrings 2026-02-16 23:40:33 -05:00
brent.edwards 7ddd99b07d chore(merge): integrate master into feature/q0-min-coverage
Resolve three merge conflicts from master integration:

- benchmarks/coverage_report_bench.py: remove duplicate PYPROJECT_PATH
  constant (already defined below the conflict region)
- noxfile.py: combine HEAD's os.makedirs('build') guard with master's
  resolved PYTHONPATH (Path('src').resolve())
- implementation_plan.md: take master for completed Q0-min-ci block,
  preserve HEAD's in-progress Q0-min-coverage state, adopt master's
  Q0-Advanced consolidation (no standalone commits)
2026-02-17 00:56:43 +00:00
freemo 983eee7a37 Fix: Fixed failing unit tests due to outdated behave version and alembic typo, and other fixes. 2026-02-16 14:21:06 -05:00
freemo 2d345ae31c feat(tool): add tool lifecycle runtime
Implement the four-stage tool lifecycle (discover/activate/execute/deactivate)
with capability enforcement, per-plan activation caching, JSON Schema validation,
execution tracing, and cancellation propagation.

New modules:
- tool/context.py: ToolExecutionContext, BoundResource, Change, CancellationToken
- tool/lifecycle.py: ToolRuntime, ToolInstance protocol, ToolLifecycleCache
- tool/schema_validator.py: JSON Schema input/output validation

Tests: 57 Behave scenarios, 6 Robot smoke tests, 5 ASV benchmarks
Coverage: context 100%, schema_validator 100%, lifecycle 94%, overall 97%
2026-02-14 18:55:48 +00:00
brent.edwards 75dc57845a feat(qa): align security scans with nox 2026-02-13 19:24:24 +00:00
CoreRasurae f2f7aa5dc9 feat(core): add v3 lifecycle models, automation levels, subplan support, and security hardening
Implement multiple Stage A/B/E/SEC milestones for the v3 lifecycle system:
- Stage A5.3+A5.4: Add LifecycleActionModel and LifecyclePlanModel SQLAlchemy
  models with to_domain()/from_domain() conversion methods
- Stage A5.6: Implement ActionRepository with full CRUD, namespace/state
  queries, referential integrity checks, and retry decorator
- Stage E1: Add subplan domain models (ExecutionMode, SubplanMergeStrategy,
  SubplanConfig, SubplanStatus, SubplanAttempt, SubplanFailureHandler) with
  computed properties on Plan (is_subplan, is_root_plan, depth, has_subplans)
- Stage A6: Add AutomationLevel enum (MANUAL, REVIEW_BEFORE_APPLY,
  FULL_AUTOMATION), settings integration, PlanLifecycleService auto-progression,
  pause/resume, and CLI commands (--automation-level, set-automation-level)
- Stage SEC1: Remove eval()/exec() from stream_router.py, replace with named
  operation and transform registries; code blocks and unregistered transforms
  now raise StreamRoutingError
- Add langchain-anthropic dependency
- Update BDD tests for security changes and relax ADR directory requirement
2026-02-12 20:19:42 +00:00
brent.edwards 64f58f6406 fix(deps): pin behave==1.2.6 in tests extra to match dev extra
behave-parallel pulls behave>=1.2.6 which resolves to 1.3.3. Behave
1.3.3 no longer strips trailing colons from step text before tables,
breaking the architecture.feature step matcher.
2026-02-12 07:01:08 +00:00
brent.edwards 4ae8a9ee3a ci(.forgejo/workflows/ci.yml): remove unused behave-parallel
No longer installing behave-parallel. Also removed other uploads that won't work.
2026-02-12 03:30:13 +00:00
brent.edwards 1774debbc4 ci(pyproject.toml): force the version of ruff
ruff should now be version 0.15.
2026-02-12 02:07:59 +00:00
brent.edwards 761db2518c test: harden code sandbox, add path traversal protection, and fix test mocks 2026-02-12 01:07:44 +00:00
brent.edwards 395df78b94 test(qa): add validation fixtures, edge-case scenarios, and quality baseline
Complete Brent QA tasks Q1.5, 10B.4, 10C.1, and 10C.4 on the Q0-quality-automation branch.

- Add edge_case_plan_scenarios.feature (26 scenarios) covering concurrent
  plan execution, resource conflicts, validation failure chains, and
  rollback edge cases
- Add validation_test_fixtures.feature (34 scenarios) covering AST
  security, lambda validation, content sanitization, project model
  validation, change-list coercion, and ActionArgument parsing
- Add branch protection rules documentation in docs/development/ci-cd.md
- Establish quality metrics baseline (96% coverage, 0 lint/type/security
  findings)
- Fix missing langchain-anthropic dependency in pyproject.toml
- Fix Rich table column wrapping in plan_lifecycle_cli_steps.py by
  patching console width during tests

Suite: 107 features, 1673 scenarios, 7777 steps — all passing.
2026-02-10 22:19:21 +00:00
brent.edwards 3f7cb06981 feat(Adding-commitizen-to-the-list-of-tools.): adds commitizen to the list of tools 2026-02-10 16:04:17 +00:00
brent.edwards 7ef5ebb695 feat: Add Q0: Pre-commit hooks setup.
This should automatically check for problems on build.
2026-02-10 16:04:17 +00:00
freemo 0d9eaa85cb Docs: Added kroki support to documentation for diagrams 2026-02-09 16:14:09 -05:00
freemo 61cd406fbf feat: implemented new plan CLI commands 2026-02-05 10:33:02 -05:00
freemo 3cf6a812ae feat: ported in run behavior as a subcommand of actor 2026-02-04 14:43:08 -05:00
freemo 2403f25252 feat: Ported the bulk of v2 w/tests 2026-01-27 21:55:06 -05:00
freemo 6dfd41cafe Feat: Pulled in core engine from v2 for running configs 2025-12-29 21:25:14 -05:00
freemo 162b1e35d0 Build: Made Robot integration tests run in parallel 2025-12-20 10:28:51 -05:00
freemo 5a24d42024 Build: Made behave so it can run in parallel at 1/3 the time 2025-12-19 20:57:14 -05:00
freemo 4f4cefb369 Feat: implemented vector store service 2025-12-06 00:23:48 -05:00
freemo 4ee19b9977 Feat: Added in memory_service and plan_service features 2025-11-18 17:04:01 -05:00
freemo 958c29b18a Feat: Moved to langchain based providers 2025-11-18 00:10:29 -05:00
freemo cbafe7fac4 Implemented unit of work 2025-11-11 20:09:06 -05:00
freemo 4f05e8a016 feat(cli): Wrote core CLI commands and tests 2025-11-06 23:51:03 -05:00
freemo 8a1cd0dd35 Got test coverage up on unit tests 2025-11-05 17:32:01 -05:00
freemo 9008f1a99d Tentatively finishing phase 1 2025-11-05 17:07:35 -05:00
CleverAgents Dev fb6f559780 feat(architecture): Added skeleton for phase 1 2025-11-05 15:11:03 -05:00
CleverAgents Dev 9631a0d5f4 Ready for phase 1, took the tests and tagged them from phase 0 so they wont run every time moving forward 2025-11-04 13:49:43 -05:00
freemo a6f3bd3841 feat(discovery): Add comprehensive data contracts documentation and validation framework
This commit adds JSON/YAML schemas, Python stubs, fixture examples, and comprehensive test coverage for data contracts across all modules (auth, AI models, contexts, plans, orgs, etc.). Implements automated validation through Behave and
2025-11-01 23:33:12 -04:00
freemo 068484f7d5 Completed inventory extractor step 2025-11-01 21:20:55 -04:00
freemo 12fe4413f0 Completed nox code coverage tasks 2025-11-01 20:56:38 -04:00
freemo f74688e5f9 Refactored the boilerplate code to CleverAgents 2025-11-01 19:04:29 -04:00
freemo b941ef9a1a Significantly revamped the base project to use more robust static checking including benchmarks and integration test support 2025-10-31 16:18:53 -04:00
Your Name bae6665d94 fix: Fixed some of the broken stuff added in the last commit, everything should more or less run now 2025-08-03 20:48:29 -04:00
freemo f7a5d26c41 Modernized build tooling 2025-08-01 18:38:09 -04:00