Skip to content

refactor(skill): upgrade open-code-review skill to modular structure with v1.9.1 features - #850

Open
lidaixingchen wants to merge 5 commits into
alibaba:mainfrom
lidaixingchen:refactor/upgrade-skill-to-modular-v1.9
Open

refactor(skill): upgrade open-code-review skill to modular structure with v1.9.1 features#850
lidaixingchen wants to merge 5 commits into
alibaba:mainfrom
lidaixingchen:refactor/upgrade-skill-to-modular-v1.9

Conversation

@lidaixingchen

@lidaixingchen lidaixingchen commented Aug 11, 2026

Copy link
Copy Markdown

Summary of Changes

This PR refactors the built-in open-code-review skill into a modular, progressive-disclosure architecture and aligns it with all latest CLI features up to v1.9.1.

Key Enhancements:

  1. Modular Architecture & Token Efficiency:

    • Replaces the legacy monolithic SKILL.md with a streamlined main guide using Progressive Reference Navigation.
    • Extracted detailed reference documentation into references/:
      • references/flags.md: Comprehensive CLI flags reference for review & scan modes.
      • references/llm-config.md: Installation, LLM configuration, resolution priority, and per-run CLI overrides.
      • references/rules.md: Custom rule definitions, hierarchy, and matching debugging.
      • references/mcp.md: MCP server integration & tool registration specifications.
      • references/troubleshooting.md: Troubleshooting, performance tuning, session management & filtering.
  2. Alignment with v1.9.1 CLI Features:

    • Per-Run Overrides: Documented --provider, --model, and --max-tokens CLI flags to override configuration per-run.
    • Resumable Scan Mode: Documented ocr scan --resume <session-id> support.
    • Comment Filtering & Extraction: Added ocr session comments subcommand options (--severity, --category, --json).
    • Advanced Configs: Included llm.retry_codes (custom 4xx retry codes; 408/409/429 and all 5xx are already retried by the SDK) and max_tokens (per-file token cap).
    • Preview Support: Updated --preview flag options (supports --format json).
    • Protocol Environment Variable Fix: Updated legacy OCR_USE_ANTHROPIC guidance to standard OCR_LLM_PROTOCOL=anthropic.

