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

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

Offen
#560 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
agent-runtime enhancement observability
Vorherrschende Sprache
TypeScript
Sterne
143
Forks
46
Ø Merge
3 T. 10 Std.
Gemergte PRs (30 T.)
24

Beschreibung

## 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit agent/src/workflow/runner.py, agent/prepare-commit-msg.sh und pipeline.py, um Schrittgrenzen, Agent-Commits und Post-Hook-Commits nachzuverfolgen. Untersuchen Sie anschließend die bestehende Verarbeitung von Task-Id und Prompt-Version und fügen Sie Unit- und Integrationstests für die angeforderten Trailer hinzu. Als abgeschlossen gilt die Aufgabe, wenn Workflow-Commits die erwartete Attribution enthalten und der vollständige Trailer-Satz in agent/README.md und docs/design/OBSERVABILITY.md dokumentiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
git, python, shell
Bereich
backend, documentation, observability, testing
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.