|
| 1 | +# ADR-0016: Layered execution scopes for action invocation |
| 2 | + |
| 3 | +- **Status:** accepted |
| 4 | +- **Date:** 2026-04-05 |
| 5 | +- **Deciders:** @Aksem |
| 6 | +- **Tags:** actions, architecture, orchestration, extension-runner, wm-server |
| 7 | + |
| 8 | +## Context |
| 9 | + |
| 10 | +Action invocation in FineCode occurs across architectural components and |
| 11 | +multiple execution scopes. In particular, FineCode distinguishes the Workspace |
| 12 | +Manager (WM) from Extension Runners (ERs), and invocation can cross those |
| 13 | +boundaries: |
| 14 | + |
| 15 | +- one action may invoke another within a single ER runtime boundary |
| 16 | +- one project-scoped request may require coordination across multiple execution |
| 17 | + environments and runners |
| 18 | +- one workspace-scoped request may fan out across multiple projects under WM |
| 19 | + coordination |
| 20 | + |
| 21 | +These scopes have different topology visibility, ownership boundaries, and |
| 22 | +operational controls. |
| 23 | + |
| 24 | +If one contract tries to cover all of them, local invocation semantics become |
| 25 | +coupled to orchestration concerns that they do not own. That makes the system |
| 26 | +harder to evolve and reason about because: |
| 27 | + |
| 28 | +- local nested action invocation and cross-boundary orchestration have |
| 29 | + different guarantees |
| 30 | +- recursion and fan-out control apply to orchestration scopes, not local scope |
| 31 | +- WM-managed project/workspace topology should not leak into local ER |
| 32 | + execution contracts |
| 33 | + |
| 34 | +FineCode needs an explicit architectural rule that distinguishes execution |
| 35 | +scopes while preserving generic, action-agnostic orchestration. |
| 36 | + |
| 37 | +## Related ADRs Considered |
| 38 | + |
| 39 | +- Reviewed [ADR-0003](0003-process-isolation-per-extension-environment.md) - |
| 40 | + defines environment process isolation; this ADR defines invocation scope |
| 41 | + boundaries across those processes. |
| 42 | +- Reviewed [ADR-0011](0011-wm-aggregates-progress-across-multi-project-action-runs.md) - |
| 43 | + defines WM ownership for aggregated progress in fan-out requests; this ADR |
| 44 | + defines execution interface layering for such fan-out. |
| 45 | +- Reviewed [ADR-0013](0013-action-declares-handler-execution-strategy.md) - |
| 46 | + defines intra-action handler relationship; this ADR defines cross-boundary |
| 47 | + invocation scope and ownership. |
| 48 | + |
| 49 | +## Decision |
| 50 | + |
| 51 | +FineCode adopts a layered execution model by scope: |
| 52 | + |
| 53 | +- Local execution scope: invocation within a single ER runtime boundary. |
| 54 | +- Project execution scope: invocation for one project under a project-scoped |
| 55 | + contract. |
| 56 | +- Workspace execution scope: invocation across multiple projects under a |
| 57 | + workspace-scoped contract. |
| 58 | + |
| 59 | +### Architectural boundaries |
| 60 | + |
| 61 | +1. Local execution contracts remain local and do not carry project/workspace |
| 62 | + topology concerns. |
| 63 | +2. Cross-boundary orchestration is represented by separate higher-scope |
| 64 | + contracts, not by widening local contracts. |
| 65 | +3. Project and workspace orchestration remain generic and action-agnostic, and |
| 66 | + are owned by WM-level execution capabilities rather than ER-local contracts. |
| 67 | +4. Coordination that depends on shared resources across projects must model |
| 68 | + those resources explicitly rather than relying on implicit shared state. |
| 69 | + |
| 70 | +### Ownership rule |
| 71 | + |
| 72 | +- ER-local components own local action invocation semantics. |
| 73 | +- WM-level orchestration owns cross-runner and cross-project coordination |
| 74 | + mechanics. |
| 75 | +- Action-specific orchestration policy belongs to the orchestrating |
| 76 | + action/service, not to generic orchestration infrastructure. |
| 77 | + |
| 78 | +## Consequences |
| 79 | + |
| 80 | +- One scope, one contract. Callers can choose local, project, or workspace |
| 81 | + execution contracts explicitly. |
| 82 | +- Future-safe evolution. Single-project execution can evolve from local to |
| 83 | + orchestrated without redefining local contracts. |
| 84 | +- No action-specific WM coupling. WM remains a generic execution mechanism for |
| 85 | + project/workspace fan-out. |
| 86 | +- Additional interface surface. Introducing layered contracts increases |
| 87 | + architectural surface area and requires clear naming/documentation. |
| 88 | +- Operational safeguards required. Orchestration scopes require recursion and |
| 89 | + fan-out controls. |
| 90 | + |
| 91 | +### Alternatives Considered |
| 92 | + |
| 93 | +Directly using one unified action-runner interface across all scopes. Rejected |
| 94 | +because it conflates local and orchestration concerns, reducing contract clarity |
| 95 | +and increasing accidental coupling. |
| 96 | + |
| 97 | +Extending only the local runner interface to cover project/workspace |
| 98 | +orchestration. Rejected because topology-aware behavior is not a local concern |
| 99 | +and would blur ownership boundaries. |
| 100 | + |
| 101 | +Keeping orchestration implicit behind internal mechanisms without |
| 102 | +scope-specific contracts. Rejected because orchestration would remain implicit |
| 103 | +and difficult to reuse consistently from callers that need it. |
| 104 | + |
| 105 | +### Related Decisions |
| 106 | + |
| 107 | +- Complements [ADR-0003](0003-process-isolation-per-extension-environment.md) |
| 108 | + by clarifying invocation semantics across isolated runner processes. |
| 109 | +- Refines [ADR-0011](0011-wm-aggregates-progress-across-multi-project-action-runs.md) |
| 110 | + by defining broader execution-scope layering. |
0 commit comments