Skip to content

ADR-402: add user-approve-posts skill and work-with-pr post-comment operation - #190

Draft
jodavis-claude wants to merge 2 commits into
feature/ADR-398-posting-reviewfrom
dev/claude/ADR-402
Draft

ADR-402: add user-approve-posts skill and work-with-pr post-comment operation#190
jodavis-claude wants to merge 2 commits into
feature/ADR-398-posting-reviewfrom
dev/claude/ADR-402

Conversation

@jodavis-claude

Copy link
Copy Markdown
Collaborator

Work item: ADR-402 — Add a user-approve-posts skill that owns the full batch approve/edit/discuss/reject/attribute/dispatch/cleanup flow for a list of proposed posts, and add a "post-comment" operation to work-with-pr so a plain status comment can be posted to a PR.

Changes:

  • plugins/dev-team/skills/work-with-pr/SKILL.md — new ## Posting a plain comment / ### post-comment operation: given a PR URL and body text, calls message-attribution first, then mcp__plugin_github_github__add_issue_comment (PR number treated as issue number), falling back to gh pr comment <pullNumber> --repo <owner>/<repo> --body "<text>". Reuses the existing "Extracting PR details from a URL" logic; existing structured-review, thread-reply, and hand-off-operations mechanics are unmodified.
  • plugins/dev-team/skills/user-approve-posts/SKILL.md — new skill implementing user_approve_posts(posts: list[PostEntry]) -> {"posted": int, "rejected": int}. Resolves <user-name> once per call (Jira atlassianUserInfogh api user --jq .logingit-repo.user-alias). First pass batches entries through AskUserQuestion (up to 4 at a time, four options: Approve as-is / Edit and approve / Discuss this / Reject). "Edit and approve" re-reads file_path when set, or creates a fresh temp file under ~/.dev-team/<repo-slug>/user-approve-posts-tmp/ when unset. "Discuss this" entries are deferred to a one-at-a-time open-ended second pass modeled on document-discussion. Every approved entry gets the fixed "Written by Claude Code and reviewed by <user-name> before posting." line appended and is dispatched by channel to work-with-Jira-tasks, work-with-GitHub-issues, or work-with-pr's new post-comment operation. Each entry's file is deleted the instant it resolves (posted or rejected).

Design decisions:

  • post-comment was placed as its own new ## Posting a plain comment top-level section (with a ### post-comment heading) rather than as a fourth entry inside ## Hand-off operations, to avoid invalidating that section's "these three operations" framing sentence — a smaller, more conservative diff.
  • <user-name> resolution tries Jira atlassianUserInfo, then gh api user --jq .login, then falls back to git-repo.user-alias, rather than branching on project type — a simpler strictly-fallback reading of the spec.
  • gh api user is documented inline in user-approve-posts rather than as a new work-with-GitHub-issues operation, since that extension is outside ADR-402's Component Breakdown.
  • <repo-slug> and the temp-dir root are computed via a python3 -c one-liner reaching get_repo_slug() in workflow-orchestrate/scripts/get_context_path.py, matching the existing relative-import convention used elsewhere in the repo; both env-var overrides (GIT_REMOTE_URL_OVERRIDE, DEV_TEAM_STATE_DIR) were manually smoke-tested.
  • No automated test harness was invented: both components are agent-skill prose (no Python), and this repo has no established test harness for prose-only skills. Verified via self-review against the exit criteria instead, per missing-test-harness.

Testing completed:

  • Self-review of both SKILL.md files against the task brief's exit criteria (Wrapper-tier post-comment verified by visual inspection; Orchestrator-tier user-approve-posts verified the same way, consistent with other prose-only orchestrator skills in this repo).
  • Manual smoke test of the <repo-slug> and temp-dir python3 -c one-liners against GIT_REMOTE_URL_OVERRIDE and DEV_TEAM_STATE_DIR overrides, confirming correct output.

…s comments

