Commit Graph

305 Commits

Author SHA1 Message Date
aditya a0f56228e2 Merge branch 'master' into feature/m3-mcp-adapter 2026-02-27 06:40:15 +00:00
freemo 120274da99 feat(di): wire decision services
Create DecisionService application-layer service that wraps
DecisionRepository with structured logging and UnitOfWork transaction
management. Wire DecisionService and PlanLifecycleService into the DI
container as Factory providers.

Inject DecisionService into PlanLifecycleService so that phase
transitions automatically record decisions: start_strategize records a
strategy_choice decision and start_execute records an
implementation_choice decision. Decision recording is optional and
never blocks lifecycle transitions.

Add Behave feature (5 scenarios), Robot Framework smoke tests (2 test
cases), ASV benchmarks (3 benchmark classes), and DI reference
documentation.

ISSUES CLOSED: #173
2026-02-27 02:33:42 +00:00
khyari hamza 493e5cf8a1 fix(security): wire read_only through ExecuteStubActor and replace stubs with real tests
- Add read_only kwarg to ExecuteStubActor.execute(), propagated to
  ChangeSetCapture; PlanExecutor._run_execute_with_stub passes
  plan.read_only through the execution path (P1 #2 fix)
- Replace CLI fail-fast and Action-Skill stub scenarios with real
  ExecuteStubActor spy test and SkillContext.enforce_write_guard
  integration tests (P2 #1 fix)
- Update docs: remove unimplemented Layer 5 (Action-Skill), add
  ExecuteStubActor wiring description, fix test command (P2 #2 fix)

ISSUES CLOSED: #322
2026-02-26 20:33:20 +00:00
khyari hamza 2b09568cfa feat(security): enforce read-only actions
Tighten ToolRuntime._enforce_capabilities() to block ANY tool with
writes=True when plan_read_only is set, removing the not-cap.read_only
loophole that allowed certain write tools through. Tool name is now
always included in the ToolAccessDeniedError message.

Add read_only flag to ChangeSetCapture with ReadOnlyViolationError
raised when write-capable tools are wrapped on a read-only plan.

Add CLI fail-fast guards on plan execute and plan apply commands that
abort before calling the service layer if plan.read_only is True.

SkillContext.enforce_write_guard() already included tool name
correctly and required no changes.

Includes 18 Behave scenarios (90 steps), Robot integration tests,
ASV benchmarks, and docs/reference/read_only_actions.md.

ISSUES CLOSED: #322
2026-02-26 20:33:20 +00:00
freemo 4ed057fa58 Docs: Fixed refs in docs 2026-02-26 14:40:17 -05:00
freemo c88b432beb Docs: Daily timeline update 2026-02-26 14:32:59 -05:00
brent.edwards ffdd2f2b19 Merge branch 'master' into develop-brent-5 2026-02-26 16:14:07 +00:00
brent.edwards 32b81793a2 refactor(test): rename decision persistence files to avoid conflict with master
Rename our serialization-focused decision persistence suites to
*_serialization to avoid add/add conflicts with the repository-based
decision persistence suites that landed on master independently:

- decision_persistence.feature -> decision_persistence_serialization.feature
- decision_persistence_steps.py -> decision_persistence_serialization_steps.py
- decision_persistence_bench.py -> decision_persistence_serialization_bench.py
- decision_persistence.robot -> decision_persistence_serialization.robot
- helper_decision_persistence.py -> helper_decision_persistence_serialization.py

Updated robot helper path, step docstring, and testing.md references.
2026-02-26 16:13:44 +00:00
khyari hamza c406781b86 fix(security): address PR #435 review feedback
P0: reject register() after close_all() with RuntimeError.
P1: catch CancelledError in close_all(), use WeakKeyDictionary for
cancellation_reasons to prevent memory leak, guard StateManager
update_state/reset/load_checkpoint/time_travel after close().
P2: contextlib.suppress in __del__ for partial construction, re-cancel
pending tasks in cleanup_tasks_async, handle late tasks added during
await window, guard AcpEventQueue.publish() after close with _is_closed
flag and is_closed property, fix ASV TimeRegisterBatch crash.
Tests: 5 new Behave scenarios (T1-T4 + is_closed), log handler and
event loop cleanup in after_scenario (T5-T6).
Docs: async_safety.md updated for register-after-close and state
mutation guards.

ISSUES CLOSED: #321
2026-02-26 14:30:43 +00:00
khyari hamza 5d5d3fde2c fix(security): close async resources and leaks
Add AsyncResourceTracker (core/async_cleanup.py) providing a central
registry for async resources with timeout-bounded close_all(), async
context manager support, and a __del__ finalizer that logs leaked
resources by name.

Enhance LangGraphBridge with cleanup_tasks_async() that awaits
in-flight tasks with a deadline instead of fire-and-forget cancel().
Add cancellation_reasons dict to trace why tasks were cancelled.

Add StateManager.close() to properly release checkpoint file handles
and complete the RxPY BehaviorSubject. Add AcpEventQueue.close() to
dispose all subscriptions.

Includes 14 Behave scenarios (67 steps), Robot integration tests,
ASV benchmarks, and docs/reference/async_safety.md.

ISSUES CLOSED: #321
2026-02-26 14:30:43 +00:00
khyari hamza 27bef69ddd feat(decision): add decision persistence
Add decision persistence layer with DecisionRepository, DecisionModel,
and Alembic migration. Includes tree queries (BFS traversal via deque,
path-to-root), superseded lookup, ordered decision path retrieval,
concrete Decision type annotations (via TYPE_CHECKING), and comprehensive
test coverage (Behave BDD, Robot Framework, ASV benchmarks). Updated
database_schema.md, CHANGELOG.md, and CONTRIBUTORS.md.

ISSUES CLOSED: #171
2026-02-26 13:40:07 +00:00
aditya 595cfd172f Merge branch 'master' into feature/m3-mcp-adapter 2026-02-26 13:30:29 +00:00
aditya 519e26fb02 Merge branch 'master' into feature/m3-mcp-adapter 2026-02-26 06:44:38 +00:00
aditya b8d7c4c893 Merge branch 'master' into feature/m2-actor-yaml 2026-02-26 06:21:39 +00:00
freemo e3fcce413b feat(changeset): persist changesets and diff artifacts
Add SQLite persistence for ChangeSet entries and ToolInvocation records
via new changeset_repository module implementing the ChangeSetStore protocol.

- Alembic migration d0_001 creates changeset_entries and tool_invocations tables
- SqliteChangeSetStore, ChangeSetEntryRepository, ToolInvocationRepository
- PlanApplyService.cleanup_changeset() for cancel/failure cleanup
- Behave tests (17 scenarios), Robot tests (5 cases), ASV benchmarks
- Reference documentation in docs/reference/changeset.md

Closes #163
2026-02-26 02:47:14 +00:00
brent.edwards 3d3c8fda33 Merge feature/m4-decision-tests into develop-brent-5 2026-02-26 02:15:01 +00:00
brent.edwards b3f126b147 Merge feature/m3-decision-validation-smoke into develop-brent-5 2026-02-26 02:14:14 +00:00
brent.edwards b99510d016 fix(test): derive decision type count from enum instead of hard-coding 11
Replace hard-coded '11 decision types' with dynamic len(DecisionType) in
the assertion and remove the literal from scenario names, step patterns,
docstrings, and docs so the tests stay correct when new DecisionType
values are added.
2026-02-26 01:19:28 +00:00
brent.edwards 93730067a2 fix(test): address review findings in M3 smoke tests
- Replace dead after_scenario() hook with context.add_cleanup() calls
  so patchers are properly stopped (Behave only runs hooks from
  environment.py)
- Fix invalid ULID constants: pad DECISION/CORRECTION to 26 chars,
  replace invalid 'I' with 'J' in INVARIANT_ULID
- Add temp file cleanup for NamedTemporaryFile(delete=False) via
  context.add_cleanup() in behave steps and try/finally in robot helper
- Remove decision-persistence doc sections from testing.md that belong
  in PR #438, not this PR
2026-02-26 01:13:16 +00:00
brent.edwards c80cda2590 Merge feature/m4-correction-subplan-smoke into develop-brent-5 2026-02-25 22:11:33 +00:00
brent.edwards 917c2bc546 test(e2e): add M4 correction + subplan suites 2026-02-25 21:51:26 +00:00
brent.edwards ace7311de4 test(e2e): add M3 decision + validation suites 2026-02-25 21:26:19 +00:00
brent.edwards f4c4884d03 test(persistence): add decision persistence suites
Add comprehensive persistence test suites for the Decision domain model
covering serialization round-trips (model_dump/model_validate, JSON),
context-snapshot persistence, correction-chain reconstruction, and
decision-tree reconstruction from serialized data.

Deliverables:
- Behave: 21 scenarios in features/decision_persistence.feature
- Robot Framework: 7 integration tests in robot/decision_persistence.robot
- ASV benchmarks: 4 suites (17 benchmarks) in benchmarks/decision_persistence_bench.py
- Documentation: Updated docs/development/testing.md

ISSUES CLOSED: #180
2026-02-25 21:19:57 +00:00
brent.edwards d055b59d7c Merge branch 'master' into develop-brent-4 2026-02-25 20:05:18 +00:00
brent.edwards 3b58432ecc docs(merge): merge new docs into branch 2026-02-25 19:41:56 +00:00
freemo c4f71e930d feat(concurrency): add plan resume
Implement step-level progress persistence and plan resume with graceful
shutdown handling.

- Add ResumeCheckpoint, ResumeMetadata, ResumeEligibility, ResumeSummary
  domain models (resume.py)
- Add PlanResumeService with validate_eligibility(), build_resume_summary(),
  resume_plan(dry_run), record_step_checkpoint(), record_shutdown()
- Add last_completed_step and last_checkpoint_id fields to Plan model
- Add 'plan resume' CLI command with --dry-run flag
- Update plan lifecycle docs (ADR-006) with resume behavior section
- Add Behave tests (24 scenarios in plan_resume.feature)
- Add Robot Framework integration tests (10 tests)
- Add ASV benchmarks for resume overhead

Closes #328
2026-02-25 14:00:04 -05:00
freemo 134dce896a feat(provider): add cost controls and fallback
Add token/cost tracking, budget enforcement (per-plan and per-day),
provider fallback selection with capability filtering, and cost
metadata for plan models.

New modules:
- providers/cost_table.py: CostEntry + ProviderCostTable with default
  pricing for OpenAI, Anthropic, Google, Groq, Together, Cohere, Mock
- providers/cost_tracker.py: BudgetStatus enum, BudgetCheckResult,
  CostTracker with warn-at-90%/block-at-100% enforcement
- providers/fallback_selector.py: FallbackSelector with capability
  filtering (tool_calls, streaming, vision, json_mode) and budget
- domain/models/core/cost_metadata.py: CostMetadata + BudgetExhaustionEvent

Modified:
- config/settings.py: budget_per_plan, budget_per_day, fallback_providers
- domain/models/core/plan.py: cost_metadata field + CLI dict surfacing
- providers/__init__.py: public exports for new classes

Testing:
- 71 Behave scenarios in features/cost_controls.feature (all pass)
- 6 Robot Framework integration tests (all pass)
- ASV benchmarks in benchmarks/cost_controls_bench.py
- nox lint, typecheck, format, docs, build, dead_code, security_scan pass

Closes #324
2026-02-25 12:08:01 -05:00
freemo 7a298ede6e feat(concurrency): add plan and project locks
Implemented plan-level and project-level locking with configurable timeouts.
Added locks table via Alembic migration storing owner_id, resource_type,
resource_id, acquired_at, and expires_at. Locks enforced in
PlanLifecycleService transitions. Support for re-entrant acquisition,
lock renewal, graceful shutdown release, and startup cleanup of expired
locks. Added diagnostics check for stale lock reporting.

ISSUES CLOSED: #327
2026-02-25 10:48:05 -05:00
aditya ee82d6101e feat(skill): add MCP adapter for external tools
Implement MCPToolAdapter to connect to external MCP servers, enumerate
tools, and register them in ToolRegistry with source="mcp". Includes
connect/reconnect/disconnect lifecycle with timeout enforcement, input
validation on invoke, capability inference, Behave/Robot/ASV tests, and
docs/reference/mcp_adapter.md.

ISSUES CLOSED: #159
2026-02-25 13:17:26 +00:00
aditya 913fd31e07 Merge branch 'master' into feature/m2-actor-yaml 2026-02-25 10:31:07 +00:00
aditya e476d2de0e feat(actor): extend hierarchical actor YAML schema and loader
Extend actor YAML schema to support hierarchical graphs with explicit
node types (agent, tool, conditional, subgraph), per-node LSP bindings
(lsp_binding with server, languages, auto, capabilities), and tool-source
references (skills, mcp_servers, agent_skills).

Add schema validation for namespaced actor references, duplicate node IDs,
edge target existence, and graph reachability — all nodes must be reachable
from entry_node via explicit edges or conditional node routing targets.

Update loader to report YAML parse errors with precise line/column positions
and schema validation errors with dotted field paths and remediation hints
pointing to docs/reference/actor_config.md.

Add docs/reference/actor_config.md as the practical configuration reference
covering hierarchical graph examples, node type table, topology rules, and
common error cases with fix guidance.

Refresh examples/actors/graph_workflow.yaml to replace deprecated actor_path
with actor_ref. Add benchmarks/actor_yaml_bench.py for schema load overhead.

Tests: 95 Behave scenarios, 10 Robot smoke tests (including hierarchical
loader smoke test), security scan clean, coverage 99% (threshold 97%).

ISSUES CLOSED: #157
2026-02-25 10:30:42 +00:00
CoreRasurae a7dc917021 fix(security): harden template rendering
ISSUES CLOSED: #319
2026-02-25 10:06:27 +00:00
CoreRasurae 8604bc66b6 fix(security): enforce explicit exception handling
ISSUES CLOSED: #320
2026-02-25 10:05:57 +00:00
CoreRasurae d70a5d84ae feat(plan): add error recovery patterns and CLI hints
ISSUES CLOSED: #186
2026-02-25 10:05:10 +00:00
CoreRasurae fe69d132f1 feat(dod): enforce definition-of-done gating
ISSUES CLOSED: #178
2026-02-25 10:04:31 +00:00
CoreRasurae 4874f2ad6f feat(validation): add validation pipeline and results model
ISSUES CLOSED: #175
2026-02-25 10:03:57 +00:00
CoreRasurae 57fcc880c3 feat(apply): run validation attachments
ISSUES CLOSED: #176
2026-02-25 10:03:21 +00:00
CoreRasurae 95b6ed57c2 feat(change): add diff review artifacts
ISSUES CLOSED: #303
2026-02-25 10:02:38 +00:00
CoreRasurae ab6a3fd732 feat(apply): add validation-gated apply pipeline
ISSUES CLOSED: #155
2026-02-25 10:01:57 +00:00
brent.edwards e230700857 Merge feature/m1-e2e-sourcecode into develop-brent-4 2026-02-25 06:36:45 +00:00
brent.edwards dbc9be9fc0 Merge feature/m2-actor-tool-smoke into develop-brent-4 2026-02-25 06:35:44 +00:00
brent.edwards 5bf1908708 Merge branch 'master' into feature/m1-e2e-sourcecode 2026-02-25 06:07:09 +00:00
brent.edwards 0397a00eb6 test(e2e): add M1 source-code plan lifecycle suite 2026-02-25 04:50:43 +00:00
brent.edwards 9bf87a20d9 chore(pr): address code review feedback for PR #421
- Added CHANGELOG.md entry for M2 E2E test suite (CONTRIBUTING.md §6)
- Added Brent E. Edwards to CONTRIBUTORS.md (CONTRIBUTING.md §8)
- Fixed docs/development/testing.md: corrected M2 Behave scenario count
  from 11 to 10 to match actual feature file
- Added standard explanatory comments to benchmark sys.path setup
  for consistency with project convention (advisory)
- Replaced untyped lambda handler with typed _m2_noop_handler function
  in step definitions (advisory)

All nox stages pass: lint, typecheck, format, unit_tests (280 features /
5846 scenarios / 0 failures), integration_tests (682 passed),
coverage_report (97.2%).

ISSUES CLOSED: #169
2026-02-25 04:13:55 +00:00
brent.edwards d5c7780a53 Merge branch 'master' into feature/m2-actor-tool-smoke 2026-02-25 03:08:57 +00:00
brent.edwards 3a66ce4d02 Merge branch 'master' into feature/m4-cli-extension-tests 2026-02-25 02:58:58 +00:00
freemo 1282bc03b3 Docs: Updated timeline 2026-02-24 17:18:02 -05:00
brent.edwards a2a91c3d9c Merge branch 'master' into feature/m2-actor-tool-smoke 2026-02-24 21:59:58 +00:00
brent.edwards c8434e21f3 Merge branch 'master' into feature/m4-cli-extension-tests 2026-02-24 21:56:43 +00:00
brent.edwards 093a74953f test(e2e): add M2 actor + tool source smoke suite
Add comprehensive E2E test suite for M2 (Actor Graphs + Tool Sources) epic:

- Behave BDD: 10 scenarios covering actor YAML loading, skill registry,
  tool lifecycle (discover/activate/execute/deactivate), and MCP stub
- Robot Framework: 6 integration tests via CLI helper script
- ASV benchmarks: 12 benchmarks for actor loading, skill registry,
  tool lifecycle, and MCP stub performance baselines
- MCP stub server mock: in-process fake with 3 tools (search/fetch/transform)
- Fixtures: hierarchical graph actor YAML + skill pack with tool refs and
  inline tools
- Docs: updated testing.md with M2 smoke suite section

Closes #169
2026-02-24 21:55:24 +00:00