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 7 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 7 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). Includes a CLAUDE.md project instructions file and superpowers skill integration across all workflows.

by making the following changes

CLAUDE.md (new)

  • Project-level instructions for Claude Code (129 lines)
  • Covers architecture, build/test, git conventions, slash commands, subagent constraints, coding standards
  • Superpowers skills reference table mapping 10 skills to their invocation points

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. Integrates 7 superpowers skills.
  • scrub.md — Runs the scrubber agent on bug tickets to classify readiness. Integrates dispatching-parallel-agents skill.
  • triage.md — Runs the triager agent to root-cause prioritized bugs. Integrates dispatching-parallel-agents + systematic-debugging skills.
  • fix-tickets.md — Updated orchestrator for the full bug-fix pipeline with full skills integration
  • submit-pr.md — Command for submitting PRs with FedRAMP-compliant templates. Integrates verification-before-completion + requesting-code-review skills.
  • cleanup-worktrees.md — Command to clean up stale git worktrees

Workflow Diagrams

1. Architecture Overview — Commands, Agents, Skills, and External Systems

graph TB
    subgraph Commands["Slash Commands (User-Invoked)"]
        scrub["/scrub"]
        triage["/triage"]
        fix["/fix"]
        fixtickets["/fix-tickets"]
        submitpr["/submit-pr"]
        cleanup["/cleanup-worktrees"]
    end

    subgraph Skills["Superpowers Skills (Invoked by Commands)"]
        sk_parallel["dispatching-parallel-agents"]
        sk_worktree["using-git-worktrees"]
        sk_debug["systematic-debugging"]
        sk_tdd["test-driven-development"]
        sk_verify["verification-before-completion"]
        sk_review_req["requesting-code-review"]
        sk_review_recv["receiving-code-review"]
        sk_finish["finishing-a-development-branch"]
    end

    subgraph Agents["Subagents (Spawned by Commands)"]
        scrubber["scrubber<br/><i>haiku model</i>"]
        triager["triager<br/><i>sonnet model</i>"]
        fixer["fixer<br/><i>sonnet model</i>"]
        ticketworker["ticket-worker<br/><i>sonnet model</i>"]
        gitpr["git-pr<br/><i>sonnet model</i>"]
        qa["qa-test-coverage<br/><i>sonnet model</i>"]
    end

    subgraph External["External Systems"]
        jira["Jira (MCP)"]
        gh["GitHub CLI"]
        worktree["Git Worktrees<br/>/tmp/claude-widgets/"]
    end

    scrub -.-> sk_parallel
    triage -.-> sk_parallel
    triage -.-> sk_debug
    fix -.-> sk_parallel
    fix -.-> sk_worktree
    fix -.-> sk_verify
    fix -.-> sk_review_recv
    fix -.-> sk_finish
    fixtickets -.-> sk_parallel
    fixtickets -.-> sk_worktree
    fixtickets -.-> sk_verify
    fixtickets -.-> sk_finish
    submitpr -.-> sk_verify
    submitpr -.-> sk_review_req

    scrub --> scrubber
    triage --> triager
    fix --> fixer
    fixtickets --> ticketworker
    fixtickets -.-> gitpr

    scrub --> jira
    triage --> jira
    fix --> jira
    fix --> gh
    fix --> worktree
    fixtickets --> jira
    fixtickets --> gh
    fixtickets --> worktree
    submitpr --> gh
    submitpr --> jira
    submitpr --> worktree
    cleanup --> worktree

    scrubber -.->|"no MCP access"| jira
    triager -.->|"no MCP access"| jira
    fixer -.->|"no MCP access"| jira

    style scrubber fill:#ffd700,stroke:#333
    style triager fill:#00bcd4,stroke:#333
    style fixer fill:#4caf50,stroke:#333
    style ticketworker fill:#2196f3,stroke:#333
    style gitpr fill:#ff9800,stroke:#333
    style qa fill:#4caf50,stroke:#333
    style sk_parallel fill:#e1bee7,stroke:#7b1fa2
    style sk_worktree fill:#e1bee7,stroke:#7b1fa2
    style sk_debug fill:#e1bee7,stroke:#7b1fa2
    style sk_tdd fill:#e1bee7,stroke:#7b1fa2
    style sk_verify fill:#e1bee7,stroke:#7b1fa2
    style sk_review_req fill:#e1bee7,stroke:#7b1fa2
    style sk_review_recv fill:#e1bee7,stroke:#7b1fa2
    style sk_finish fill:#e1bee7,stroke:#7b1fa2
