Skip to content

feat(mctl-docs): fallback to GitHub API when sibling clones absent - #17

Closed
mashkovd wants to merge 2 commits into
mainfrom
feat/mctl-docs-github-fallback
Closed

mashkovd wants to merge 2 commits into
mainfrom
feat/mctl-docs-github-fallback

Conversation

@mashkovd

@mashkovd mashkovd commented May 9, 2026

Copy link
Copy Markdown
Member

Add GitHub API fallback in scan-sibling-commits skill when local sibling clones are not available.

Fixes from codex P2: paginate GitHub commits API (per_page=50 was capped at 50 commits/repo);
now follows Link: rel="next" pagination up to 5 pages × 100 commits.

The mctl-docs agent's primary signal is sibling-repo git history. In
cluster runs, only mctl-gitops is cloned; previously the skill recorded
"no signal: <repo> path missing" for every other repo, which made the
agent useless in production.

Teach scan-sibling-commits to detect missing local clones and fall back
to api.github.com/repos/mctlhq/<repo>/commits via WebFetch/curl,
authenticated with the GITHUB_TOKEN env (already passed through by
options.py via os.environ; the cluster wiring lands in the parallel
mctl-gitops PR). Authenticated rate limit is 5000/h vs 60/h public, so
7 repos × 1 list-call per run is comfortable headroom.

CLAUDE.md gains a short note pointing operators at the fallback path
and explaining the silent degradation when the token is absent.
…kill

codex P2 — per_page=50 capped at 50 commits/repo, dropping older ones.
Now max 5 pages x 100 commits with Link: rel="next" follow + sanity cap
note in output when hit.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f11782f49

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

- `proposals/` — оформленные предложения. Slug = `<area>-<short-desc>`, например `mcp-identity-tools` или `openclaw-skill-quotas`.
- За пределы своей папки не выходи. Чужие сервисы — НЕ редактируешь, только читаешь git log.
- **Не клонируй ничего**. Если соседний репо отсутствует по пути из `SIBLING_REPOS_PATH` — задокументируй это в inbox как "no signal: <repo> path missing" и продолжай со следующим.
- **Не клонируй ничего**. В кластере sibling-клоны отсутствуют (clone-gitops step клонирует только `mctl-gitops`); в этом случае skill `scan-sibling-commits` автоматически fall back на GitHub REST API через `WebFetch`/`curl`. Для этого нужен env `GITHUB_TOKEN` (fine-grained PAT, Contents:read на `mctlhq/*`). Если токен пустой — public API rate-limit (60/h) почти гарантированно убьёт run, и skill пометит "no signal: <repo> rate-limited" в inbox. С токеном лимит 5000/h — комфортно для 7 репо. Подробности: `agents/mctl-docs/.claude/skills/scan-sibling-commits/SKILL.md`.

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 Align clone-gitops assumptions across sections

This new guidance says cluster runs clone only mctl-gitops and rely on GitHub API fallback, but the earlier “Соседние репо для мониторинга” section in the same file still states that clone-gitops clones all repos. That contradiction makes the runbook ambiguous and can cause the researcher to choose the wrong data source (expecting local clones instead of API mode), which directly affects whether sibling commits are actually scanned in cluster environments.

Useful? React with 👍 / 👎.

@mashkovd

Copy link
Copy Markdown
Member Author

Закрываю: fallback уже в скилле на main.

agents/mctl-docs/.claude/skills/scan-sibling-commits/SKILL.md:

 9: **Mode A: local clone** (preferred, fast) and **Mode B: GitHub API
10: fallback** (for cluster runs where only `mctl-gitops` is cloned).
41: ### Mode B — GitHub API fallback (when the local clone is missing)
44: URL: https://api.github.com/repos/mctlhq/<repo>/commits?since=<ISO8601>&per_page=100
60:   contains `rel="next"` ...

Обе правки из ревью Codex учтены: per_page=100 вместо упиравшегося в 50 и пагинация по Link: rel="next".

@mashkovd mashkovd closed this Aug 19, 2026
@mashkovd
mashkovd deleted the feat/mctl-docs-github-fallback branch September 2, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant