aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
RFC: Checkpoint rewind and fork for off-track tasks
- Lenguaje dominante
- TypeScript
- Estrellas
- 143
- Forks
- 46
- Merge medio
- 3 d 10 h
- PR fusionados (30 d)
- 24
Descripción
## Primary area
Cross-cutting / multiple
## Related issue or feature request
- [WORKFLOWS.md](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/blob/main/docs/design/WORKFLOWS.md) — `workflow_state.json` checkpoints
- #252 (step-aware event supersede on orchestrator replay — distinct concern)
- #484 (S3-backed SDK session store — recommended before v1)
- #560 (workflow commit trailers — git lineage)
## Summary
Expose **operator-driven rewind and fork** for workflow execution: resume a terminal or failed task from an earlier completed step without full cold-start, or branch a new task from a checkpoint to explore an alternate approach.
```bash
bgagent rewind --list
bgagent rewind --to implement
bgagent fork --to plan
```
## Use case and motivation
When an agent goes off-track late in a workflow, operators re-submit tasks or manually check out branches — losing checkpoint context and burning cold-start cost. Rewind reduces waste; fork supports A/B exploration under audit.
Distinct from #252, which fixes **duplicate progress events** when the orchestrator replays durable steps — not operator-initiated rewind to an earlier workflow step.
## Proposal
1. Extend `workflow_state.json` (and TaskRecord metadata) with ordered checkpoint entries: `step_name`, `step_kind`, `sdk_session_id`, `git_commit_sha`, artifact pointers.
2. **Rewind:** new task pinned to checkpoint; skip completed deterministic steps; re-enter agent at selected step; `rewound_from` lineage.
3. **Fork:** same without archiving source; `forked_from` lineage.
4. CLI commands + orchestrator create-task path.
## Out of scope
- Automatic rewind on verify failure (#457)
- Per-step orchestrator durable checkpoints (agent-side only per ADR-014)
- Compensation/rollback of side effects (e.g. unpublish PR)
## Potential challenges
- Session resume without #484 may restart agent at turn 0 even if steps are skipped.
- `ensure_pr` / `deliver_artifact` idempotency on re-entry.
- Admission limits for new RUNNING tasks.
---
**Note:** Non-triaged RFCs may not get timely review. PRs on non-triaged issues might not be accepted.
Guía de contribución
Línea de trabajo
Empieza leyendo docs/design/WORKFLOWS.md y el modelo de checkpoints workflow_state.json; después, sigue los comandos CLI y la ruta create-task del orquestador mencionados en la propuesta. Compara el diseño con ADR-014 y los issues relacionados #252, #484 y #560; se consideraría terminado cuando exista un diseño acordado que cubra los metadatos de los checkpoints, la genealogía de rewind/fork, la gestión de sesiones, la idempotencia y los límites de admisión.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- aws, git, typescript
- Área
- backend, cli, distributed-systems
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100