Loading

2. Bug-Fix Pipeline — Three-Stage Flow with Skills

flowchart LR
    subgraph Stage1["Stage 1: /scrub"]
        s0["Skill: dispatching-<br/>parallel-agents"]
        s1["Query Jira<br/>for open bugs"]
        s2["Spawn parallel<br/>scrubber agents<br/><i>(haiku)</i>"]
        s3{"Classification"}
        s3a["prioritize<br/>AI-fixable"]
        s3b["followup<br/>needs info"]
        s3c["dolater<br/>needs human"]
        s4["Post Jira<br/>comment + labels"]
    end

    subgraph Stage2["Stage 2: /triage"]
        t0a["Skill: dispatching-<br/>parallel-agents"]
        t0b["Skill: systematic-<br/>debugging"]
        t1["Query Jira for<br/>prioritize bugs"]
        t2["Spawn parallel<br/>triager agents<br/><i>(sonnet)</i>"]
        t3["Read project docs<br/>& locate code"]
        t4["Root cause<br/>analysis"]
        t5["Post fix suggestion<br/>as Jira comment"]
    end

    subgraph Stage3["Stage 3: /fix"]
        f0a["Skill: using-<br/>git-worktrees"]
        f0b["Skill: dispatching-<br/>parallel-agents"]
        f0c["Skill: verification-<br/>before-completion"]
        f1["Query Jira for<br/>triaged bugs"]
        f2["Create worktrees<br/>& install deps"]
        f3["Spawn parallel<br/>fixer agents<br/><i>(sonnet)</i>"]
        f4["TDD: write test<br/>→ implement fix<br/>→ verify"]
        f5["Commit, push,<br/>create draft PR"]
        f6["Post PR link<br/>on Jira"]
    end

    s1 --> s0 --> s2 --> s3
    s3 --> s3a & s3b & s3c
    s3a & s3b & s3c --> s4

    s3a -.->|"Jira label:<br/>prioritize"| t1

    t1 --> t0a --> t2 --> t3 --> t4 --> t5
    t0b -.-> t2

    t5 -.->|"Jira label:<br/>triaged"| f1

    f1 --> f0a --> f2 --> f0b --> f3 --> f4 --> f0c --> f5 --> f6

    style Stage1 fill:#fff8e1,stroke:#f9a825
    style Stage2 fill:#e0f7fa,stroke:#00838f
    style Stage3 fill:#e8f5e9,stroke:#2e7d32
    style s0 fill:#e1bee7,stroke:#7b1fa2
    style t0a fill:#e1bee7,stroke:#7b1fa2
    style t0b fill:#e1bee7,stroke:#7b1fa2
    style f0a fill:#e1bee7,stroke:#7b1fa2
    style f0b fill:#e1bee7,stroke:#7b1fa2
    style f0c fill:#e1bee7,stroke:#7b1fa2
Loading

3. Subagent Orchestration Pattern with Skills

sequenceDiagram
    participant User
    participant Skills as Superpowers Skills
    participant Main as Main Conversation<br/>(has MCP + gh CLI)
    participant Jira as Jira (MCP)
    participant Sub as Subagent(s)<br/>(no MCP access)
    participant WT as Git Worktree

    User->>Main: /fix CAI-1234
    Main->>Jira: Fetch ticket details<br/>(summary, description, comments)
    Jira-->>Main: Ticket data + Triager notes

    Main->>Skills: Invoke using-git-worktrees
    Skills-->>Main: Worktree safety patterns
    Main->>WT: git worktree add<br/>/tmp/claude-widgets/CAI-1234
    Main->>WT: yarn install && yarn build:dev

    Main->>Skills: Invoke dispatching-parallel-agents
    Skills-->>Main: Parallel orchestration pattern

    Note over Main,Sub: Ticket data passed as text in prompt<br/>(subagents cannot call Jira)

    Main->>Sub: Agent(fixer, prompt=ticket+triager data)
    activate Sub
    Sub->>WT: Read code, write tests (TDD)
    Sub->>WT: Implement fix (systematic-debugging)
    Sub->>WT: Run tests (yarn test:unit)
    Sub->>WT: git add (stage only)
    Sub-->>Main: Result JSON<br/>{status, files, tests}
    deactivate Sub

    Main->>Skills: Invoke verification-before-completion
    Skills-->>Main: Verification checklist
    Main->>WT: Verify: git diff --cached
    Main->>WT: Verify: re-run tests
    Main->>WT: git commit + git push
    Main->>Main: gh pr create --draft
    Main->>Jira: Post PR link as comment
    Main->>Jira: Add label: fixing

    Main->>Skills: Invoke finishing-a-development-branch
    Skills-->>Main: Completion guidance
    Main-->>User: PR #NNN created
