agentic-orchestrator 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/CLAUDE.md +2 -2
- package/README.md +47 -14
- package/agentic/orchestrator/agents.yaml +13 -0
- package/agentic/orchestrator/policy.yaml +3 -0
- package/agentic/orchestrator/schemas/agents.schema.json +76 -0
- package/agentic/orchestrator/schemas/policy.schema.json +16 -0
- package/agentic/orchestrator/schemas/policy.user.schema.json +16 -0
- package/agentic/orchestrator/schemas/state.schema.json +53 -0
- package/apps/control-plane/src/application/configuration-service.ts +181 -0
- package/apps/control-plane/src/application/kernel-tool-wiring.ts +292 -0
- package/apps/control-plane/src/application/services/checkpoint-service.ts +523 -0
- package/apps/control-plane/src/application/services/feature-send-message-service.ts +132 -0
- package/apps/control-plane/src/application/services/patch-service.ts +29 -5
- package/apps/control-plane/src/application/services/repo-operations-service.ts +276 -0
- package/apps/control-plane/src/application/services/worktree-watchdog-service.ts +156 -0
- package/apps/control-plane/src/cli/cli-argument-parser.ts +12 -0
- package/apps/control-plane/src/cli/help-command-handler.ts +17 -0
- package/apps/control-plane/src/cli/init-command-handler.ts +31 -0
- package/apps/control-plane/src/cli/resume-command-handler.ts +31 -4
- package/apps/control-plane/src/cli/rollback-command-handler.ts +217 -0
- package/apps/control-plane/src/cli/run-command-handler.ts +8 -0
- package/apps/control-plane/src/cli/types.ts +3 -0
- package/apps/control-plane/src/core/kernel-types.ts +55 -0
- package/apps/control-plane/src/core/kernel.ts +61 -878
- package/apps/control-plane/src/core/tool-caller.ts +10 -0
- package/apps/control-plane/src/core/utils/field-readers.ts +38 -0
- package/apps/control-plane/src/core/utils/index-normalizer.ts +119 -0
- package/apps/control-plane/src/core/utils/path-normalizers.ts +22 -0
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +15 -0
- package/apps/control-plane/src/providers/api-worker-provider.ts +14 -12
- package/apps/control-plane/src/providers/cli-worker-provider.ts +82 -12
- package/apps/control-plane/src/providers/providers.ts +45 -24
- package/apps/control-plane/src/providers/worker-provider-factory.ts +36 -1
- package/apps/control-plane/src/supervisor/run-coordinator.ts +91 -36
- package/apps/control-plane/src/supervisor/runtime.ts +107 -1
- package/apps/control-plane/src/supervisor/types.ts +9 -0
- package/apps/control-plane/src/supervisor/worker-decision-loop.ts +253 -14
- package/apps/control-plane/test/checkpoint-service.spec.ts +537 -0
- package/apps/control-plane/test/cli-helpers.spec.ts +28 -0
- package/apps/control-plane/test/cli.unit.spec.ts +52 -0
- package/apps/control-plane/test/configuration-service.spec.ts +466 -0
- package/apps/control-plane/test/dashboard-api.integration.spec.ts +537 -0
- package/apps/control-plane/test/dashboard-client.spec.ts +233 -0
- package/apps/control-plane/test/feature-send-message-service.spec.ts +314 -0
- package/apps/control-plane/test/init-wizard.spec.ts +35 -0
- package/apps/control-plane/test/path-normalizers.spec.ts +41 -0
- package/apps/control-plane/test/repo-operations-service.spec.ts +339 -0
- package/apps/control-plane/test/resume-command.spec.ts +33 -0
- package/apps/control-plane/test/review-workspace-logic.spec.ts +130 -0
- package/apps/control-plane/test/rollback-command.spec.ts +208 -0
- package/apps/control-plane/test/run-coordinator.spec.ts +119 -0
- package/apps/control-plane/test/worker-decision-loop.spec.ts +209 -0
- package/apps/control-plane/test/worker-provider-adapters.spec.ts +102 -0
- package/apps/control-plane/test/worker-provider-factory.spec.ts +14 -0
- package/apps/control-plane/test/worktree-watchdog-service.spec.ts +147 -0
- package/config/agentic/orchestrator/agents.yaml +13 -0
- package/dist/apps/control-plane/application/configuration-service.d.ts +19 -0
- package/dist/apps/control-plane/application/configuration-service.js +123 -0
- package/dist/apps/control-plane/application/configuration-service.js.map +1 -0
- package/dist/apps/control-plane/application/kernel-tool-wiring.d.ts +39 -0
- package/dist/apps/control-plane/application/kernel-tool-wiring.js +38 -0
- package/dist/apps/control-plane/application/kernel-tool-wiring.js.map +1 -0
- package/dist/apps/control-plane/application/services/checkpoint-service.d.ts +84 -0
- package/dist/apps/control-plane/application/services/checkpoint-service.js +367 -0
- package/dist/apps/control-plane/application/services/checkpoint-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-send-message-service.d.ts +25 -0
- package/dist/apps/control-plane/application/services/feature-send-message-service.js +105 -0
- package/dist/apps/control-plane/application/services/feature-send-message-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/patch-service.d.ts +6 -0
- package/dist/apps/control-plane/application/services/patch-service.js +11 -2
- package/dist/apps/control-plane/application/services/patch-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/repo-operations-service.d.ts +70 -0
- package/dist/apps/control-plane/application/services/repo-operations-service.js +213 -0
- package/dist/apps/control-plane/application/services/repo-operations-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/worktree-watchdog-service.d.ts +23 -0
- package/dist/apps/control-plane/application/services/worktree-watchdog-service.js +119 -0
- package/dist/apps/control-plane/application/services/worktree-watchdog-service.js.map +1 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js +12 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -1
- package/dist/apps/control-plane/cli/help-command-handler.js +17 -0
- package/dist/apps/control-plane/cli/help-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/init-command-handler.js +23 -0
- package/dist/apps/control-plane/cli/init-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/resume-command-handler.js +25 -5
- package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/rollback-command-handler.d.ts +6 -0
- package/dist/apps/control-plane/cli/rollback-command-handler.js +177 -0
- package/dist/apps/control-plane/cli/rollback-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/run-command-handler.js +7 -1
- package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/types.d.ts +3 -0
- package/dist/apps/control-plane/cli/types.js +1 -0
- package/dist/apps/control-plane/cli/types.js.map +1 -1
- package/dist/apps/control-plane/core/configuration-service.d.ts +25 -0
- package/dist/apps/control-plane/core/configuration-service.js +130 -0
- package/dist/apps/control-plane/core/configuration-service.js.map +1 -0
- package/dist/apps/control-plane/core/kernel-tool-wiring.d.ts +50 -0
- package/dist/apps/control-plane/core/kernel-tool-wiring.js +44 -0
- package/dist/apps/control-plane/core/kernel-tool-wiring.js.map +1 -0
- package/dist/apps/control-plane/core/kernel-types.d.ts +48 -0
- package/dist/apps/control-plane/core/kernel-types.js +2 -0
- package/dist/apps/control-plane/core/kernel-types.js.map +1 -0
- package/dist/apps/control-plane/core/kernel.d.ts +17 -48
- package/dist/apps/control-plane/core/kernel.js +44 -539
- package/dist/apps/control-plane/core/kernel.js.map +1 -1
- package/dist/apps/control-plane/core/tool-caller.d.ts +10 -0
- package/dist/apps/control-plane/core/utils/error-normalizer.d.ts +2 -0
- package/dist/apps/control-plane/core/utils/error-normalizer.js +51 -0
- package/dist/apps/control-plane/core/utils/error-normalizer.js.map +1 -0
- package/dist/apps/control-plane/core/utils/field-readers.d.ts +9 -0
- package/dist/apps/control-plane/core/utils/field-readers.js +30 -0
- package/dist/apps/control-plane/core/utils/field-readers.js.map +1 -0
- package/dist/apps/control-plane/core/utils/index-normalizer.d.ts +7 -0
- package/dist/apps/control-plane/core/utils/index-normalizer.js +92 -0
- package/dist/apps/control-plane/core/utils/index-normalizer.js.map +1 -0
- package/dist/apps/control-plane/core/utils/path-normalizers.d.ts +2 -0
- package/dist/apps/control-plane/core/utils/path-normalizers.js +17 -0
- package/dist/apps/control-plane/core/utils/path-normalizers.js.map +1 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +13 -1
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -1
- package/dist/apps/control-plane/providers/api-worker-provider.d.ts +4 -13
- package/dist/apps/control-plane/providers/api-worker-provider.js +10 -0
- package/dist/apps/control-plane/providers/api-worker-provider.js.map +1 -1
- package/dist/apps/control-plane/providers/cli-worker-provider.d.ts +11 -13
- package/dist/apps/control-plane/providers/cli-worker-provider.js +64 -0
- package/dist/apps/control-plane/providers/cli-worker-provider.js.map +1 -1
- package/dist/apps/control-plane/providers/providers.d.ts +31 -24
- package/dist/apps/control-plane/providers/providers.js +10 -0
- package/dist/apps/control-plane/providers/providers.js.map +1 -1
- package/dist/apps/control-plane/providers/worker-provider-factory.d.ts +11 -0
- package/dist/apps/control-plane/providers/worker-provider-factory.js +20 -1
- package/dist/apps/control-plane/providers/worker-provider-factory.js.map +1 -1
- package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js +81 -33
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/runtime.d.ts +8 -1
- package/dist/apps/control-plane/supervisor/runtime.js +90 -0
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -1
- package/dist/apps/control-plane/supervisor/types.d.ts +11 -0
- package/dist/apps/control-plane/supervisor/types.js.map +1 -1
- package/dist/apps/control-plane/supervisor/worker-decision-loop.d.ts +21 -1
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js +207 -13
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -1
- package/package.json +1 -1
- package/packages/web-dashboard/package.json +2 -0
- package/packages/web-dashboard/src/app/analytics/page.tsx +83 -2
- package/packages/web-dashboard/src/app/api/actions/route.ts +92 -1
- package/packages/web-dashboard/src/app/api/analytics/route.ts +5 -2
- package/packages/web-dashboard/src/app/api/features/[id]/checkpoints/[checkpointId]/diff/route.ts +43 -0
- package/packages/web-dashboard/src/app/api/features/[id]/checkpoints/compare/route.ts +45 -0
- package/packages/web-dashboard/src/app/api/features/[id]/checkpoints/stream/route.ts +170 -0
- package/packages/web-dashboard/src/app/api/features/[id]/file-diff/route.ts +144 -0
- package/packages/web-dashboard/src/app/api/features/[id]/log-stream/route.ts +167 -0
- package/packages/web-dashboard/src/app/api/features/[id]/raw-logs/[filename]/route.ts +65 -0
- package/packages/web-dashboard/src/app/api/features/[id]/raw-logs/route.ts +63 -0
- package/packages/web-dashboard/src/app/api/features/[id]/timeline/route.ts +60 -0
- package/packages/web-dashboard/src/app/feature/[id]/page.tsx +32 -11
- package/packages/web-dashboard/src/app/globals.css +2 -0
- package/packages/web-dashboard/src/components/detail-panel.tsx +483 -0
- package/packages/web-dashboard/src/components/review-workspace.tsx +1162 -0
- package/packages/web-dashboard/src/lib/aop-client.ts +725 -0
- package/packages/web-dashboard/src/lib/review-contracts.ts +182 -0
- package/packages/web-dashboard/src/lib/review-workspace-logic.ts +64 -0
- package/packages/web-dashboard/src/lib/types.ts +131 -0
- package/packages/web-dashboard/src/styles/dashboard.module.css +333 -0
- package/spec-files/completed/agentic_orchestrator_execution_mode_spec.md +1905 -0
- package/spec-files/outstanding/agentic_orchestrator_runtime_inspection_spec.md +940 -0
- package/spec-files/outstanding/execution_mode_critical_review.md +355 -0
- package/spec-files/outstanding/shadow_workspace_implementation_spec.md +1271 -0
- package/spec-files/outstanding/shadow_workspace_spec_summary.md +222 -0
- package/spec-files/progress.md +269 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
# Critical Architectural Review: Execution Mode Specification
|
|
2
|
+
|
|
3
|
+
**Reviewer:** Senior Software Architect (Critical Perspective)
|
|
4
|
+
**Date:** 2026-03-05
|
|
5
|
+
**Spec:** `agentic_orchestrator_execution_mode_spec.md`
|
|
6
|
+
**Verdict:** ⚠️ **MAJOR REVISIONS REQUIRED** - Original design had critical flaws
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🔥 FATAL FLAWS IDENTIFIED
|
|
11
|
+
|
|
12
|
+
### 1. Race Conditions Everywhere
|
|
13
|
+
|
|
14
|
+
**Problem:** Watchdog monitors while agent writes. No coordination.
|
|
15
|
+
|
|
16
|
+
**Original Design:** Agent writes freely, checkpoint runs whenever triggered.
|
|
17
|
+
|
|
18
|
+
**Critical Issues:**
|
|
19
|
+
|
|
20
|
+
- Checkpoint validation runs while agent is mid-write
|
|
21
|
+
- Multiple checkpoints could trigger simultaneously
|
|
22
|
+
- File system events arrive out of order
|
|
23
|
+
- No write transaction boundaries
|
|
24
|
+
|
|
25
|
+
**Fix Applied:** Agent pause/resume protocol with acknowledgment, checkpoint serialization, debouncing.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### 2. Validation is Too Late
|
|
30
|
+
|
|
31
|
+
**Problem:** Interactive mode validates AFTER changes are written.
|
|
32
|
+
|
|
33
|
+
**Original Design:** Agent writes → Checkpoint captures diff → Validate → Maybe revert.
|
|
34
|
+
|
|
35
|
+
**Critical Issues:**
|
|
36
|
+
|
|
37
|
+
- Files already modified (potential corruption)
|
|
38
|
+
- Agent made dependent changes based on invalid state
|
|
39
|
+
- Revert is destructive and loses work
|
|
40
|
+
- No atomic rollback guarantee
|
|
41
|
+
|
|
42
|
+
**Fix Applied:** Shadow workspace strategy - agent writes to isolated copy, validation promotes to real worktree only if valid.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### 3. No Rollback Strategy
|
|
47
|
+
|
|
48
|
+
**Problem:** "Optional revert with `git checkout`" is naive.
|
|
49
|
+
|
|
50
|
+
**Original Design:** If validation fails, run `git checkout -- <files>`.
|
|
51
|
+
|
|
52
|
+
**Critical Issues:**
|
|
53
|
+
|
|
54
|
+
- What if agent has uncommitted changes across 50 files?
|
|
55
|
+
- What if some changes valid, some invalid?
|
|
56
|
+
- What if agent still writing when revert happens?
|
|
57
|
+
- What about file system state (temp files, build artifacts)?
|
|
58
|
+
|
|
59
|
+
**Fix Applied:** Three rollback strategies:
|
|
60
|
+
|
|
61
|
+
1. Full checkpoint rollback (restore to exact checkpoint state)
|
|
62
|
+
2. Partial file rollback (revert only violated files)
|
|
63
|
+
3. Smart rollback (keep valid changes, revert only violations)
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### 4. Checkpoint Overhead is Unbounded
|
|
68
|
+
|
|
69
|
+
**Problem:** Every checkpoint runs full `git diff` + validation.
|
|
70
|
+
|
|
71
|
+
**Original Design:** No optimization, no caching, no timeouts.
|
|
72
|
+
|
|
73
|
+
**Critical Issues:**
|
|
74
|
+
|
|
75
|
+
- With 1000 files: parsing takes seconds
|
|
76
|
+
- Complex plan patterns: validation is slow
|
|
77
|
+
- No timeout budget
|
|
78
|
+
- Blocks agent progress
|
|
79
|
+
|
|
80
|
+
**Fix Applied:**
|
|
81
|
+
|
|
82
|
+
- Validation cache (per file + plan version)
|
|
83
|
+
- Incremental diff (only changed files since last checkpoint)
|
|
84
|
+
- Timeout budgets (5s max, then degrade)
|
|
85
|
+
- Sampling for large changesets (>100 files)
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### 5. Concurrent Feature Isolation is Broken
|
|
90
|
+
|
|
91
|
+
**Problem:** "Each feature has isolated worktree" but services are singletons.
|
|
92
|
+
|
|
93
|
+
**Original Design:** Shared watchdog service, no concurrency control.
|
|
94
|
+
|
|
95
|
+
**Critical Issues:**
|
|
96
|
+
|
|
97
|
+
- Watchdog service has shared state
|
|
98
|
+
- Checkpoint service has no concurrency control
|
|
99
|
+
- Validation service could be bottlenecked
|
|
100
|
+
- File system events could be misattributed
|
|
101
|
+
|
|
102
|
+
**Fix Applied:**
|
|
103
|
+
|
|
104
|
+
- Per-feature watchdog instances (separate `chokidar` per feature)
|
|
105
|
+
- Checkpoint serialization per feature
|
|
106
|
+
- Validation queue with priority and concurrency limits
|
|
107
|
+
- Backpressure (max 5 concurrent interactive features)
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### 6. Agent Notification is Fire-and-Forget
|
|
112
|
+
|
|
113
|
+
**Problem:** "Send message via WorkerProvider.sendMessage" assumes agent listens.
|
|
114
|
+
|
|
115
|
+
**Original Design:** No acknowledgment, no retry, no escalation.
|
|
116
|
+
|
|
117
|
+
**Critical Issues:**
|
|
118
|
+
|
|
119
|
+
- Agent may not be listening
|
|
120
|
+
- Agent may not respond
|
|
121
|
+
- Agent may not understand message format
|
|
122
|
+
- Agent could ignore critical violations
|
|
123
|
+
|
|
124
|
+
**Fix Applied:** Structured message protocol with:
|
|
125
|
+
|
|
126
|
+
- Acknowledgment requirement for critical messages
|
|
127
|
+
- Timeout and retry logic
|
|
128
|
+
- Escalation to human on repeated failures
|
|
129
|
+
- Agent pause on critical violations
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### 7. No Graceful Degradation
|
|
134
|
+
|
|
135
|
+
**Problem:** If watchdog/checkpoint/validation fails, what happens?
|
|
136
|
+
|
|
137
|
+
**Original Design:** No error handling, no fallback, no recovery.
|
|
138
|
+
|
|
139
|
+
**Critical Issues:**
|
|
140
|
+
|
|
141
|
+
- Agent continues running blind
|
|
142
|
+
- Changes accumulate without validation
|
|
143
|
+
- System state becomes inconsistent
|
|
144
|
+
- No recovery path
|
|
145
|
+
|
|
146
|
+
**Fix Applied:**
|
|
147
|
+
|
|
148
|
+
- Circuit breakers (3 failures → escalate to human)
|
|
149
|
+
- Health checks for all services
|
|
150
|
+
- Automatic fallback to deterministic mode
|
|
151
|
+
- Agent timeout with forced checkpoint
|
|
152
|
+
- Recovery protocol with state capture
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### 8. Audit Trail is Incomplete
|
|
157
|
+
|
|
158
|
+
**Problem:** Checkpoints only capture state at intervals.
|
|
159
|
+
|
|
160
|
+
**Original Design:** Only checkpoint snapshots, no intermediate events.
|
|
161
|
+
|
|
162
|
+
**Critical Issues:**
|
|
163
|
+
|
|
164
|
+
- No record of intermediate states
|
|
165
|
+
- No record of attempted-but-reverted files
|
|
166
|
+
- No record of agent's decision process
|
|
167
|
+
- Cannot reconstruct exact sequence
|
|
168
|
+
|
|
169
|
+
**Fix Applied:**
|
|
170
|
+
|
|
171
|
+
- Continuous event log (every file change with timestamp)
|
|
172
|
+
- Checkpoint chains (linked list of checkpoints)
|
|
173
|
+
- Incremental + cumulative diffs
|
|
174
|
+
- Validation history log
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### 9. Security Nightmare
|
|
179
|
+
|
|
180
|
+
**Problem:** Agent has direct file system access with only periodic validation.
|
|
181
|
+
|
|
182
|
+
**Original Design:** No sandboxing, no resource limits, no path validation.
|
|
183
|
+
|
|
184
|
+
**Critical Issues:**
|
|
185
|
+
|
|
186
|
+
- Agent could write malicious code that executes before checkpoint
|
|
187
|
+
- Agent could modify `.git` directory
|
|
188
|
+
- Agent could escape worktree via symlinks
|
|
189
|
+
- Agent could exhaust disk space
|
|
190
|
+
|
|
191
|
+
**Fix Applied:**
|
|
192
|
+
|
|
193
|
+
- Path canonicalization and validation
|
|
194
|
+
- `.git` directory protection (immediate block)
|
|
195
|
+
- Symlink detection and removal
|
|
196
|
+
- Disk quota per feature (1GB limit)
|
|
197
|
+
- Executable file detection and flagging
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
### 10. Performance Assumptions are Unvalidated
|
|
202
|
+
|
|
203
|
+
**Problem:** "Checkpoint validation completes in < 500ms" - based on what?
|
|
204
|
+
|
|
205
|
+
**Original Design:** No benchmarks, no budgets, no degradation strategy.
|
|
206
|
+
|
|
207
|
+
**Critical Issues:**
|
|
208
|
+
|
|
209
|
+
- What if diff is 10,000 lines?
|
|
210
|
+
- What if plan has 100 allowed_areas patterns?
|
|
211
|
+
- What if lock service is slow?
|
|
212
|
+
- What if file system is network-mounted?
|
|
213
|
+
|
|
214
|
+
**Fix Applied:**
|
|
215
|
+
|
|
216
|
+
- Explicit latency budgets with targets and maximums
|
|
217
|
+
- Timeout-based degradation strategies
|
|
218
|
+
- Throughput requirements
|
|
219
|
+
- Resource limits per feature and globally
|
|
220
|
+
- Monitoring metrics and alert thresholds
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## ✅ IMPROVEMENTS APPLIED
|
|
225
|
+
|
|
226
|
+
### Architecture Enhancements
|
|
227
|
+
|
|
228
|
+
1. **Shadow Workspace Strategy**
|
|
229
|
+
- Agent writes to isolated shadow directory
|
|
230
|
+
- Validation before promotion to real worktree
|
|
231
|
+
- Atomic promotion or discard
|
|
232
|
+
- Configurable per feature or globally
|
|
233
|
+
|
|
234
|
+
2. **Agent Communication Protocol**
|
|
235
|
+
- Structured message format (JSON)
|
|
236
|
+
- Pause/resume with acknowledgment
|
|
237
|
+
- Violation notifications with severity
|
|
238
|
+
- Timeout and retry logic
|
|
239
|
+
|
|
240
|
+
3. **Rollback Capabilities**
|
|
241
|
+
- Full checkpoint rollback
|
|
242
|
+
- Partial file rollback
|
|
243
|
+
- Smart rollback (keep valid, revert violations)
|
|
244
|
+
- Inverse diff application
|
|
245
|
+
|
|
246
|
+
4. **Performance Budgets**
|
|
247
|
+
- Latency targets: checkpoint < 500ms, validation < 1s
|
|
248
|
+
- Throughput targets: 100 file changes/sec
|
|
249
|
+
- Resource limits: 1GB disk per feature, 50MB memory per watchdog
|
|
250
|
+
- Degradation strategies for all timeouts
|
|
251
|
+
|
|
252
|
+
5. **Concurrency Control**
|
|
253
|
+
- Per-feature service instances
|
|
254
|
+
- Validation queue with priority
|
|
255
|
+
- Backpressure (max 5 concurrent interactive features)
|
|
256
|
+
- Event attribution per feature
|
|
257
|
+
|
|
258
|
+
6. **Security Hardening**
|
|
259
|
+
- Path validation and canonicalization
|
|
260
|
+
- `.git` directory protection
|
|
261
|
+
- Symlink detection and blocking
|
|
262
|
+
- Disk quota enforcement
|
|
263
|
+
- Executable file detection
|
|
264
|
+
|
|
265
|
+
7. **Graceful Degradation**
|
|
266
|
+
- Circuit breakers (3 failures → escalate)
|
|
267
|
+
- Health checks for all services
|
|
268
|
+
- Automatic fallback to deterministic mode
|
|
269
|
+
- Recovery protocol with state capture
|
|
270
|
+
|
|
271
|
+
8. **Audit Trail Completeness**
|
|
272
|
+
- Continuous event log (JSONL format)
|
|
273
|
+
- Checkpoint chains (linked list)
|
|
274
|
+
- Incremental + cumulative diffs
|
|
275
|
+
- Validation history
|
|
276
|
+
|
|
277
|
+
9. **Monitoring and Observability**
|
|
278
|
+
- Checkpoint latency (p50, p95, p99)
|
|
279
|
+
- Validation latency and cache hit rate
|
|
280
|
+
- Checkpoint failure rate
|
|
281
|
+
- Disk/memory usage per feature
|
|
282
|
+
- Alert thresholds
|
|
283
|
+
|
|
284
|
+
10. **Provider Capability Detection**
|
|
285
|
+
- Query provider for interactive mode support
|
|
286
|
+
- Automatic fallback if unsupported
|
|
287
|
+
- Clear error messages
|
|
288
|
+
- Standardized capability interface
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## 📊 SPEC METRICS
|
|
293
|
+
|
|
294
|
+
| Metric | Before | After | Change |
|
|
295
|
+
| ------------------------ | ------ | ---------- | ------ |
|
|
296
|
+
| Total lines | 951 | 1805 | +90% |
|
|
297
|
+
| Risk sections | 4 | 9 | +125% |
|
|
298
|
+
| Mitigation strategies | 8 | 27 | +238% |
|
|
299
|
+
| Code examples | 12 | 28 | +133% |
|
|
300
|
+
| Performance requirements | 0 | 4 sections | NEW |
|
|
301
|
+
| Security mitigations | 1 | 5 | +400% |
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 🎯 RECOMMENDATION
|
|
306
|
+
|
|
307
|
+
**Status:** ✅ **APPROVED WITH REVISIONS**
|
|
308
|
+
|
|
309
|
+
The original design was fundamentally flawed for production use. The revised spec addresses all critical issues and is now ready for implementation with the following caveats:
|
|
310
|
+
|
|
311
|
+
1. **Start with Strategy A (Direct Worktree)** for simplicity, but implement Strategy B (Shadow Workspace) infrastructure from day one for easy migration.
|
|
312
|
+
|
|
313
|
+
2. **Implement circuit breakers and health checks first** before any interactive mode execution.
|
|
314
|
+
|
|
315
|
+
3. **Performance budgets are mandatory** - do not ship without timeout and degradation strategies.
|
|
316
|
+
|
|
317
|
+
4. **Security hardening is non-negotiable** - path validation, `.git` protection, and disk quotas must be in place before beta.
|
|
318
|
+
|
|
319
|
+
5. **Monitor everything** - checkpoint latency, validation failures, disk usage, memory usage. Set up alerts before production.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## 📋 IMPLEMENTATION PRIORITY
|
|
324
|
+
|
|
325
|
+
### P0 (Must Have Before Any Interactive Execution)
|
|
326
|
+
|
|
327
|
+
- Agent pause/resume protocol
|
|
328
|
+
- Path validation and security hardening
|
|
329
|
+
- Circuit breakers and health checks
|
|
330
|
+
- Checkpoint serialization (no concurrent checkpoints per feature)
|
|
331
|
+
|
|
332
|
+
### P1 (Must Have Before Beta)
|
|
333
|
+
|
|
334
|
+
- Shadow workspace strategy implementation
|
|
335
|
+
- Rollback strategies (full, partial, smart)
|
|
336
|
+
- Performance budgets and timeouts
|
|
337
|
+
- Monitoring and alerts
|
|
338
|
+
|
|
339
|
+
### P2 (Must Have Before Production)
|
|
340
|
+
|
|
341
|
+
- Validation cache
|
|
342
|
+
- Continuous event log
|
|
343
|
+
- Provider capability detection
|
|
344
|
+
- Graceful degradation and fallback
|
|
345
|
+
|
|
346
|
+
### P3 (Nice to Have)
|
|
347
|
+
|
|
348
|
+
- Validation sampling for large changesets
|
|
349
|
+
- Real-time dashboard streaming
|
|
350
|
+
- Checkpoint comparison UI
|
|
351
|
+
- Advanced rollback commands
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
**Conclusion:** The spec is now production-ready with comprehensive risk mitigation. Original design would have failed catastrophically in production. Revised design is robust, safe, and performant.
|