Follow-up Accuracy Fixes (verified against source):

  • Fixed retry_codes examples: only 4xx codes are accepted — 429,502,503 would error out; 408/409/429 and all 5xx are retried by the SDK by default.
  • Fixed ocr session comments flag: it is --json, not --format json.
  • Fixed JSON status enum: scan mode has no manifest and emits success / completed_with_warnings / completed_with_errors, not the review-mode values.
  • Fixed exit-code semantics: non-zero only when every selected item failed or on run-level failure; partial failures exit 0.
  • Clarified that background sanitization (control chars, 2000/8000 char limits) applies to --background-file only; inline --background passes through raw.
  • Clarified --max-tools min-10 clamp is review-mode only; scan mode takes effect only above the template default.
  • Enriched JSON output docs: llm, trace_id, tool_calls, project_summary, token breakdown fields, comments.thinking, coverage reused/waived sets, and stderr failure emission.
  • Added provider-level config (providers.*, custom_providers.*), extended env vars (OCR_LLM_AUTH_HEADER, OCR_LLM_EXTRA_HEADERS, OCR_USE_ANTHROPIC, OCR_LLM_TIMEOUT, OCR_CONFIG_PATH), llm.timeout_sec/auth_header/extra_* keys, and ocr config provider/model/unset commands.
  • Added session --repo flag, MCP behavioral details, and rules matching details (case-insensitive matching, single-level include/exclude, heuristic file references).
  • Updated stale model example to claude-opus-5, deferring to ocr llm providers.
  • Added output truncation handling: redirect-to-file guidance with ocr session comments recovery in Step 2, a Gotchas entry, and a troubleshooting row (covers the topic of docs(skill): avoid output truncation in agent skill instructions #809 with a complete recovery path), plus the official site link.

Reconciliation with main:

Authored by 历代星辰

Copilot AI lite review requested due to automatic review settings August 11, 2026 17:49
@CLAassistant

CLAassistant commented Aug 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: Review skipped: no items were selected.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors the skills/open-code-review documentation into a modular “progressive reference navigation” structure and updates the guidance to cover newer CLI capabilities through v1.9.1 (review/scan modes, session resume, per-run overrides, MCP, troubleshooting).

Changes:

  • Reworked SKILL.md into a slimmer main guide with a navigation table and updated workflows for review vs. scan.
  • Added dedicated reference docs for flags, LLM configuration, rules, MCP integration, and troubleshooting/session management.
  • Updated examples to prefer --audience agent and --format json, and documented newer session/comment tooling.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
skills/open-code-review/SKILL.md Main skill guide refactored to progressive navigation and updated workflows/examples.
skills/open-code-review/references/flags.md Centralized CLI flags reference and defaults.
skills/open-code-review/references/llm-config.md Installation + LLM configuration + per-run override documentation.
skills/open-code-review/references/rules.md Extracted custom rule resolution/format/debugging docs.
skills/open-code-review/references/mcp.md Documented MCP server configuration and built-in tool registry.
skills/open-code-review/references/troubleshooting.md Added performance tuning, troubleshooting, and session management guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread skills/open-code-review/SKILL.md Outdated
| "Review feature PR" | `ocr review --audience agent --format json -b "ctx" --from main --to feature` |
| "Review commit abc123" | `ocr review --audience agent --format json -b "ctx" --commit abc123` |
| "Which files will be reviewed?" | `ocr review --preview --format json` |
| "Resume interrupted review" | `ocr review --audience agent --format json --resume <session-id>` |
Comment on lines +44 to +46
# Resume interrupted review or scan
ocr review --audience agent --format json --resume <session-id>
ocr scan --audience agent --format json --resume <session-id>
| `--max-tokens-budget` | | `0` (unlimited) | Token budget cap; outputs partial results gracefully if exceeded |
| `--provider` | | Configured Provider | Per-run override for LLM Provider (e.g. `openai`, `anthropic`) |
| `--model` | | Configured Model | Per-run override for LLM model |
| `--max-tokens` | | `58888` | Per-run override for per-file prompt token limit |
| Symptom | Action |
|---------|--------|
| Rate limit errors | Lower `--concurrency` to 2-4 |
| Frequent 429 / 50x errors | Configure `ocr config set llm.retry_codes 429,500,502,503` |
- Fix retry_codes examples: accepts 4xx only; 408/409/429 and all 5xx
  are already retried by the SDK by default
- Fix ocr session comments flag: --format json -> --json
- Fix JSON status enum: scan mode emits success /
  completed_with_warnings / completed_with_errors (no manifest)
- Fix exit-code semantics: non-zero only on run-level failure or when
  every selected item failed; partial failures exit 0
- Clarify background sanitization (strip control chars, 2000/8000 char
  limits) applies to --background-file only; inline -b passes through raw
- Clarify --max-tools min-10 clamp applies to review mode only; scan
  mode only takes effect above the template default
- Enrich JSON output structure: llm, trace_id, tool_calls, project_summary,
  token breakdown fields, comments.thinking, coverage reused/waived sets,
  and stderr failure emission
- Add provider-level config (providers.*, custom_providers.*), extended
  env vars (OCR_LLM_AUTH_HEADER, OCR_LLM_EXTRA_HEADERS, OCR_USE_ANTHROPIC,
  OCR_LLM_TIMEOUT, OCR_CONFIG_PATH), llm.timeout_sec / auth_header /
  extra_* keys, and ocr config provider / model / unset commands
- Add session --repo flag, MCP behavioral details, rules matching details
- Update stale model example to claude-opus-5; defer to ocr llm providers

Signed-off-by: 历代星辰
@lidaixingchen
lidaixingchen force-pushed the refactor/upgrade-skill-to-modular-v1.9 branch from b6d3fd8 to feba657 Compare August 11, 2026 19:18
- Add console truncation prevention guidance in Step 2 (redirect to file,
  session comments recovery, stderr note) and a Gotchas entry, matching
  the truncation topic of alibaba#809 with a more complete recovery path
- Add Tool Output truncation troubleshooting row
- Add official site link to References

Signed-off-by: 历代星辰
…ng note

- Remove host-specific size estimate (~45KB) from truncation guidance;
  keep host-agnostic wording since agents vary (Claude Code, Codex, etc.)
- Add Windows PowerShell redirect caveat: PowerShell 5 '>' writes UTF-16
  and corrupts JSON; use Out-File -Encoding utf8 or bash

Signed-off-by: 历代星辰
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.

3 participants