Skip to content

feat(agents): claude agents and commands for git operations, QA test coverage, and bug-fix pipeline#636

Open
bhabalan wants to merge 4 commits intowebex:nextfrom
bhabalan:claude-config
Open

feat(agents): claude agents and commands for git operations, QA test coverage, and bug-fix pipeline#636
bhabalan wants to merge 4 commits intowebex:nextfrom
bhabalan:claude-config

Conversation

@bhabalan
Copy link
Copy Markdown
Contributor

@bhabalan bhabalan commented Mar 2, 2026

COMPLETES #N/A (internal tooling)

This pull request addresses

Setting up Claude Code autonomous agents and slash commands for the widgets monorepo, enabling AI-assisted git operations, QA test coverage, and a three-stage bug-fix pipeline (scrub → triage → fix).

by making the following changes

Agents (.claude/agents/)

  • fixer.md — Implements bug fixes in isolated worktrees using systematic debugging and TDD
  • scrubber.md — Evaluates bug tickets for completeness and AI-readiness, classifies as prioritize/followup/dolater
  • triager.md — Deep-dives into prioritized bugs, performs root cause analysis, and proposes fix plans
  • git-pr.md — Updated agent for git PR operations
  • ticket-worker.md — Updated agent for ticket processing workflows
  • qa-test-coverage.md — Agent for QA test coverage analysis

Commands (.claude/commands/)

  • fix.md — Implements triaged bug fixes, creates worktree, runs tests, commits, pushes, and creates draft PR
  • scrub.md — Runs the scrubber agent on bug tickets to classify readiness
  • triage.md — Runs the triager agent to root-cause prioritized bugs
  • fix-tickets.md — Updated orchestrator for the full bug-fix pipeline
  • submit-pr.md — Command for submitting PRs with FedRAMP-compliant templates
  • cleanup-worktrees.md — Command to clean up stale git worktrees

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

  • Verified agents and commands load correctly in Claude Code
  • Tested scrub/triage/fix pipeline end-to-end on sample tickets
  • Verified worktree creation and cleanup workflows

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Claude Code (Anthropic)
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the testing document
  • I have tested the functionality with amplify link

Make sure to have followed the contributing guidelines before submitting.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65a922672e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


**Remove:**
```bash
git worktree remove /tmp/claude-widgets/{TICKET_ID}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use --force after confirming dirty worktree removal

This workflow asks for extra confirmation when a worktree has uncommitted changes, but the removal command is still git worktree remove /tmp/claude-widgets/{TICKET_ID} without -f; Git's own usage is git worktree remove [-f] <worktree>, so dirty worktrees will not be removed even after the user confirms and cleanup will silently fail for the main warned-about case.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d741fcf — added --force flag to git worktree remove after user confirmation.


# Persistent Agent Memory

You have a persistent Persistent Agent Memory directory at `/Users/bhabalan/dev/widgets/.claude/agent-memory/qa-test-coverage/`. Its contents persist across conversations.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Replace machine-specific memory path with workspace path

The persistent memory directory is hardcoded to /Users/bhabalan/dev/widgets/.claude/agent-memory/qa-test-coverage/, which is specific to one local machine and will not exist in other developer or CI environments; this breaks the instructed memory read/write behavior and undermines the agent's cross-session state for most users.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0e24318 — replaced hardcoded /Users/bhabalan/dev/widgets/ path with workspace-relative .claude/agent-memory/qa-test-coverage/.

@aws-amplify-us-east-2
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-636.d1b38q61t1z947.amplifyapp.com

@bhabalan bhabalan requested a review from a team as a code owner March 24, 2026 04:09
@bhabalan bhabalan changed the title feat(agents): claude agents for git operations, QA test coverage, ticket handling feat(agents): claude agents and commands for git operations, QA test coverage, and bug-fix pipeline Mar 24, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c75cbdff86

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +40 to +44
gh pr list --head {TICKET_ID} --repo webex/widgets --json number,title,state,reviews,reviewRequests
```

- **If PR exists and is open:** Enter review-polling mode (Step 7)
- **If PR exists and is merged:** Skip ticket, inform user it's already done
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include merged PRs when checking existing ticket branches

