Skip to content

fix(ci): pass KILO_ORG_ID to docs-sync LLM steps - #12519

Merged
iscekic merged 1 commit into
mainfrom
fix/docs-sync-kilo-org-id
Jul 24, 2026
Merged

fix(ci): pass KILO_ORG_ID to docs-sync LLM steps#12519
iscekic merged 1 commit into
mainfrom
fix/docs-sync-kilo-org-id

Conversation

@iscekic

@iscekic iscekic commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Issue

Follow-up to #12512 (docs-sync bot). No tracking issue — exception: this fixes a defect found in the first dry run after that PR merged.

Failed dry run: https://github.com/Kilo-Org/kilocode/actions/runs/30107542234/job/89528563405

Context

The docs-sync dry run went green but every LLM call failed: all 8 triage chunks 402'd with Add credits to continue, or switch to a free model, so 187/187 PRs were degraded to "unclassified" and triage reported 0 docs-worthy.

Root cause: the workflow passed KILO_API_KEY to the LLM steps but not KILO_ORG_ID. Without the org ID the CLI's kilo provider sends no X-KiloCode-OrganizationId header (packages/core/src/plugin/provider/kilo.ts), so the gateway falls back to the key owner's personal balance (getBalanceAndOrgSettings in kilocode-backend) instead of the organization balance. The personal balance is empty → HTTP 402 on a paid model.

Evidence the key itself is fine: the same KILO_API_KEY + KILO_ORG_ID pair ran the paid smoke-test gate successfully in the publish run ~12 minutes before the docs-sync dry run (run 30106281647). Same secret, same day — works with the org ID, 402s without.

Implementation

  • Hoisted KILO_API_KEY + KILO_ORG_ID to job-level env: in docs-sync.yml, matching the existing pattern in smoke-test.yml (and the CLI's own generated GitHub workflow template, which emits both). This covers the triage, edit, and fix-verify steps and any future CLI-invoking steps.
  • Updated the Env: doc comments in triage.mjs / edit.mjs to name both variables.

Screenshots / Video

N/A — CI-only change.

How to Test

Manual/local verification

  • python3 -c "import yaml; yaml.safe_load(...)" on the edited workflow — valid (agent-executed).
  • Full monorepo typecheck ran green via the pre-push hook (agent-executed).

Reviewer test steps

  1. Trigger a dry run from this branch: gh workflow run docs-sync.yml --ref fix/docs-sync-kilo-org-id -f dry_run=true
  2. Confirm the "Triage merged PRs" step no longer logs Add credits to continue and chunks produce real classifications (not all "triage failed to classify this PR").

Blocked checks and substitute verification

  • Cannot exercise the paid gateway path locally; substitute verification is the branch dry run above, plus the same-day smoke-test success cited as evidence the key+org pair bills correctly.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes (CI-only; none needed)
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Without KILO_ORG_ID the kilo provider sends no X-KiloCode-OrganizationId
header, so the gateway bills the key owner's personal balance instead of
the org. The dry run (run 30107542234) 402'd every triage chunk with
"Add credits to continue, or switch to a free model" and silently
classified 0/187 PRs.

Hoist KILO_API_KEY + KILO_ORG_ID to job-level env, matching smoke-test.yml.
@kilo-code-bot

kilo-code-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .github/workflows/docs-sync.yml
  • .github/docs-sync/triage.mjs
  • .github/docs-sync/edit.mjs

Reviewed by claude-sonnet-5 · Input: 20 · Output: 1.7K · Cached: 400.5K

Review guidance: REVIEW.md from base branch main

@iscekic

iscekic commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

(bot) Validation dry run from this branch: https://github.com/Kilo-Org/kilocode/actions/runs/30111081805 — success.

  • No Add credits to continue errors; every chunk classified by the LLM.
  • triage complete: 106 entries, 22 docs-worthy (smaller window than the failed run because this dispatch used the default watermark, not the since override).
  • One benign retry (chunk 3 attempt 1: no valid JSON in output), recovered on attempt 2 — unrelated to auth.

Compare with the failed run (30107542234): 8/8 chunks 402'd, 0 docs-worthy.

@iscekic
iscekic requested a review from pandemicsyn July 24, 2026 17:15
@iscekic
iscekic enabled auto-merge (squash) July 24, 2026 17:19
@iscekic
iscekic requested a review from jeanduplessis July 24, 2026 17:40
@iscekic iscekic self-assigned this Jul 24, 2026
@iscekic
iscekic merged commit 61a7043 into main Jul 24, 2026
29 checks passed
@iscekic
iscekic deleted the fix/docs-sync-kilo-org-id branch July 24, 2026 20:02
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
Without KILO_ORG_ID the kilo provider sends no X-KiloCode-OrganizationId
header, so the gateway bills the key owner's personal balance instead of
the org. The dry run (run 30107542234) 402'd every triage chunk with
"Add credits to continue, or switch to a free model" and silently
classified 0/187 PRs.

Hoist KILO_API_KEY + KILO_ORG_ID to job-level env, matching smoke-test.yml.
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