aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
refactor(orchestration): pure decision-function orchestrator with CAS
- Dominant language
- TypeScript
- Stars
- 143
- Forks
- 46
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 20
Description
**Context:** ROADMAP.md → Pure decision function orchestrator refactor
**Related:** autonomous-feedback-loop draft
---
## Component
API or orchestration
## Describe the feature
Extract orchestrator decision logic into **pure functions**: `(frozen_snapshot) → typed_action`. Side-effect execution applies actions with **CAS guards** on DynamoDB `updated_at` to prevent stale writes. Prerequisite for autonomous feedback loop.
## Use case
Orchestrator logic is hard to unit test with I/O mocks. Competing durable workers risk race conditions. Complex state machines (PR watcher) need a testable core.
## Proposed solution
1. Define `OrchestratorSnapshot` and `OrchestratorAction` types.
2. Pure `decide(snapshot): Action` with exhaustive unit tests (no AWS mocks).
3. Executor applies action with `updated_at` conditional writes.
4. Incremental refactor from current durable handlers—no big-bang.
5. Document in `docs/design/ORCHESTRATOR.md`.
## Other information
- Explicit prerequisite for **autonomous feedback loop** draft.
- Design context: `docs/design/ORCHESTRATOR.md`.
- [x] This might be a breaking change
Contributor guide
Research direction
Start with ROADMAP.md and docs/design/ORCHESTRATOR.md, then trace the current durable orchestration handlers mentioned in the issue. Define the snapshot and action boundaries, cover decide(snapshot) with exhaustive unit tests, and verify that execution uses updated_at conditional writes while preserving incremental compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- backend-api-design, cloud, distributed-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100