Adds a new bare, mechanical operation to work-with-pr for posting a plain, freestanding status comment to a PR, reusing the same add_issue_comment tool (and gh CLI fallback) work-with-github-issues already documents for plain issue comments, since GitHub treats a PR number as an issue number. Calls message-attribution first, matching the existing "Posting a review" and thread-reply operations. This is the sole dependency user-approve-posts (ADR-402, next commit) needs for its pr-comment dispatch channel.
New Orchestrator skill that owns the full approve/edit/discuss/reject/attribute/dispatch/cleanup flow for a list of proposed posts (PostEntry: content, channel, target, file_path). First pass batches entries through AskUserQuestion (up to 4 at a time, four options each); deferred "Discuss this" entries are revisited one at a time as an open-ended conversation in a second pass, following document-discussion's precedent. Dispatches approved entries to work-with-Jira-tasks / work-with-github-issues / work-with-pr's new post-comment operation by channel, appending the fixed reviewed-by attribution line, and deletes each entry's file (caller-supplied or self-created temp file) the moment it resolves. Resolves <user-name> once per call via Jira's atlassianUserInfo, falling back to gh api user, falling back to git-repo.user-alias. Computes <repo-slug> and the user-approve-posts-tmp temp directory via a python3 -c one-liner reaching get_repo_slug() in workflow-orchestrate/scripts, matching the existing relative-import convention and honoring the DEV_TEAM_STATE_DIR/GIT_REMOTE_URL_OVERRIDE test seams (smoke-tested manually). No automated test harness exists for prose-only agent skills in this repo (missing-test-harness); verified by self-review against the exit criteria instead, per the task brief's explicit guidance.
@github-actions

Copy link
Copy Markdown

build-and-test: Python test results

Status: ✅ Passed

Test log

@jodavis-claude jodavis-claude left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed ADR-402: work-with-pr's new post-comment operation, and the new user-approve-posts skill. All exit criteria from the task brief are satisfied at the prose level (PostEntry shape, user-name resolution order, AskUserQuestion batching, file-based edit flow, two-pass discuss handling, reviewed-by attribution appended as its own line, dispatch table for all four channels, and final posted/rejected counts). Cross-checked against the ADR-400 queue_post.py CHANNELS/target naming, work-with-Jira-tasks/work-with-GitHub-issues operation names, message-attribution's composition rule, and the sibling-skill relative-path convention used elsewhere in this repo (dev-spec-create-work-items) -- all consistent.

One correctness/fault-tolerance gap found and flagged inline: the cleanup step doesn't distinguish a successful dispatch from a failed one, so a dispatch error could silently delete an entry's only remaining copy with no way to retry. Requesting that be addressed before sign-off.

No test harness exists for prose-only skills in this repo (confirmed via missing-test-harness), so self-review against the exit criteria is the right verification approach here, consistent with the taxonomy for Wrapper/Orchestrator components.


Whether the entry was approved and dispatched, or rejected and discarded, delete whatever file
it was using — its caller-supplied `file_path`, or a temp file this skill created in step 2 —
the moment the entry resolves. Do not batch deletions until the end.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Priority 2 (correctness / fault tolerance): this cleanup step doesn't distinguish a successful dispatch from a failed one. If the downstream posting call errors partway through (auth failure, rate limit, network blip), the entry's file -- often the only remaining copy of that content -- still gets deleted per the literal wording ("delete ... the moment the entry resolves"), silently losing the post with no way to retry.

Suggest adding explicit failure handling: on a dispatch error, keep the file, surface the error to the user, and don't count that entry toward the final counts -- leave it available to retry instead of deleting it. The Step 5 return value should also clarify that its count reflects successful posts, not merely attempted ones.

@jodavis-claude

Copy link
Copy Markdown
Collaborator Author

Review Summary

Outcome: Changes requested

Issue found (Priority 2 — Correctness):
The cleanup logic in user-approve-posts doesn't distinguish between successful and failed dispatches. If a downstream post fails (auth, rate limit, network error), the file still gets deleted, silently losing the content with no retry path.

Recommended fix: Keep the file on dispatch error, surface the error to the user, and leave entries available for retry. The return value should clarify it counts successful posts, not attempted dispatches.

Everything else: Clean. All other components verified correctly:

  • work-with-pr's new post-comment operation
  • user_approve_posts shape, resolution order, and integration points
  • Two-pass "Discuss this" handling and reviewed-by attribution line
  • Relative-path convention for reaching helper scripts matches existing precedents

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.

2 participants