Skip to content

epic: adaptive execution architecture — four models, context bridging, lineage (ADR-0007) #201

@mdproctor

Description

@mdproctor

Summary

Implements the full architecture defined in ADR-0007: four co-equal execution models feeding a shared execution kernel, pluggable context bridging from CaseContext through WorkflowContext to AgenticScope and beyond, complete causal lineage across all nested boundaries, and frictionless langchain4j-agentic integration.

Design References

Child Epics

Epic Area
#202 Agnostic routing layer and execution kernel
#203 ContextBridge protocol and worker-level context selection
#204 Scope propagation, return-path tracking, and write-through
#205 Complete causal lineage across all execution boundaries
#206 Orchestration — workflow-based (FlowWorker ↔ WorkOrchestrator)
#207 Orchestration — rules-based (Drools/DMN → WorkOrchestrator)
#208 Plan-based execution (PlanExecutor, Plan model, PlanSource SPI)
#209 langchain4j-agentic integration (AgenticScopeBridge, CasehubPlanner, AgentListener)
#210 Cancellation, timeout, and error recovery across boundaries
#211 Observability — lineage queries, context stack visibility, A2A tracing

Guiding Principles (from ADR-0007)

  1. All four execution models share one execution kernel. Only the router differs.
  2. No execution model is privileged — choreography is not the default.
  3. Context model is worker-level, not case-level. Null bridge = CaseContext directly (backward compatible).
  4. Every unit of work at every level emits a `CaseLedgerEntry`. `causedByEntryId` chains are complete.
  5. langchain4j: `AgenticScope` ↔ `WorkflowContext` ↔ `CaseContext` — three distinct contexts, bridged not merged.
  6. `ContextBridge` SPI makes future execution models and context types pluggable.

Suggested implementation order

  1. epic: agnostic routing layer and execution kernel #202 Routing kernel (foundation for everything)
  2. epic: ContextBridge protocol and worker-level context selection #203 ContextBridge (foundation for context work)
  3. epic: scope propagation, return-path tracking, and context write-through #204 Scope propagation (enables correct multi-level context flow)
  4. epic: complete causal lineage across all execution boundaries #205 Lineage (enables observability on all work done above)
  5. epic: orchestration — workflow-based (FlowWorker ↔ WorkOrchestrator bridge) #206 Workflow orchestration (largest gap, highest demand)
  6. epic: plan-based execution — PlanExecutor, Plan data model, PlanSource SPI #208 Planning (enables LLM-driven execution)
  7. epic: langchain4j-agentic integration — AgenticScopeBridge, CasehubPlanner, AgentListener #209 langchain4j integration (builds on all of the above)
  8. epic: orchestration — rules-based (Drools/DMN → WorkOrchestrator) #207 Rules orchestration (lower priority, existing primitives mostly cover it)
  9. epic: cancellation, timeout, and error recovery across execution boundaries #210 Cancellation/error recovery (needed for production hardening)
  10. epic: observability — cross-boundary lineage queries, context stack visibility, A2A tracing #211 Observability (builds on epic: complete causal lineage across all execution boundaries #205; progressive enhancement)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepicTracks a large body of related work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions