Skip to content

Always include the github url in the Discord notification (#6) - #7

Draft
ableinc wants to merge 1 commit into
mainfrom
agent/issue-6-always-include-the-github-url-in-the-dis
Draft

Always include the github url in the Discord notification (#6)#7
ableinc wants to merge 1 commit into
mainfrom
agent/issue-6-always-include-the-github-url-in-the-dis

Conversation

@ableinc

@ableinc ableinc commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Closes #6

What the agent did

All changes are staged and ready for the harness to commit.

Summary

Implemented the approved plan for issue #6 — every run-scoped Discord notification now carries a clickable GitHub link.

internal/discord/notifier.go

  • Added URL to the embed struct (Discord renders it as the title link).
  • Added RunRef.issueURL() (uses r.URL, or derives https://github.com/<repo>/issues/<n>) and RunRef.describe(body) (prepends the linked issue description to a cause/reason message without losing it).
  • Added a postRun choke point that appends an Issue field and sets the title link, and routed every run-scoped method (RunClaimed, ClaudeFinished, VerifyResult, PROpened, PlanPosted, RunFailed, RunAbandoned, RunDeferred, RunCanceled, LabelUpdateFailed) through it.
  • PROpened now links the PR in the title while still surfacing the issue link via the Issue field and a new Pull request field.
  • RunCanceled(runID string)RunCanceled(r RunRef); falls back to a plain title (no #0) when r.Repo is empty.
  • LabelUpdateFailed(repo, issue, runID, ...)LabelUpdateFailed(r RunRef, ...), dropping the hand-rolled Run ID field in favor of r.fields().

internal/orchestrator/loop.go

  • setLabels now takes a discord.RunRef instead of (cand, runID); all six call sites updated, with handleFailure computing ref once at the top and reusing it for its three Discord.Run* calls.

internal/server/server.go

  • cancelRun looks up the run via s.store.GetRun before notifying, building a full RunRef on success or falling back to RunRef{RunID: id} on failure (never affects the HTTP response).

Tests (internal/discord/notifier_test.go, internal/server/server_test.go) — added a table test asserting every run-scoped method links the issue, plus targeted tests for URL derivation, the degenerate RunCanceled case, PROpened's dual links, RunFailed's description, and a cancel-with-no-store-row case; updated TestLabelUpdateFailedNamesTheLabels for the new signature.

README.md — updated the Discord notifications section to describe the linked titles/Issue field.

go build ./... and go test ./... both pass. Nothing deviated from the approved plan. One environment note for the reviewer: this worktree has no git user identity configured, so I could not run git commit myself (and per policy I won't touch git config) — all changes are staged for the harness to commit.

Verification

Tests failed (make test). This PR is a draft — the failure is reported rather than hidden, so you can judge whether the change is salvageable.

Test output (tail)
go test -race ./...
make: go: No such file or directory
make: *** [Makefile:99: test] Error 127

Changes

README.md                         |  13 ++--
 internal/discord/notifier.go      | 111 ++++++++++++++++++++++++----------
 internal/discord/notifier_test.go | 123 +++++++++++++++++++++++++++++++++++++-
 internal/orchestrator/loop.go     |  29 ++++-----
 internal/server/server.go         |   8 ++-
 internal/server/server_test.go    |  16 +++++
 6 files changed, 249 insertions(+), 51 deletions(-)

Opened automatically by coding-agent-loop (run 66b42c34-42d5-452c-8f45-10f512c2bf7c, attempt 2, model claude-sonnet-5, cost $1.4509, session d0fa187e-c8e7-4d4c-9111-3be4a58a6b7c). Nothing here has been reviewed by a human yet.

Closes #6

Generated by coding-agent-loop run 66b42c34-42d5-452c-8f45-10f512c2bf7c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Always include the github url in the Discord notification

1 participant