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

feat(github): post final status comments with cost, turns, and duration

Open
#583 0 comments 0 reactions 0 assignees View on GitHub
adapters cost-finops enhancement
Dominant language
TypeScript
Stars
143
Forks
46
Avg merge
3d 9h
Merged PRs (30d)
20

Description

## Component

CDK fanout, GitHub adapter

## Describe the feature

GitHub issue-origin tasks should receive a deterministic final status comment with outcome, cost, turns, duration, task id, and PR link when relevant, matching Linear and the Jira parity issue.

The existing GitHub fanout machinery edits GitHub issue comments for task progress in other contexts, but the GitHub Issues channel needs the terminal status to land on the originating GitHub issue.

## Use case

A user who triggers ABCA from a GitHub issue should be able to see whether the task completed, failed, timed out, or shipped a PR but stopped early without switching to the CLI or logs.

## Proposed solution

Extend fanout for `channel_source: "github"` tasks created from GitHub Issues:

- Read GitHub issue metadata from task `channel_metadata`.
- Render the same outcome framing used for Linear/Jira final status comments.
- Include cost, turns/max-turns, duration, task id, and PR URL when needed.
- Post or edit a GitHub issue comment using the existing GitHub comment helper and token path.
- Persist an idempotency marker/comment id so stream retries do not create duplicate terminal comments.
- Keep progress comments and terminal fanout responsibilities clearly separated.

## Acceptance criteria

- GitHub issue-origin terminal tasks receive one final status comment with cost, turns, duration, and task id.
- A task that opens a PR but fails/stops later includes both the PR link and the stop reason.
- Agent crashes before agent-side completion still produce the platform-side final status comment.
- Retryable GitHub API failures trigger fanout retry; terminal auth/config failures are logged.
- Non-GitHub tasks are unaffected.

## Tests

- Fanout tests cover GitHub success, failure, PR-but-stopped, missing metadata, non-GitHub skip, idempotent retry, and retryable post failure.
- GitHub comment helper tests cover final status rendering if needed.
- Docs mention cost/turn/duration final comments in the GitHub Issues setup guide.

## Out of scope

- GitHub Projects status automation.
- Live streaming progress.
- PR review comments.
- Cost rollups across parent/sub-issues.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing CDK fanout machinery, GitHub comment helper, and Linear/Jira final-status implementation; then run the fanout tests. Done means GitHub issue-origin tasks get one idempotent terminal comment covering outcome, cost, turns, duration, task id, and relevant PR or stop reason, while retries and non-GitHub tasks follow the stated behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, github, typescript
Domain
backend, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.