gh pr list defaults to open PRs (--state default is open), so this check cannot identify already-merged ticket PRs even though the next step branches on that outcome. In practice, merged tickets will be treated as “no PR” and can be reprocessed unnecessarily, including redundant worktree creation and attempted new implementation; add --state all (or an explicit merged query) before making the open/merged/no-PR decision.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d741fcf — added --state all to gh pr list so merged PRs are detected and skipped.

Comment on lines +247 to +248
cd /tmp/claude-widgets/{TICKET_ID}
gh pr view {PR_NUMBER} --json reviews,reviewRequests,state
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove hard dependency on local worktree for review polling

Step 2 sends tickets with an existing open PR straight to review polling, but this step starts by cd-ing into /tmp/claude-widgets/{TICKET_ID} before querying GitHub. If that worktree was already cleaned up, polling fails immediately and the command cannot inspect reviews for the PR it just detected; make polling independent of local worktree existence or recreate/validate the worktree first.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d741fcf — removed the cd into the worktree for the initial PR status check (not needed for gh pr view), and added a worktree existence check before the "changes requested" section where local files are actually needed.

git status

# Verify tests pass before proceeding
yarn workspace @webex/{SCOPE} test:unit
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve scope before running workspace unit tests

The agent marks SCOPE as optional, but this verification step immediately runs yarn workspace @webex/{SCOPE} test:unit before the later metadata-derivation step can infer a missing scope. When SCOPE is not passed by the caller, test verification fails on an invalid workspace target and the workflow aborts prematurely; derive/detect scope first (or use a fallback test command).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d741fcf — reordered the workflow so SCOPE is derived from ticket info and diff (Step 1) before tests are run (Step 2).

- Add --force flag to worktree removal after user confirmation
- Add --state all to gh pr list to detect merged PRs
- Remove unnecessary cd into worktree for review polling
- Add worktree existence check before addressing review feedback
- Reorder git-pr agent to derive SCOPE before running tests
@bhabalan bhabalan self-assigned this Mar 26, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e2431826b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

**If worktree already exists:**
- Use `AskUserQuestion`: "Worktree for {TICKET_ID} already exists. Reuse or recreate?"
- **Reuse**: use existing worktree
- **Recreate**: `git worktree remove /tmp/claude-widgets/{TICKET_ID} && git branch -D {TICKET_ID}` then create fresh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use --force when recreating an existing worktree

The recreate path asks users to replace an existing worktree, but it runs git worktree remove /tmp/claude-widgets/{TICKET_ID} without --force; per git worktree remove [-f] <worktree>, removal fails when that worktree is dirty or locked, so the command cannot complete the user-selected “recreate” flow in the most common stale-worktree scenario.

Useful? React with 👍 / 👎.

**If worktree already exists at that path:**
- Use `AskUserQuestion` to ask: "Worktree for {TICKET_ID} already exists. Reuse existing worktree, or recreate it?"
- **Reuse**: skip creation, use existing worktree as-is
- **Recreate**: `git worktree remove /tmp/claude-widgets/{TICKET_ID} && git branch -D {TICKET_ID}` then create fresh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Force-remove dirty worktrees in /fix-tickets recreate flow

This recreate command has the same failure mode as above: git worktree remove is used without --force, so any uncommitted changes in /tmp/claude-widgets/{TICKET_ID} will block removal and prevent recreation; Git’s help explicitly documents -f as required for dirty/locked worktrees.

Useful? React with 👍 / 👎.

Comment on lines +19 to +23
test -d /tmp/claude-widgets/{TICKET_ID} || echo "NOT_FOUND"

# Check for staged changes
cd /tmp/claude-widgets/{TICKET_ID}
git diff --cached --stat
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Abort submit flow when worktree path is missing

The validation step only echoes NOT_FOUND but then immediately runs cd /tmp/claude-widgets/{TICKET_ID} and git diff --cached --stat; in shell execution without set -e, a failed cd does not stop subsequent commands, so later git operations can run in the wrong repository and potentially commit/push unrelated staged changes. Add an explicit early exit/return after the missing-path check and guard cd with failure handling.

Useful? React with 👍 / 👎.

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.

1 participant