aws-samples / aws-samples/sample-autonomous-cloud-coding-agents

agent: Add Workflow-Id and Workflow-Step git commit trailers

Aperta
#560 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
agent-runtime enhancement observability
Lingua principale
TypeScript
Stelle
143
Fork
46
Merge medio
3g 9h
PR unite (30g)
20

Descrizione

## Component

Agent (Python runtime)

## Describe the feature

Extend the agent's `prepare-commit-msg` hook so commits carry **workflow attribution trailers** in addition to the existing `Task-Id` and `Prompt-Version` trailers.

| Trailer | Example | Purpose |
|---------|---------|---------|
| `Workflow-Id` | `coding/new-task-v1` | Which workflow executed |
| `Workflow-Step` | `implement` | Active step name when the commit was created |

Document the full trailer set in `agent/README.md` and `docs/design/OBSERVABILITY.md`.

## Use case

`Task-Id` and `Prompt-Version` link commits to a task and prompt hash, but not to **where in the workflow** the commit occurred. When a task fails at `verify_build` after multiple agent commits, reviewers cannot tell from `git log` alone which step produced which diff. Attribution and postmortems require cross-referencing TaskEvents or CloudWatch logs.

## Proposed solution

1. Set `WORKFLOW_ID` and `WORKFLOW_STEP` in the step runner at each step boundary (`agent/src/workflow/runner.py`); set before agent execution and safety-net commits.
2. Extend `agent/prepare-commit-msg.sh` to append trailers when set (idempotent, same pattern as `Task-Id`).
3. Ensure `pipeline.py` post-hook commits run through the hook or set trailers explicitly.
4. Tests: unit test hook output; integration test that a workflow run produces expected trailers on at least one commit.

## Other information

- Builds on existing `agent/prepare-commit-msg.sh`.
- Related: #245 (broader attribution), [WORKFLOWS.md](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/blob/main/docs/design/WORKFLOWS.md).

## Acknowledgements

- [ ] I may be able to implement this feature
- [ ] This might be a breaking change

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da agent/src/workflow/runner.py, agent/prepare-commit-msg.sh e pipeline.py per tracciare i confini dei passaggi, i commit dell’agente e i commit post-hook. Esamina quindi la gestione esistente di Task-Id e Prompt-Version e aggiungi la copertura con test unitari e di integrazione per i trailer richiesti. Il lavoro è completo quando i commit del workflow riportano l’attribuzione prevista e l’insieme completo dei trailer è documentato in agent/README.md e docs/design/OBSERVABILITY.md.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, python, shell
Ambito
backend, documentation, observability, testing
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.