Loading

4. /fix-tickets Full Lifecycle with Skills Integration

flowchart TD
    start(["/fix-tickets CAI-1234"]) --> resolve

    subgraph resolve["Step 1-2: Resolve Tickets"]
        r1["Fetch from Jira<br/>(MCP)"] --> r2{"Multiple<br/>tickets?"}
        r2 -->|"yes"| r3["User selects<br/>(AskUserQuestion)"]
        r2 -->|"no"| r4["Proceed with ticket"]
    end

    resolve --> wt

    subgraph wt["Step 3: Create Worktrees"]
        direction LR
        skill1["Skill: using-git-worktrees"]
        w1["git worktree add<br/>/tmp/claude-widgets/{ID}"]
        skill1 --> w1
    end

    wt --> deps

    subgraph deps["Step 4: Install & Build"]
        d1["corepack enable"]
        d2["yarn install"]
        d3["yarn build:dev"]
        d1 --> d2 --> d3
    end

    deps --> fetch["Step 5: Fetch ticket details<br/>+ Triager notes from Jira"]

    fetch --> spawn

    subgraph spawn["Step 6: Spawn Workers"]
        skill2["Skill: dispatching-parallel-agents"]
        skill2 --> agents
        subgraph agents["Parallel ticket-worker agents (sonnet)"]
            direction LR
            tw1["ticket-worker<br/>CAI-1234"]
            tw2["ticket-worker<br/>CAI-5678"]
            tw3["ticket-worker<br/>CAI-9012"]
        end
    end

    spawn --> verify

    subgraph verify["Step 7: Verify Results"]
        skill3["Skill: verification-before-completion"]
        v1["git diff --cached --stat"]
        v2["Re-run tests"]
        skill3 --> v1 --> v2
    end

    verify --> pr

    subgraph pr["Step 8: Create PRs"]
        skill4["Skill: commit-push-pr"]
        skill5["Skill: code-review"]
        p1["git commit"] --> p2["git push"]
        p2 --> p3["gh pr create --draft"]
        p3 --> p4["Post PR link on Jira"]
        skill4 --> p1
        skill5 --> p3
    end

    pr --> review

    subgraph review["Step 9: Review Polling"]
        skill6["Skill: loop (recurring)"]
        skill6b["Skill: receiving-code-review"]
        rv1{"PR Status?"}
        rv2["Address comments<br/>+ push fixes"]
        rv3["Confirm merge<br/>with user"]
        rv4["Waiting for<br/>reviews"]
        skill6 --> rv1
        rv1 -->|"changes requested"| skill6b --> rv2
        rv1 -->|"approved"| rv3
        rv1 -->|"no reviews"| rv4
    end

    review --> finish

    subgraph finish["Step 10: Completion"]
        skill7["Skill: finishing-a-development-branch"]
        fin1["Summary table"]
        fin2["Suggest cleanup"]
        skill7 --> fin1 --> fin2
    end

    style skill1 fill:#e1bee7,stroke:#7b1fa2
    style skill2 fill:#e1bee7,stroke:#7b1fa2
    style skill3 fill:#e1bee7,stroke:#7b1fa2
    style skill4 fill:#e1bee7,stroke:#7b1fa2
    style skill5 fill:#e1bee7,stroke:#7b1fa2
    style skill6 fill:#e1bee7,stroke:#7b1fa2
    style skill6b fill:#e1bee7,stroke:#7b1fa2
    style skill7 fill:#e1bee7,stroke:#7b1fa2
Loading

5. Ticket-Worker Agent Internal Flow (TDD Methodology)

