[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X0MKZE0VC7KRBJDN9HC3Y9":3,"skill-same:01M6X0MKZE0VC7KRBJDN9HC3Y9":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":28,"linkOnly":29,"markdownContent":30,"markdownBody":31,"frontMatter":32,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":36,"repositoryHtmlUrl":37,"repositoryHomepageUrl":6,"ownerHtmlUrl":38,"ownerBlogUrl":39,"ownerDescription":40,"updatedAt":41,"install":42,"resources":55},"01M6X0MKZE0VC7KRBJDN9HC3Y9","XMC Address PR Comment",null,"Automates addressing PR comments (fetching context, running tests, measuring coverage, and GKE redeployment).","google\u002Fxmc","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6X0MD62T1HTQNBX4VJ5AXWK",8,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_address_pr_comment\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27],"pr","coverage","gke","pr comments","context","running","tests","comments","running tests","2026-11-10 10:12:30",false,"---\nname: XMC Address PR Comment\ndescription: Automates addressing PR comments (fetching context, running tests, measuring coverage, and GKE redeployment).\n---\n\n# PR Comment-Driven Development Workflow\n\nThis document defines a structured agent workflow that automates the process of addressing GitHub Pull Request comments while enforcing comment integrity, programmatic enumeration, and 1-to-1 thread resolution verification.\n\n```mermaid\ngraph TD\n    A[\"User provides PR \u002F comment link\"] --> B[\"Agent runs generate_review_checklist.py\"]\n    B --> C[\"Agent populates pr_review_checklist.md\"]\n    C --> D[\"Agent runs fetch_pr_comment.py for comment context\"]\n    D --> E[\"Agent extracts: body, file path, line\"]\n    E --> D2[\"Agent performs Comment Validity & Pushback Triage\"]\n    D2 --> J2[\"Agent prepares & posts inline pushback replies (for Push Back items)\"]\n    J2 --> M[\"1-to-1 Thread Resolution Verification (verify_pr_comment_resolution.py)\"]\n    D2 --> D3{\"Any Adopt items?\"}\n    D3 -->|Yes| F[\"Agent performs Bazel Query to find affected binaries\"]\n    D3 -->|No| M\n    F --> G[\"Agent prepares Implementation Plan\"]\n    G --> H[\"Agent runs Unit Tests & Coverage\"]\n    H --> I[\"Agent builds affected targets locally\"]\n    I --> J[\"Agent commits changes & replies 'code changed'\"]\n    J --> K[\"Agent builds & pushes OCI Images\"]\n    K --> L[\"Agent performs Kubectl Rollout Restart\"]\n    L --> M[\"1-to-1 Thread Resolution Verification (verify_pr_comment_resolution.py)\"]\n    M --> N[\"Agent conducts Root-Cause Retrospective & Proposes \u002FXMC Iterative Reflection\"]\n    N --> O{\"User approves reflection?\"}\n    O -->|Yes| P[\"Invoke \u002FXMC Iterative Reflection (Benchmark & Update Rules\u002FSkills)\"]\n    P --> Q[\"Agent reports status & completes task\"]\n    O -->|No \u002F Done| Q\n```\n\n> [!IMPORTANT]\n> All execution steps in this skill MUST strictly adhere to the mandatory [PR Review & Inspection Guidelines](..\u002F..\u002Frules\u002Fpr_review_guidelines.md), [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md), and [Core Engineering Standards](..\u002F..\u002Frules\u002Fcore_engineering.md).\n\n---\n\n## Guidelines for Using CLI Tools\n\nWhen invoking helper tools under `tools\u002F` (e.g. `tools\u002Fpr_review\u002Fgenerate_review_checklist.py`, `tools\u002Fpr_review\u002Ffetch_pr_comment.py`, `tools\u002Fpr_review\u002Freply_pr_comment.py`, `tools\u002Fpr_review\u002Freview_threads.py`, `tools\u002Fcommon\u002Fbuild_oci.py`):\n1. **Do not read tool source code**: Do not open or read the Python source code of helper tools. Refer to [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md#5-helper-tool-execution-policy--safety-constraints).\n2. **Use `--help`**: To learn about the tool's usage, options, and parameters, run it with the `--help` flag (e.g. `.\u002Ftools\u002Fpr_review\u002Ffetch_pr_comment.py --help`).\n3. **Parse Structured Output & Handle Errors**: All tools output structured JSON; check the exit code per [Helper Tool Exit Codes](..\u002F..\u002FAGENTS.md#universal-architectural-principles).\n4. **Shell & Payload Safety**: Execute standalone `.py` script files or pass arguments via script parameters. Avoid double-quoted inline commands (`python3 -c \"...\"`).\n   - **Backtick Safety**: When passing reply messages containing backticks (e.g. markdown code spans), avoid double-quoted string arguments in bash. Use `--message-file` (or `-f`) to safely read the reply message from a file instead.\n\n\n\n---\n\n## 1. Automated Review Checklist Generation\n\nWhen addressing PR review feedback or starting a review pass on a Pull Request, the agent first generates a checklist of all unresolved comments directly from the GitHub API.\n\n### When to Call\n- **PR Review Start**: Call immediately when beginning to process review comments on a PR.\n- **Review Pass Check**: Call during post-PR creation checks or whenever an updated checklist of unresolved comments is needed.\n\n### Execution Command\n```bash\n.\u002Ftools\u002Fpr_review\u002Fgenerate_review_checklist.py \u003Cowner> \u003Crepo> \u003Cpr_number> [-o pr_review_checklist.md]\n```\n\n### Result Output Schema\n```json\n{\n  \"status\": \"success\",\n  \"result\": {\n    \"owner\": \"google\",\n    \"repo\": \"xmc\",\n    \"pr_number\": 145,\n    \"output_file\": \"pr_review_checklist.md\",\n    \"unresolved_comment_count\": 3\n  }\n}\n```\nThis generates `pr_review_checklist.md` in the workspace populated with interactive `- [ ]` checkboxes for each unresolved comment.\n\n---\n\n## 2. Input & Comment Details Fetching\n\nThe agent accepts a comment link or PR number. The helper script `tools\u002Fpr_review\u002Ffetch_pr_comment.py` or GitHub API queries retrieve the raw comment context.\n\n### Execution Command\n```bash\n.\u002Ftools\u002Fpr_review\u002Ffetch_pr_comment.py \"\u003Cgithub_comment_url>\"\n```\n\n### Result Schema\n```json\n{\n  \"type\": \"review_comment\",\n  \"comment_id\": 12345678,\n  \"author\": \"reviewer_username\",\n  \"body\": \"Comment text describing the request (e.g., 'Refactor this to avoid nested if-else checks')\",\n  \"file_path\": \"pkg\u002Fauth\u002Foauth2\u002Fhandlers.go\",\n  \"line\": 150,\n  \"diff_hunk\": \"@@ -148,5 +148,8 @@...\",\n  \"commit_id\": \"a1b2c3d4e5f6...\"\n}\n```\n\n---\n\n## 2.5. Comment Validity & Pushback Triage (Mandatory Before Planning Edits)\n\nBefore planning code changes for any review comment (human or automated review bot), the agent MUST critically verify each comment against the actual source tree, `.agents\u002Frules\u002F` (especially language guidelines matching the modified file extension, such as [Go Guidelines](..\u002F..\u002Frules\u002Flanguages\u002Fgolang.md)), and PR scope \u002F diff-size limits (`.\u002Ftools\u002Fanalyze_diff_size.py`). Never blindly assume a review suggestion is valid.\n\nClassify every unresolved comment into one of three dispositions:\n1. **`Adopt (Valid Fix)`**: The comment identifies a genuine bug, race condition, rule violation, or clean improvement within PR scope. Plan the code edit and unit test verification.\n2. **`Push Back (Rule \u002F Technical Conflict)`**: Adopting the suggestion would violate an existing repository rule (for example, [Go Guidelines §9](..\u002F..\u002Frules\u002Flanguages\u002Fgolang.md#9-context-safety-in-defer-cleanups--error-branches) requiring `context.Background()` with a bounded timeout for post-failure diagnostics, `defer`, or `t.Cleanup` paths when the parent `ctx` is already expired\u002Fcanceled) or break runtime behavior\u002Fexisting architecture. Do **not** modify the code; instead, prepare a concise, respectful inline technical pushback reply citing the governing rule or execution trace.\n3. **`Push Back \u002F Defer (Scope Creep or Diff-Size Breach)`**: Adopting the suggestion requires out-of-scope production refactoring in a focused\u002Ftest PR or pushes the diff past `.\u002Ftools\u002Fanalyze_diff_size.py` thresholds. Propose an inline reply explaining why the change is deferred to a dedicated follow-up PR.\n\n---\n\n## 3. Dependency Mapping & Impact Analysis\n\nTo make the workflow precise, the agent must figure out which Bazel binaries and Kubernetes deployments are impacted by the changed file.\n\n### Bazel Package Dependency Mapping\nThe agent runs `bazel query` to discover all `go_binary` targets that transitively depend on the modified package:\n\n```bash\n# 1. Identify the package of the modified file\n# E.g. file_path = \"pkg\u002Fauth\u002Foauth2\u002Fhandlers.go\" -> package \u002F\u002Fpkg\u002Fauth\u002Foauth2\n\n# 2. Query all binaries depending on it\nbazel query \"kind(go_binary, rdeps(\u002F\u002F..., \u002F\u002Fpkg\u002Fauth\u002Foauth2))\"\n```\n\n*Example Output:*\n- `\u002F\u002Fcmd\u002Fxid_service:xid_service`\n- `\u002F\u002Fcmd\u002Fexperiment_state_server:experiment_state_server`\n\n### Mapping Binaries to GKE Deployments\nEach `go_binary` mapped above is associated with an OCI image builder and GKE deployment:\n\n| Bazel Target | Push Command Target | Helm Template File | GKE Deployment Name |\n| :--- | :--- | :--- | :--- |\n| `\u002F\u002Fcmd\u002Fxid_service:xid_service` | `\u002F\u002Fcmd\u002Fxid_service:xid_service_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fxid\u002Fdeployment.yaml` | `xid-service-deployment` |\n| `\u002F\u002Fcmd\u002Fexperiment_state_server` | `\u002F\u002Fcmd\u002Fexperiment_state_server:experiment_state_server_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fess\u002Fdeployment.yaml` | `experiment-state-server-deployment` |\n| `\u002F\u002Fcmd\u002Factuator:actuator` | `\u002F\u002Fcmd\u002Factuator:actuator_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Factuator\u002Fdeployment.yaml` | `actuator-deployment` |\n| `\u002F\u002Fcmd\u002Freconciler:reconciler` | `\u002F\u002Fcmd\u002Freconciler:reconciler_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Freconciler\u002Fdeployment.yaml` | `reconciler-deployment` |\n| `\u002F\u002Fcmd\u002Flog_monitor:log_monitor` | `\u002F\u002Fcmd\u002Flog_monitor:log_monitor_image_push` | N\u002FA | N\u002FA |\n| `\u002F\u002Fcmd\u002Fui` (Frontend TS\u002FHTML) | `\u002F\u002Fcmd\u002Fui:ui_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fess\u002Fui-deployment.yaml` | `ui-deployment` |\n| `\u002F\u002Fcmd\u002Fhealth_service:health_service` | `\u002F\u002Fcmd\u002Fhealth_service:health_service_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fhealth-service\u002Fdeployment.yaml` | `health-service-deployment` |\n| `\u002F\u002Fcmd\u002Frod_data_provider:rod_data_provider` | `\u002F\u002Fcmd\u002Frod_data_provider:rod_data_provider_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Frod\u002Fdeployment.yaml` | `rod-data-provider-deployment` |\n\n---\n\n## 4. Implementation Plan Preparation\n\nBased on the parsed review comments, validity triage, and impacted targets, the agent creates a draft implementation plan (e.g., `pr_comment_resolution_plan.md`) for user review:\n\n- **Comment Validity & Pushback Triage Table**: A summary table (`Comment ID | Summary | Disposition (Adopt \u002F Push Back \u002F Defer) | Technical Rationale`) classifying every comment per [Section 2.5](#25-comment-validity--pushback-triage-mandatory-before-planning-edits).\n- **Analysis**: Visual code excerpt and summary of the reviewer's concern.\n- **Proposed Resolution (Code Changes vs. Inline Pushback Reply)**: For `Adopt` items, specify target file path, exact lines to modify, and a git diff style code snippet. For `Push Back` items, state explicitly that no code change will be made and draft the exact technical rationale reply to be posted via `.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py`.\n- **Affected Components list**: Which binaries and deployments need to be verified (for `Adopt` items).\n- **Execution steps**: A sequence of commands to verify, commit, reply, and deploy.\n\n---\n\n## 5. Test Verification & Code Coverage Check\n\nTo verify code correctness, the agent runs all affected unit tests (including reverse dependencies) and measures code coverage.\n\n### Run Affected Unit Tests\n```bash\n# Run all Bazel unit tests affected by the branch changes (also executed by .\u002F.githooks\u002Fpre-commit)\npython3 .\u002Ftools\u002Frun_affected_tests.py\n```\n\n### Check Coverage\nTo verify test coverage, the agent runs:\n```bash\nbazel coverage --combined_report=lcov \u002F\u002Fpkg\u002Fauth\u002Foauth2\u002F...\n```\nThe output coverage file is generated under `bazel-out\u002F_coverage\u002F_coverage_report.dat`.\nThe agent will parse this file (or generate a summary) to report the package test coverage percentage and point out any lines missing tests.\n\n---\n\n## 6. Local Commit & GitHub Notification (On Success)\n\nExecution in this phase branches based on each comment's disposition from [Section 2.5](#25-comment-validity--pushback-triage-mandatory-before-planning-edits):\n\n- **For `Adopt (Valid Fix)` items**: Once local unit tests pass, build the affected binary targets locally, commit the changes as a distinct follow-up commit, and post an inline reply summarizing the fix and commit SHA.\n- **For `Push Back` \u002F `Defer` items**: Bypass local builds and `git commit` (if a batch contains zero `Adopt` items, no commit is created) and proceed directly to [Post GitHub Comment Notification](#post-github-comment-notification) to post the technical rationale drafted in Section 4.\n\n### Build Targets Locally (`Adopt` Items Only)\nBefore committing or deploying, verify that the affected binaries build successfully:\n```bash\nbazel build \u002F\u002Fcmd\u002Fxid_service:xid_service\n```\n\n### Git Commit to Current Branch (`Adopt` Items Only)\nThe agent stages all changes and commits them as a new, distinct follow-up commit with a message that includes a description of the changes and the URL of the original comment:\n```bash\ngit add .\ngit commit -m \"\u003Ctype>(\u003Cscope>): address review comment\n\nComment link: \u003Cgithub_comment_url>\"\ngit push origin HEAD\n```\n\n> [!CAUTION]\n> **Strict Prohibition of Force-Pushing on Active PRs**:\n> NEVER use `git commit --amend` or `git push --force` (`-f`) when addressing review comments on an active PR branch.\n> Always append distinct follow-up commits so reviewers can inspect incremental diffs via GitHub's **\"Changes since last review\"** view. Squashing happens automatically at merge time via GitHub's \"Squash and merge\" feature, NEVER during active review rounds.\n\n### Reconcile Live PR Description & Tradeoffs (`Adopt` Items Only)\nAfter pushing follow-up commits, compare `gh pr view \u003Cpr_number> --json title,body,baseRefName` against `git diff origin\u002F\u003CbaseRefName>...HEAD` (fetching `origin \u003CbaseRefName>` first if needed, e.g., on stacked `gh-stack` PRs). Whenever review fixes change behavior, touched packages, or surface a load-bearing architectural tradeoff (for example, keeping filtering client-side or deferring a schema migration), update the `Motivation & Context`, `Key Changes`, and `Assumptions` sections via [`.\u002Ftools\u002Fpr_review\u002Fupdate_pr_description.py`](..\u002F..\u002F..\u002Ftools\u002Fpr_review\u002Fupdate_pr_description.py) after presenting the updated preview for confirmation per [XMC Create PR §4](..\u002Fxmc_create_pr\u002FSKILL.md#4-pr-description-updates-via-helper-tool).\n\n### Verify CI on the Pushed Commit (`Adopt` Items Only)\nAfter the [CI wait buffer](..\u002Fxmc_create_pr\u002FSKILL.md#5-ci-wait-buffer-period), block on CI for the new head commit with the helper tool instead of polling bare `gh pr checks` (which exits `8` while checks are pending):\n```bash\n.\u002Ftools\u002Fpr_review\u002Fwait_for_ci.py \u003Cpr_number>\n```\nExit `0` means all checks passed; on exit `1`, triage `failed_checks` and their bounded `log_tail` fields from its error JSON rather than fetching full CI logs.\n\n### Post GitHub Comment Notification\nThe agent runs the helper script `tools\u002Fpr_review\u002Freply_pr_comment.py` to reply to each comment according to its disposition (a code fix summary and commit SHA for `Adopt` items, or the technical pushback \u002F deferral rationale drafted in Section 4 for `Push Back` \u002F `Defer` items):\n```bash\nexport GITHUB_TOKEN=\"your_github_token\"\n.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Cgithub_comment_url>\" \"code changed\"\n```\n\nWhen the reply contains backticks or multi-line rationale (such as a `Push Back` \u002F `Defer` technical explanation or a detailed fix summary), pass a file containing the message via `--message-file` (or `-f`):\n```bash\ncat \u003C\u003C 'EOF' > reply_message.txt\nAddressed review comment for `handlers.go` (or technical pushback rationale from Section 4).\nEOF\n.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Cgithub_comment_url>\" --message-file reply_message.txt\n```\n\n> [!WARNING]\n> **Backtick Subshell Command Safety**: Avoid passing double-quoted strings containing backticks (`` ` ``) directly on the command line (e.g. `.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Curl>\" \"Fixed `func_name()`\"`). Bash evaluates backticks in double-quoted strings as subshell commands prior to executing python, causing unwanted command execution or syntax errors. Always use `--message-file` (or `-f`) when the reply message contains backticks or markdown code formatting.\n\n### Resolve Review Threads\nFor `Adopt` items, pass `--resolve` so the tool resolves the comment's review thread right after posting the reply (via `github_utils.resolve_review_thread`). Leave `Push Back` \u002F `Defer` threads unresolved so the reviewer can adjudicate, unless the user instructs otherwise:\n```bash\n.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Cgithub_comment_url>\" --message-file reply_message.txt --resolve\n```\n\nIf `--resolve` fails after the reply was posted, the tool exits with a handled error carrying the `reply_id`; do NOT re-post the reply, retry resolution only.\n\nTo audit thread state or batch-resolve threads you have already replied to, use `tools\u002Fpr_review\u002Freview_threads.py` (it paginates and identifies your replies via the authenticated `gh` \u002F `GITHUB_TOKEN` user):\n```bash\n# List threads: thread_id, path:line, is_resolved, replied_by_me, first-comment snippet\n.\u002Ftools\u002Fpr_review\u002Freview_threads.py list \u003Cowner> \u003Crepo> \u003Cpr_number> --unresolved-only\n\n# Preview, then resolve only unresolved threads that have a reply from you\n.\u002Ftools\u002Fpr_review\u002Freview_threads.py resolve-replied \u003Cowner> \u003Crepo> \u003Cpr_number> --dry-run\n.\u002Ftools\u002Fpr_review\u002Freview_threads.py resolve-replied \u003Cowner> \u003Crepo> \u003Cpr_number>\n```\n\n> [!IMPORTANT]\n> Do NOT hand-write `gh api graphql` `resolveReviewThread` loops. Always run `resolve-replied --dry-run` first and confirm the candidate list matches the threads you intend to resolve (e.g. it excludes `Push Back` replies you want left open).\n\n### Usage Telemetry Tracking\nWhen `tools\u002Fpr_review\u002Freply_pr_comment.py` successfully posts a reply, it appends a hidden HTML comment block containing public usage metadata (authenticated GitHub user, comment ID, PR number, and UTC timestamp) to the comment body:\n```html\n\u003C!-- xmc-telemetry: {\"git_username\": \"Chad\", \"date\": \"2026-06-22\", \"time\": \"12:00:00 UTC\", \"pr_number\": \"29\", \"comment_id\": 1234} -->\n```\n\nTo extract this telemetry and output it as a raw JSON dataset, run:\n```bash\n.\u002Ftools\u002Fbenchmark\u002Fextract_telemetry.py \u003Cowner> \u003Crepo> [--since \u003CISO_DATE>]\n```\n\n---\n\n## 7. Build, Push, and GKE Redeployment\n\nTo rebuild, push, and redeploy affected services to a GKE cluster:\n\n1. Follow the [XMC Upgrade Environment](..\u002Fxmc_upgrade\u002FSKILL.md) skill for the affected services (`python3 tools\u002Fdev_env\u002Fdev_env.py gke-upgrade --only images`, then `--only restart`).\n2. If neither `deploy\u002Fctk_v2\u002Fxmanager-cloud-deployment.yaml` nor a local `.env` (from `.env.example`) exists, stop and ask the user for the target environment. Do not guess project, cluster, or region values.\n\n---\n\n## 8. 1-to-1 Thread Resolution Verification\n\nBefore marking the PR review task as complete:\n1. Run `.\u002Ftools\u002Fpr_review\u002Fverify_pr_comment_resolution.py \u003Cowner> \u003Crepo> \u003Cpull_number> \u003Cpath_to_checklist_file>` to programmatically verify that 100% of comment IDs from the checklist have received dedicated inline replies authored by you (the authenticated `gh` \u002F `GITHUB_TOKEN` user), across all pages of PR review comments.\n2. Confirm that every single comment ID from the consolidated checklist artifact has received a dedicated inline response or resolution.\n3. Update the checklist artifact status for each item to `[x] Resolved`.\n\n---\n\n## 9. Root-Cause Retrospective & Iterative Reflection Proposal\n\nWhenever review comments (from human reviewers or automated review bots) are addressed and verified, the agent must not merely \"fix and forget\". The agent performs a fast root-cause classification on why the initial PR implementation missed the expected standard and proposes invoking the [Iterative Reflection Skill](..\u002Fxmc_iterative_reflection\u002FSKILL.md).\n\n### Root-Cause Classification Framework\nClassify each addressed review comment into one of three categories:\n1. **Rule & Guideline Gap (`.agents\u002Frules\u002F`)**: The codebase guidelines lacked an explicit rule, style constraint, or invariant (e.g., missing error wrapping convention, naming convention, or mock contract).\n2. **Tooling & Automation Gap (`tools\u002F`)**: The feedback could have been caught mechanically before PR submission by a script, linter, or pre-commit hook (e.g., missing parameter validation, formatting check, or test coverage threshold).\n3. **Skill & Workflow Gap (`.agents\u002Fskills\u002F`)**: The development workflow playbook lacked a necessary pre-PR inspection step or verification phase.\n\n### Presenting the Retrospective Proposal\nAt the end of the comment resolution report, present a structured proposal table and ask the user if they wish to trigger iterative reflection:\n\n```markdown\n### 🔄 PR Comment Retrospective & Meta-Learning Proposal\n\n| Comment ID | Reviewer Feedback Summary | Root-Cause Category | Proposed Rule \u002F Tool Enhancement |\n| :--- | :--- | :--- | :--- |\n| #1234 | \"Wrap internal errors with `%w`\" | Rule Gap (`.agents\u002Frules\u002Flanguages\u002Fgolang.md`) | Add explicit Go error wrapping rule |\n| #1235 | \"Missing unit test for helper function\" | Skill Gap (`.agents\u002Fskills\u002Fxmc_feature_development\u002FSKILL.md`) | Enforce 1-to-1 helper unit test check |\n\n> Would you like to invoke `\u002FXMC Iterative Reflection` to analyze these root causes, benchmark candidate rule updates with `\u002FXMC Trajectory Comparison`, and open a dedicated improvement PR?\n```\n\nIf the user approves, proceed to invoke the [XMC Iterative Reflection Skill](..\u002Fxmc_iterative_reflection\u002FSKILL.md).\n\n---\n\n## 10. Workflow Example\n\nHere is a step-by-step example of how you can invoke this agent:\n\n1. **You ask**:\n   > Fix PR comments for: `https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fpull\u002F15`\n\n2. **The agent executes**:\n   - Runs programmatic enumeration via `gh api repos\u002Fgoogle\u002Fxmc\u002Fpulls\u002F15\u002Fcomments` + Python parsing.\n   - Extracts 100% of open threads (e.g., 3 comments total).\n   - Creates Consolidated Review Checklist Artifact and verifies item count (3 threads).\n   - Identifies code locations and runs `bazel query` to map changes to `\u002F\u002Fcmd\u002Fxid_service` and `\u002F\u002Fcmd\u002Fexperiment_state_server`.\n   - Proposes refactored code plan.\n\n3. **You approve the plan**.\n4. **The agent executes**:\n   - Edits the files.\n   - Runs unit tests and coverage calculations.\n   - Builds the affected targets locally.\n   - Commits changes to the branch.\n   - Posts reply comments for each comment ID on GitHub.\n   - Pushes updated OCI containers via `bazel run \u002F\u002Fcmd\u002Fxid_service:xid_service_image_push`.\n   - Restarts GKE pods: `kubectl rollout restart deployment\u002Fxid-service-deployment -n xmc`.\n   - Programmatically verifies 1-to-1 thread resolution for all comment IDs against the checklist.\n   - Updates checklist artifact and replies with test outputs and rollout status confirmation.\n   - **Presents PR Comment Retrospective table** and proposes invoking `\u002FXMC Iterative Reflection` to codify learnings into `.agents\u002Frules\u002F` and prevent future review feedback.\n","# PR Comment-Driven Development Workflow\n\nThis document defines a structured agent workflow that automates the process of addressing GitHub Pull Request comments while enforcing comment integrity, programmatic enumeration, and 1-to-1 thread resolution verification.\n\n```mermaid\ngraph TD\n    A[\"User provides PR \u002F comment link\"] --> B[\"Agent runs generate_review_checklist.py\"]\n    B --> C[\"Agent populates pr_review_checklist.md\"]\n    C --> D[\"Agent runs fetch_pr_comment.py for comment context\"]\n    D --> E[\"Agent extracts: body, file path, line\"]\n    E --> D2[\"Agent performs Comment Validity & Pushback Triage\"]\n    D2 --> J2[\"Agent prepares & posts inline pushback replies (for Push Back items)\"]\n    J2 --> M[\"1-to-1 Thread Resolution Verification (verify_pr_comment_resolution.py)\"]\n    D2 --> D3{\"Any Adopt items?\"}\n    D3 -->|Yes| F[\"Agent performs Bazel Query to find affected binaries\"]\n    D3 -->|No| M\n    F --> G[\"Agent prepares Implementation Plan\"]\n    G --> H[\"Agent runs Unit Tests & Coverage\"]\n    H --> I[\"Agent builds affected targets locally\"]\n    I --> J[\"Agent commits changes & replies 'code changed'\"]\n    J --> K[\"Agent builds & pushes OCI Images\"]\n    K --> L[\"Agent performs Kubectl Rollout Restart\"]\n    L --> M[\"1-to-1 Thread Resolution Verification (verify_pr_comment_resolution.py)\"]\n    M --> N[\"Agent conducts Root-Cause Retrospective & Proposes \u002FXMC Iterative Reflection\"]\n    N --> O{\"User approves reflection?\"}\n    O -->|Yes| P[\"Invoke \u002FXMC Iterative Reflection (Benchmark & Update Rules\u002FSkills)\"]\n    P --> Q[\"Agent reports status & completes task\"]\n    O -->|No \u002F Done| Q\n```\n\n> [!IMPORTANT]\n> All execution steps in this skill MUST strictly adhere to the mandatory [PR Review & Inspection Guidelines](..\u002F..\u002Frules\u002Fpr_review_guidelines.md), [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md), and [Core Engineering Standards](..\u002F..\u002Frules\u002Fcore_engineering.md).\n\n---\n\n## Guidelines for Using CLI Tools\n\nWhen invoking helper tools under `tools\u002F` (e.g. `tools\u002Fpr_review\u002Fgenerate_review_checklist.py`, `tools\u002Fpr_review\u002Ffetch_pr_comment.py`, `tools\u002Fpr_review\u002Freply_pr_comment.py`, `tools\u002Fpr_review\u002Freview_threads.py`, `tools\u002Fcommon\u002Fbuild_oci.py`):\n1. **Do not read tool source code**: Do not open or read the Python source code of helper tools. Refer to [Skills & Automation Guidelines](..\u002F..\u002Frules\u002Fskills_and_automation.md#5-helper-tool-execution-policy--safety-constraints).\n2. **Use `--help`**: To learn about the tool's usage, options, and parameters, run it with the `--help` flag (e.g. `.\u002Ftools\u002Fpr_review\u002Ffetch_pr_comment.py --help`).\n3. **Parse Structured Output & Handle Errors**: All tools output structured JSON; check the exit code per [Helper Tool Exit Codes](..\u002F..\u002FAGENTS.md#universal-architectural-principles).\n4. **Shell & Payload Safety**: Execute standalone `.py` script files or pass arguments via script parameters. Avoid double-quoted inline commands (`python3 -c \"...\"`).\n   - **Backtick Safety**: When passing reply messages containing backticks (e.g. markdown code spans), avoid double-quoted string arguments in bash. Use `--message-file` (or `-f`) to safely read the reply message from a file instead.\n\n\n\n---\n\n## 1. Automated Review Checklist Generation\n\nWhen addressing PR review feedback or starting a review pass on a Pull Request, the agent first generates a checklist of all unresolved comments directly from the GitHub API.\n\n### When to Call\n- **PR Review Start**: Call immediately when beginning to process review comments on a PR.\n- **Review Pass Check**: Call during post-PR creation checks or whenever an updated checklist of unresolved comments is needed.\n\n### Execution Command\n```bash\n.\u002Ftools\u002Fpr_review\u002Fgenerate_review_checklist.py \u003Cowner> \u003Crepo> \u003Cpr_number> [-o pr_review_checklist.md]\n```\n\n### Result Output Schema\n```json\n{\n  \"status\": \"success\",\n  \"result\": {\n    \"owner\": \"google\",\n    \"repo\": \"xmc\",\n    \"pr_number\": 145,\n    \"output_file\": \"pr_review_checklist.md\",\n    \"unresolved_comment_count\": 3\n  }\n}\n```\nThis generates `pr_review_checklist.md` in the workspace populated with interactive `- [ ]` checkboxes for each unresolved comment.\n\n---\n\n## 2. Input & Comment Details Fetching\n\nThe agent accepts a comment link or PR number. The helper script `tools\u002Fpr_review\u002Ffetch_pr_comment.py` or GitHub API queries retrieve the raw comment context.\n\n### Execution Command\n```bash\n.\u002Ftools\u002Fpr_review\u002Ffetch_pr_comment.py \"\u003Cgithub_comment_url>\"\n```\n\n### Result Schema\n```json\n{\n  \"type\": \"review_comment\",\n  \"comment_id\": 12345678,\n  \"author\": \"reviewer_username\",\n  \"body\": \"Comment text describing the request (e.g., 'Refactor this to avoid nested if-else checks')\",\n  \"file_path\": \"pkg\u002Fauth\u002Foauth2\u002Fhandlers.go\",\n  \"line\": 150,\n  \"diff_hunk\": \"@@ -148,5 +148,8 @@...\",\n  \"commit_id\": \"a1b2c3d4e5f6...\"\n}\n```\n\n---\n\n## 2.5. Comment Validity & Pushback Triage (Mandatory Before Planning Edits)\n\nBefore planning code changes for any review comment (human or automated review bot), the agent MUST critically verify each comment against the actual source tree, `.agents\u002Frules\u002F` (especially language guidelines matching the modified file extension, such as [Go Guidelines](..\u002F..\u002Frules\u002Flanguages\u002Fgolang.md)), and PR scope \u002F diff-size limits (`.\u002Ftools\u002Fanalyze_diff_size.py`). Never blindly assume a review suggestion is valid.\n\nClassify every unresolved comment into one of three dispositions:\n1. **`Adopt (Valid Fix)`**: The comment identifies a genuine bug, race condition, rule violation, or clean improvement within PR scope. Plan the code edit and unit test verification.\n2. **`Push Back (Rule \u002F Technical Conflict)`**: Adopting the suggestion would violate an existing repository rule (for example, [Go Guidelines §9](..\u002F..\u002Frules\u002Flanguages\u002Fgolang.md#9-context-safety-in-defer-cleanups--error-branches) requiring `context.Background()` with a bounded timeout for post-failure diagnostics, `defer`, or `t.Cleanup` paths when the parent `ctx` is already expired\u002Fcanceled) or break runtime behavior\u002Fexisting architecture. Do **not** modify the code; instead, prepare a concise, respectful inline technical pushback reply citing the governing rule or execution trace.\n3. **`Push Back \u002F Defer (Scope Creep or Diff-Size Breach)`**: Adopting the suggestion requires out-of-scope production refactoring in a focused\u002Ftest PR or pushes the diff past `.\u002Ftools\u002Fanalyze_diff_size.py` thresholds. Propose an inline reply explaining why the change is deferred to a dedicated follow-up PR.\n\n---\n\n## 3. Dependency Mapping & Impact Analysis\n\nTo make the workflow precise, the agent must figure out which Bazel binaries and Kubernetes deployments are impacted by the changed file.\n\n### Bazel Package Dependency Mapping\nThe agent runs `bazel query` to discover all `go_binary` targets that transitively depend on the modified package:\n\n```bash\n# 1. Identify the package of the modified file\n# E.g. file_path = \"pkg\u002Fauth\u002Foauth2\u002Fhandlers.go\" -> package \u002F\u002Fpkg\u002Fauth\u002Foauth2\n\n# 2. Query all binaries depending on it\nbazel query \"kind(go_binary, rdeps(\u002F\u002F..., \u002F\u002Fpkg\u002Fauth\u002Foauth2))\"\n```\n\n*Example Output:*\n- `\u002F\u002Fcmd\u002Fxid_service:xid_service`\n- `\u002F\u002Fcmd\u002Fexperiment_state_server:experiment_state_server`\n\n### Mapping Binaries to GKE Deployments\nEach `go_binary` mapped above is associated with an OCI image builder and GKE deployment:\n\n| Bazel Target | Push Command Target | Helm Template File | GKE Deployment Name |\n| :--- | :--- | :--- | :--- |\n| `\u002F\u002Fcmd\u002Fxid_service:xid_service` | `\u002F\u002Fcmd\u002Fxid_service:xid_service_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fxid\u002Fdeployment.yaml` | `xid-service-deployment` |\n| `\u002F\u002Fcmd\u002Fexperiment_state_server` | `\u002F\u002Fcmd\u002Fexperiment_state_server:experiment_state_server_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fess\u002Fdeployment.yaml` | `experiment-state-server-deployment` |\n| `\u002F\u002Fcmd\u002Factuator:actuator` | `\u002F\u002Fcmd\u002Factuator:actuator_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Factuator\u002Fdeployment.yaml` | `actuator-deployment` |\n| `\u002F\u002Fcmd\u002Freconciler:reconciler` | `\u002F\u002Fcmd\u002Freconciler:reconciler_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Freconciler\u002Fdeployment.yaml` | `reconciler-deployment` |\n| `\u002F\u002Fcmd\u002Flog_monitor:log_monitor` | `\u002F\u002Fcmd\u002Flog_monitor:log_monitor_image_push` | N\u002FA | N\u002FA |\n| `\u002F\u002Fcmd\u002Fui` (Frontend TS\u002FHTML) | `\u002F\u002Fcmd\u002Fui:ui_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fess\u002Fui-deployment.yaml` | `ui-deployment` |\n| `\u002F\u002Fcmd\u002Fhealth_service:health_service` | `\u002F\u002Fcmd\u002Fhealth_service:health_service_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Fhealth-service\u002Fdeployment.yaml` | `health-service-deployment` |\n| `\u002F\u002Fcmd\u002Frod_data_provider:rod_data_provider` | `\u002F\u002Fcmd\u002Frod_data_provider:rod_data_provider_image_push` | `deploy\u002Fhelm\u002Ftemplates\u002Frod\u002Fdeployment.yaml` | `rod-data-provider-deployment` |\n\n---\n\n## 4. Implementation Plan Preparation\n\nBased on the parsed review comments, validity triage, and impacted targets, the agent creates a draft implementation plan (e.g., `pr_comment_resolution_plan.md`) for user review:\n\n- **Comment Validity & Pushback Triage Table**: A summary table (`Comment ID | Summary | Disposition (Adopt \u002F Push Back \u002F Defer) | Technical Rationale`) classifying every comment per [Section 2.5](#25-comment-validity--pushback-triage-mandatory-before-planning-edits).\n- **Analysis**: Visual code excerpt and summary of the reviewer's concern.\n- **Proposed Resolution (Code Changes vs. Inline Pushback Reply)**: For `Adopt` items, specify target file path, exact lines to modify, and a git diff style code snippet. For `Push Back` items, state explicitly that no code change will be made and draft the exact technical rationale reply to be posted via `.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py`.\n- **Affected Components list**: Which binaries and deployments need to be verified (for `Adopt` items).\n- **Execution steps**: A sequence of commands to verify, commit, reply, and deploy.\n\n---\n\n## 5. Test Verification & Code Coverage Check\n\nTo verify code correctness, the agent runs all affected unit tests (including reverse dependencies) and measures code coverage.\n\n### Run Affected Unit Tests\n```bash\n# Run all Bazel unit tests affected by the branch changes (also executed by .\u002F.githooks\u002Fpre-commit)\npython3 .\u002Ftools\u002Frun_affected_tests.py\n```\n\n### Check Coverage\nTo verify test coverage, the agent runs:\n```bash\nbazel coverage --combined_report=lcov \u002F\u002Fpkg\u002Fauth\u002Foauth2\u002F...\n```\nThe output coverage file is generated under `bazel-out\u002F_coverage\u002F_coverage_report.dat`.\nThe agent will parse this file (or generate a summary) to report the package test coverage percentage and point out any lines missing tests.\n\n---\n\n## 6. Local Commit & GitHub Notification (On Success)\n\nExecution in this phase branches based on each comment's disposition from [Section 2.5](#25-comment-validity--pushback-triage-mandatory-before-planning-edits):\n\n- **For `Adopt (Valid Fix)` items**: Once local unit tests pass, build the affected binary targets locally, commit the changes as a distinct follow-up commit, and post an inline reply summarizing the fix and commit SHA.\n- **For `Push Back` \u002F `Defer` items**: Bypass local builds and `git commit` (if a batch contains zero `Adopt` items, no commit is created) and proceed directly to [Post GitHub Comment Notification](#post-github-comment-notification) to post the technical rationale drafted in Section 4.\n\n### Build Targets Locally (`Adopt` Items Only)\nBefore committing or deploying, verify that the affected binaries build successfully:\n```bash\nbazel build \u002F\u002Fcmd\u002Fxid_service:xid_service\n```\n\n### Git Commit to Current Branch (`Adopt` Items Only)\nThe agent stages all changes and commits them as a new, distinct follow-up commit with a message that includes a description of the changes and the URL of the original comment:\n```bash\ngit add .\ngit commit -m \"\u003Ctype>(\u003Cscope>): address review comment\n\nComment link: \u003Cgithub_comment_url>\"\ngit push origin HEAD\n```\n\n> [!CAUTION]\n> **Strict Prohibition of Force-Pushing on Active PRs**:\n> NEVER use `git commit --amend` or `git push --force` (`-f`) when addressing review comments on an active PR branch.\n> Always append distinct follow-up commits so reviewers can inspect incremental diffs via GitHub's **\"Changes since last review\"** view. Squashing happens automatically at merge time via GitHub's \"Squash and merge\" feature, NEVER during active review rounds.\n\n### Reconcile Live PR Description & Tradeoffs (`Adopt` Items Only)\nAfter pushing follow-up commits, compare `gh pr view \u003Cpr_number> --json title,body,baseRefName` against `git diff origin\u002F\u003CbaseRefName>...HEAD` (fetching `origin \u003CbaseRefName>` first if needed, e.g., on stacked `gh-stack` PRs). Whenever review fixes change behavior, touched packages, or surface a load-bearing architectural tradeoff (for example, keeping filtering client-side or deferring a schema migration), update the `Motivation & Context`, `Key Changes`, and `Assumptions` sections via [`.\u002Ftools\u002Fpr_review\u002Fupdate_pr_description.py`](..\u002F..\u002F..\u002Ftools\u002Fpr_review\u002Fupdate_pr_description.py) after presenting the updated preview for confirmation per [XMC Create PR §4](..\u002Fxmc_create_pr\u002FSKILL.md#4-pr-description-updates-via-helper-tool).\n\n### Verify CI on the Pushed Commit (`Adopt` Items Only)\nAfter the [CI wait buffer](..\u002Fxmc_create_pr\u002FSKILL.md#5-ci-wait-buffer-period), block on CI for the new head commit with the helper tool instead of polling bare `gh pr checks` (which exits `8` while checks are pending):\n```bash\n.\u002Ftools\u002Fpr_review\u002Fwait_for_ci.py \u003Cpr_number>\n```\nExit `0` means all checks passed; on exit `1`, triage `failed_checks` and their bounded `log_tail` fields from its error JSON rather than fetching full CI logs.\n\n### Post GitHub Comment Notification\nThe agent runs the helper script `tools\u002Fpr_review\u002Freply_pr_comment.py` to reply to each comment according to its disposition (a code fix summary and commit SHA for `Adopt` items, or the technical pushback \u002F deferral rationale drafted in Section 4 for `Push Back` \u002F `Defer` items):\n```bash\nexport GITHUB_TOKEN=\"your_github_token\"\n.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Cgithub_comment_url>\" \"code changed\"\n```\n\nWhen the reply contains backticks or multi-line rationale (such as a `Push Back` \u002F `Defer` technical explanation or a detailed fix summary), pass a file containing the message via `--message-file` (or `-f`):\n```bash\ncat \u003C\u003C 'EOF' > reply_message.txt\nAddressed review comment for `handlers.go` (or technical pushback rationale from Section 4).\nEOF\n.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Cgithub_comment_url>\" --message-file reply_message.txt\n```\n\n> [!WARNING]\n> **Backtick Subshell Command Safety**: Avoid passing double-quoted strings containing backticks (`` ` ``) directly on the command line (e.g. `.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Curl>\" \"Fixed `func_name()`\"`). Bash evaluates backticks in double-quoted strings as subshell commands prior to executing python, causing unwanted command execution or syntax errors. Always use `--message-file` (or `-f`) when the reply message contains backticks or markdown code formatting.\n\n### Resolve Review Threads\nFor `Adopt` items, pass `--resolve` so the tool resolves the comment's review thread right after posting the reply (via `github_utils.resolve_review_thread`). Leave `Push Back` \u002F `Defer` threads unresolved so the reviewer can adjudicate, unless the user instructs otherwise:\n```bash\n.\u002Ftools\u002Fpr_review\u002Freply_pr_comment.py \"\u003Cgithub_comment_url>\" --message-file reply_message.txt --resolve\n```\n\nIf `--resolve` fails after the reply was posted, the tool exits with a handled error carrying the `reply_id`; do NOT re-post the reply, retry resolution only.\n\nTo audit thread state or batch-resolve threads you have already replied to, use `tools\u002Fpr_review\u002Freview_threads.py` (it paginates and identifies your replies via the authenticated `gh` \u002F `GITHUB_TOKEN` user):\n```bash\n# List threads: thread_id, path:line, is_resolved, replied_by_me, first-comment snippet\n.\u002Ftools\u002Fpr_review\u002Freview_threads.py list \u003Cowner> \u003Crepo> \u003Cpr_number> --unresolved-only\n\n# Preview, then resolve only unresolved threads that have a reply from you\n.\u002Ftools\u002Fpr_review\u002Freview_threads.py resolve-replied \u003Cowner> \u003Crepo> \u003Cpr_number> --dry-run\n.\u002Ftools\u002Fpr_review\u002Freview_threads.py resolve-replied \u003Cowner> \u003Crepo> \u003Cpr_number>\n```\n\n> [!IMPORTANT]\n> Do NOT hand-write `gh api graphql` `resolveReviewThread` loops. Always run `resolve-replied --dry-run` first and confirm the candidate list matches the threads you intend to resolve (e.g. it excludes `Push Back` replies you want left open).\n\n### Usage Telemetry Tracking\nWhen `tools\u002Fpr_review\u002Freply_pr_comment.py` successfully posts a reply, it appends a hidden HTML comment block containing public usage metadata (authenticated GitHub user, comment ID, PR number, and UTC timestamp) to the comment body:\n```html\n\u003C!-- xmc-telemetry: {\"git_username\": \"Chad\", \"date\": \"2026-06-22\", \"time\": \"12:00:00 UTC\", \"pr_number\": \"29\", \"comment_id\": 1234} -->\n```\n\nTo extract this telemetry and output it as a raw JSON dataset, run:\n```bash\n.\u002Ftools\u002Fbenchmark\u002Fextract_telemetry.py \u003Cowner> \u003Crepo> [--since \u003CISO_DATE>]\n```\n\n---\n\n## 7. Build, Push, and GKE Redeployment\n\nTo rebuild, push, and redeploy affected services to a GKE cluster:\n\n1. Follow the [XMC Upgrade Environment](..\u002Fxmc_upgrade\u002FSKILL.md) skill for the affected services (`python3 tools\u002Fdev_env\u002Fdev_env.py gke-upgrade --only images`, then `--only restart`).\n2. If neither `deploy\u002Fctk_v2\u002Fxmanager-cloud-deployment.yaml` nor a local `.env` (from `.env.example`) exists, stop and ask the user for the target environment. Do not guess project, cluster, or region values.\n\n---\n\n## 8. 1-to-1 Thread Resolution Verification\n\nBefore marking the PR review task as complete:\n1. Run `.\u002Ftools\u002Fpr_review\u002Fverify_pr_comment_resolution.py \u003Cowner> \u003Crepo> \u003Cpull_number> \u003Cpath_to_checklist_file>` to programmatically verify that 100% of comment IDs from the checklist have received dedicated inline replies authored by you (the authenticated `gh` \u002F `GITHUB_TOKEN` user), across all pages of PR review comments.\n2. Confirm that every single comment ID from the consolidated checklist artifact has received a dedicated inline response or resolution.\n3. Update the checklist artifact status for each item to `[x] Resolved`.\n\n---\n\n## 9. Root-Cause Retrospective & Iterative Reflection Proposal\n\nWhenever review comments (from human reviewers or automated review bots) are addressed and verified, the agent must not merely \"fix and forget\". The agent performs a fast root-cause classification on why the initial PR implementation missed the expected standard and proposes invoking the [Iterative Reflection Skill](..\u002Fxmc_iterative_reflection\u002FSKILL.md).\n\n### Root-Cause Classification Framework\nClassify each addressed review comment into one of three categories:\n1. **Rule & Guideline Gap (`.agents\u002Frules\u002F`)**: The codebase guidelines lacked an explicit rule, style constraint, or invariant (e.g., missing error wrapping convention, naming convention, or mock contract).\n2. **Tooling & Automation Gap (`tools\u002F`)**: The feedback could have been caught mechanically before PR submission by a script, linter, or pre-commit hook (e.g., missing parameter validation, formatting check, or test coverage threshold).\n3. **Skill & Workflow Gap (`.agents\u002Fskills\u002F`)**: The development workflow playbook lacked a necessary pre-PR inspection step or verification phase.\n\n### Presenting the Retrospective Proposal\nAt the end of the comment resolution report, present a structured proposal table and ask the user if they wish to trigger iterative reflection:\n\n```markdown\n### 🔄 PR Comment Retrospective & Meta-Learning Proposal\n\n| Comment ID | Reviewer Feedback Summary | Root-Cause Category | Proposed Rule \u002F Tool Enhancement |\n| :--- | :--- | :--- | :--- |\n| #1234 | \"Wrap internal errors with `%w`\" | Rule Gap (`.agents\u002Frules\u002Flanguages\u002Fgolang.md`) | Add explicit Go error wrapping rule |\n| #1235 | \"Missing unit test for helper function\" | Skill Gap (`.agents\u002Fskills\u002Fxmc_feature_development\u002FSKILL.md`) | Enforce 1-to-1 helper unit test check |\n\n> Would you like to invoke `\u002FXMC Iterative Reflection` to analyze these root causes, benchmark candidate rule updates with `\u002FXMC Trajectory Comparison`, and open a dedicated improvement PR?\n```\n\nIf the user approves, proceed to invoke the [XMC Iterative Reflection Skill](..\u002Fxmc_iterative_reflection\u002FSKILL.md).\n\n---\n\n## 10. Workflow Example\n\nHere is a step-by-step example of how you can invoke this agent:\n\n1. **You ask**:\n   > Fix PR comments for: `https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fpull\u002F15`\n\n2. **The agent executes**:\n   - Runs programmatic enumeration via `gh api repos\u002Fgoogle\u002Fxmc\u002Fpulls\u002F15\u002Fcomments` + Python parsing.\n   - Extracts 100% of open threads (e.g., 3 comments total).\n   - Creates Consolidated Review Checklist Artifact and verifies item count (3 threads).\n   - Identifies code locations and runs `bazel query` to map changes to `\u002F\u002Fcmd\u002Fxid_service` and `\u002F\u002Fcmd\u002Fexperiment_state_server`.\n   - Proposes refactored code plan.\n\n3. **You approve the plan**.\n4. **The agent executes**:\n   - Edits the files.\n   - Runs unit tests and coverage calculations.\n   - Builds the affected targets locally.\n   - Commits changes to the branch.\n   - Posts reply comments for each comment ID on GitHub.\n   - Pushes updated OCI containers via `bazel run \u002F\u002Fcmd\u002Fxid_service:xid_service_image_push`.\n   - Restarts GKE pods: `kubectl rollout restart deployment\u002Fxid-service-deployment -n xmc`.\n   - Programmatically verifies 1-to-1 thread resolution for all comment IDs against the checklist.\n   - Updates checklist artifact and replies with test outputs and rollout status confirmation.\n   - **Presents PR Comment Retrospective table** and proposes invoking `\u002FXMC Iterative Reflection` to codify learnings into `.agents\u002Frules\u002F` and prevent future review feedback.\n",{"name":5,"description":7},"main","1f7f860b618a010ba54e6577bb4647643d06020e",".agents\u002Fskills\u002Fxmc_address_pr_comment",0,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 11:47:55",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add google\u002Fxmc --skill \"XMC Address PR Comment\"",{"tool":48,"command":49},"bunx","bunx skills add google\u002Fxmc --skill \"XMC Address PR Comment\"",{"tool":51,"command":52},"pnpm","pnpm dlx skills add google\u002Fxmc --skill \"XMC Address PR Comment\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_address_pr_comment\u002FSKILL.md",true,[],[57,75,97,122,143,166],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":28},"01M6X0PXHKB5KRZ6BESP7J4A3H","XMC Upgrade Environment","Upgrades an existing XManager on Cloud (XMC) environment on GKE to the latest current branch state using the deployment configuration YAML.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_upgrade\u002FSKILL.md",[],[64,59,65,66,67,68,69,70,21,71,72,73,74],"environment","upgrade","branch","deployment","upgrades","Existing","state","yaml","latest","cloud","configuration",{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":28},"01M6X0PQ36XYVZW78KRBR8MT9E","XMC Trajectory Comparison","Validates proposed skill or rule changes by executing concurrent A\u002FB benchmark subagents on clean baseline vs candidate worktrees, comparing trajectories, and tearing down test resources.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_trajectory_comparison\u002FSKILL.md",[],[77,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96],"comparison","trajectory","resources","down","clean","trajectories","candidate","test","changes","worktrees","baseline","benchmark","clean baseline","rule","subagents",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":28},"01M6X0PFP96RZXZNJ9V4T2ZJK5","XMC Review PR","Interactive multi-agent PR review workflow enforcing code rules, open direction discussions, explicit confirmation gates, inline comment deduplication, and follow-up re-review verification.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_review_pr\u002FSKILL.md",[],[99,104,19,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],"review","review pr","direction","re","up","open","confirmation","deduplication","workflow","code","verification","inline","follow-up","multi-agent","pr review","Rules","interactive","gates",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":28},"01M6X0P8K827HRQFZS32Y1KB2N","XMC Release","Orchestrates an end-to-end XMC release workflow — deploying the latest main to nightly, running and verifying e2e tests, capturing visual snapshot galleries, generating and iterating on structured release notes with the user, and publishing the release. Use when preparing, orchestrating, or publishing a formal XMC release from main.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_release\u002FSKILL.md",[],[124,129,24,130,25,131,33,132,133,134,135,112,136,137,138,139,72,140,141,142],"release","end","publishing","e2e","release notes","use","when","visual","with","notes","e2e tests","snapshot","user","structured",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":28},"01M6X0P20VKAAEP4R43HJQ9957","XMC PR Split Verification","Analyzes pull request diffs exceeding size thresholds (400 prod \u002F 1000 total \u002F 1000 docs) to enforce Single Responsibility Principle (SRP), evaluate vertical slice splitting feasibility, eliminate dead code, and plan gh-stack PR stacks.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_pr_split_verification\u002FSKILL.md",[],[19,145,150,114,151,152,153,154,155,156,157,113,158,159,160,161,162,163,164,165],"split","pull","thresholds","slice","enforce","diffs","single","gh","vertical slice","stack","plan","size","evaluate","pull request","request","dead code",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":28},"01M6X0NV5ZP3T8RPKRYGGJ613G","XMC Iterative Reflection","Audits active session trajectory, thought history, and PR review comments to identify friction points, rule gaps, missing helper tools, and token inefficiencies. Use when requested by the user, after major implementations, or following PR review comment resolutions.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxmc\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fxmc_iterative_reflection\u002FSKILL.md",[],[168,173,174,135,104,175,176,177,178,19,118,179,180,134,181,26,182,83,183,95],"reflection","pr review comments","active","token","Tools","history","session","missing","helper","gaps","friction"]