flowchart TD
    start([ticket-worker receives<br/>ticket data in prompt]) --> parse

    parse["1. Parse ticket details<br/>& Triager's fix suggestion"] --> docs

    docs["2. Read project docs<br/>AGENTS.md, ARCHITECTURE.md,<br/>bug-fix patterns"] --> debug

    subgraph debug["3. Systematic Debugging"]
        db1["Trace code path<br/>that triggers bug"]
        db2["Form hypothesis<br/>on root cause"]
        db3["Verify against<br/>actual code"]
        db4{"Triager's analysis<br/>matches?"}
        db5["Follow Triager's plan"]
        db6["Document discrepancy,<br/>use own judgment"]
        db1 --> db2 --> db3 --> db4
        db4 -->|"yes"| db5
        db4 -->|"no"| db6
    end

    debug --> tdd

    subgraph tdd["4-5. TDD Cycle"]
        td1["Find existing test files"]
        td2["Write regression test<br/>that captures the bug"]
        td3["Run test — confirm FAIL"]
        td4["Implement minimal fix"]
        td5["Run test — confirm PASS"]
        td6{"All tests<br/>pass?"}
        td7["Fix regressions"]
        td1 --> td2 --> td3 --> td4 --> td5 --> td6
        td6 -->|"no"| td7 --> td5
        td6 -->|"yes"| stage
    end

    stage["6. git add (stage only,<br/>NO commit)"] --> result

    result["7. Return JSON result<br/>{status, files, tests,<br/>rootCause, triagerAccuracy}"]

    style debug fill:#fff3e0,stroke:#e65100
    style tdd fill:#e8f5e9,stroke:#2e7d32
Loading

6. Inter-Agent State Flow via Jira (with Skills)

flowchart LR
    subgraph scrub_cmd["/scrub Command"]
        sc["Main: fetch tickets"]
        sc_sk["Skill: dispatching-<br/>parallel-agents"]
        sa["Scrubber Agent<br/><i>(haiku)</i>"]
        sc --> sc_sk --> sa
    end

    sa -->|"Result JSON"| sc2["Main: post Jira comment"]

    sc2 -->|"Jira Comment:<br/><b>PRIORITIZE</b><br/>Layer: hook<br/>Pattern: missing cleanup"| jira[(Jira Ticket<br/>Labels: scrubbed,<br/>prioritize)]

    jira -->|"Read by /triage"| tc

    subgraph triage_cmd["/triage Command"]
        tc["Main: fetch tickets<br/>+ scrubber comments"]
        tc_sk["Skill: dispatching-<br/>parallel-agents"]
        ta["Triager Agent<br/><i>(sonnet)</i>"]
        tc --> tc_sk --> ta
    end

    ta -->|"Result JSON"| tc2["Main: post Jira comment"]

    tc2 -->|"Jira Comment:<br/><b>FIX SUGGESTION</b><br/>Root cause, files,<br/>test strategy"| jira2[(Jira Ticket<br/>Labels: scrubbed,<br/>prioritize, triaged)]

    jira2 -->|"Read by /fix"| fc

    subgraph fix_cmd["/fix Command"]
        fc["Main: fetch tickets<br/>+ triager comments"]
        fc_sk1["Skill: using-<br/>git-worktrees"]
        fc_sk2["Skill: dispatching-<br/>parallel-agents"]
        fa["Fixer Agent<br/><i>(sonnet)</i>"]
        fc_sk3["Skill: verification-<br/>before-completion"]
        fc --> fc_sk1 --> fc_sk2 --> fa
        fa --> fc_sk3
    end

    fc_sk3 -->|"Result JSON"| fc2["Main: commit,<br/>push, create PR"]

    fc2 -->|"Jira Comment:<br/>PR: github.com/.../#NNN"| jira3[(Jira Ticket<br/>Labels: scrubbed,<br/>prioritize, triaged,<br/>fixing)]

    style scrub_cmd fill:#fff8e1,stroke:#f9a825
    style triage_cmd fill:#e0f7fa,stroke:#00838f
    style fix_cmd fill:#e8f5e9,stroke:#2e7d32
    style sc_sk fill:#e1bee7,stroke:#7b1fa2
    style tc_sk fill:#e1bee7,stroke:#7b1fa2
    style fc_sk1 fill:#e1bee7,stroke:#7b1fa2
    style fc_sk2 fill:#e1bee7,stroke:#7b1fa2
    style fc_sk3 fill:#e1bee7,stroke:#7b1fa2
Loading

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".

Comment thread .claude/commands/cleanup-worktrees.md Outdated

**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.

Comment thread .claude/agents/qa-test-coverage.md Outdated

# 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 thread .claude/commands/fix.md Outdated
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 thread .claude/commands/fix.md Outdated
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.

Comment thread .claude/agents/git-pr.md Outdated
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".

Comment thread .claude/commands/fix.md
**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 👍 / 👎.

Concise 112-line reference covering architecture, build/test commands,
slash commands, subagent constraints, coding standards, and documentation
pointers. Points to AGENTS.md and ai-docs/ for deep dives.
… workflows

Add superpowers skill invocation points to /scrub, /triage, /fix, and
/submit-pr commands. Add skills reference table to CLAUDE.md covering
brainstorming, planning, TDD, debugging, verification, and code review.
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: 1b0c0a2acb

ℹ️ 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".

```bash
cd /tmp/claude-widgets/{TICKET_ID}
git diff --cached --stat # confirm files are staged
yarn workspace @webex/{pkg} test:unit # re-run tests to confirm they pass
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 Use canonical workspace names when re-running unit tests

The verification step runs yarn workspace @webex/{pkg} test:unit, but this workflow treats scope/package as values like task and store elsewhere; in this repo those workspaces are actually named @webex/cc-task and @webex/cc-store (see package manifests), so the command will fail for common tickets and block the “verified fix” path. Normalize {pkg} to the real workspace slug (or have workers return full workspace names) before invoking Yarn.

Useful? React with 👍 / 👎.

- **Recreate**: `git worktree remove /tmp/claude-widgets/{TICKET_ID} && git branch -D {TICKET_ID}` then create fresh

**If branch already exists but no worktree:**
- Delete the branch first: `git branch -D {TICKET_ID}` then create worktree
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 Avoid force-deleting ticket branches without confirmation

This step instructs an unconditional git branch -D {TICKET_ID} whenever a branch exists without a worktree, which can permanently drop unpushed local commits from prior work on that ticket. Because the command is meant to resume/continue ticket work, it should first inspect whether the branch is ahead/diverged and require explicit user confirmation (or reuse/recreate from the existing branch) instead of hard-deleting it by default.

Useful? React with 👍 / 👎.

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: f98c4b4ac1

ℹ️ 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 thread .claude/commands/fix.md
- **Recreate**: `git worktree remove /tmp/claude-widgets/{TICKET_ID} && git branch -D {TICKET_ID}` then create fresh

**If branch exists but no worktree:**
- Delete branch first: `git branch -D {TICKET_ID}` then create worktree
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 Require confirmation before deleting orphaned ticket branches

In Step 3, the branch exists but no worktree path unconditionally force-deletes the ticket branch with git branch -D {TICKET_ID}. If that branch still contains unmerged or unpushed local commits (a common stale-worktree scenario), /fix will permanently discard work before recreating from upstream/next; this is destructive behavior that should require an explicit user confirmation after showing branch divergence/ahead status.

Useful? React with 👍 / 👎.

Comment thread .claude/commands/fix.md
1. Ensure worktree exists (recreate if cleaned up):
```bash
if [ ! -d /tmp/claude-widgets/{TICKET_ID} ]; then
git worktree add /tmp/claude-widgets/{TICKET_ID} {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 Recreate review worktrees from remote when local branch is absent

When an open PR has changes requested and the worktree was cleaned up, this recovery path uses git worktree add ... {TICKET_ID}, which only works if a local {TICKET_ID} ref still exists. If local branches were removed but the PR branch still exists on origin, this step fails and blocks review-fix follow-up; the recreate flow should fetch and attach from origin/{TICKET_ID} when the local ref is missing.

Useful? React with 👍 / 👎.

Comment thread .claude/agents/git-pr.md

```bash
cd {WORKTREE_PATH}
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.

P1 Badge Normalize workspace slug before running unit-test verification

The verification command runs yarn workspace @webex/{SCOPE} test:unit, but this same agent documents scope examples like task/store, while this repository’s actual workspace names are @webex/cc-task and @webex/cc-store (see packages/contact-center/*/package.json). Using the documented scope values causes test verification to fail before commit/PR creation for common tickets, so scope needs normalization to canonical workspace slugs.

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.

2 participants