Skip to content

feat(docs-sync): learn from maintainer corrections - #12823

Merged
iscekic merged 9 commits into
mainfrom
docs-learnings-bfb1
Aug 3, 2026
Merged

iscekic merged 9 commits into
mainfrom
docs-learnings-bfb1

Conversation

@iscekic

@iscekic iscekic commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add learning from maintainer corrections to the rolling docs pull request.

The workflow reads trusted corrective commits and review comments. It extracts validated rules, injects tagged rules into triage and edit, and commits LEARNINGS.md with the normal rolling pull request update.

Design and safety

The implementation keeps the twelve closed design decisions and G5.

  • G1 reads standalone review comments.
  • G2 trusts only OWNER, MEMBER, and COLLABORATOR authors.
  • G3 allowlists LEARNINGS.md in the non-content draft gate.
  • G4 accepts the barren-run lag.
  • G5 PATCHes learned-through for empty deltas and uses the upsert route for non-empty deltas.

The extractor rejects rules that name a pull request, page, person, or URL. It preserves a marker when extraction omits its output. It writes no marker under dry_run or LEARNINGS_NO_PATCH.

Upsert changes

  • nonContentFiles excludes the root learnings file from the draft gate.
  • renderBody renders learned-through only when a value exists.
  • resolveLearnedThrough preserves an existing marker when extraction omits an output.
  • A newly created rolling pull request is assigned to @emilieschario and asks that user for a review. A failure there warns and does not fail the run.

Local proof

The extraction call deliberately omits --auto. The local proof used LEARNINGS_NO_PATCH=1, the real 9dd2c07 correction, and kilo/moonshotai/kimi-k3.

It produced: Do not document features that are behind experimental or unreleased flags.

  • Scope: both
  • Source: commit:9dd2c07

kilo-auto/efficient was unavailable locally. The workflow model completed the proof with no live pull request write.

Review result

The planning reviews raised 31 findings. The plan accepted 29 and rejected two.

The rejected items were a prose-arithmetic budget assertion and a persistent learning tombstone. Both add fragile or unsupported state without preventing a real defect.

Accepted limits

The barren-run lag remains accepted. The conflict path can reset the marker and self-heals on the next run.

Visual Changes

N/A

Remaining: one human-approved dispatch

  • What remains: run workflow_dispatch for docs-sync on this branch.
  • It can update live pull request docs: auto-sync with merged PRs (through 2026-08-01) #12716 on docs/auto-sync.
  • It can add a LEARNINGS.md commit and advance learned-through.
  • Run first with dry_run: true.
  • The dry run proves extraction without a file or marker write.
  • Then check the marker, one rule per line, and rule text without pull requests, pages, people, or URLs.

E2E: skipped — this change is a GitHub Action and has no local runtime surface.

@iscekic iscekic self-assigned this Aug 3, 2026
@vercel

vercel Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs (docs-staging) Ready Ready Preview Aug 3, 2026 8:32pm

Request Review

Comment thread .github/docs-sync/learn.mjs Outdated
Comment thread .github/docs-sync/learn.mjs Outdated
Comment thread .github/docs-sync/learn.mjs
Comment thread .github/docs-sync/learn.mjs Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review at 025ccad9. The new commit adds a best-effort assignee + review request (emilieschario) on rolling-PR creation, wrapped in a try/catch that warns without failing the run, and selftest case 11 pins the constant, the endpoint order after PR creation, and the single try/catch covering both POSTs. Endpoints are correct (/issues/ for assignees, /pulls/ for requested_reviewers), the owner is a constant so nothing untrusted reaches the ::warning:: output, and no new long-lived resources are introduced. All 8 prior findings remain resolved (all are on learn.mjs, untouched in this increment).

Files Reviewed (2 files)
  • .github/docs-sync/upsert-pr.mjs
  • .github/docs-sync/selftest.mjs
Previous Review Summaries (2 snapshots, latest commit 1dd45df)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 1dd45df)

Status: No Issues Found | Recommendation: Merge

Incremental review at 1dd45df7. The previous SUGGESTION (comment→commit correlation comparing ISO timestamps lexicographically across mixed timezone offsets) is resolved: learn.mjs now compares Date.parse values, and new selftest case 10rz pins the behavior with a mixed-offset fixture (+05:00 vs Z) that fails under the old string comparison. All earlier findings remain resolved.

Files Reviewed (2 files)
  • .github/docs-sync/learn.mjs
  • .github/docs-sync/selftest.mjs

Previous review (commit 0d89078)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1

Incremental review at 0d89078d. The three prior findings (unused sorted() helper, uncapped comment bodies, missing non-empty-delta suppression coverage) are all resolved in the latest commit — verified against current code. One new low-severity finding below.

Issue Details (click to expand)

SUGGESTION

File Line Issue
.github/docs-sync/learn.mjs 618 Comment→commit correlation compares ISO timestamps lexicographically across mixed timezone offsets (git %cI local offset vs GitHub UTC Z), which is not chronological inside the offset window; Date.parse comparison would fix it. Impact limited to extraction correlation context.
Files Reviewed (9 files)
  • .github/docs-sync/learn.mjs - 1 issue
  • .github/docs-sync/edit-prompt.md - 0 issues
  • .github/docs-sync/edit.mjs - 0 issues
  • .github/docs-sync/learnings-prompt.md - 0 issues
  • .github/docs-sync/selftest.mjs - 0 issues
  • .github/docs-sync/triage.mjs - 0 issues
  • .github/docs-sync/upsert-pr.mjs - 0 issues
  • .github/workflows/docs-sync.yml - 0 issues
  • packages/kilo-docs/LEARNINGS.md - 0 issues

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 45.6K · Output: 7.3K · Cached: 305.2K

Review guidance: REVIEW.md from base branch main

@pandemicsyn pandemicsyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

couple small things inline from the robot

}
existing = parseLearnings(existingText)
}
log(`existing entries: ${existing.length}`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Extraction errors can disable all existing learnings for the run

Suggested fix: Emit prompt artifacts from the best available existing LEARNINGS.md before any fallible API/model work, and retain them on every error path. Ideally pre-seed from the checked-out file at startup, then replace them after loading the rolling branch and after a validated delta. Add a test where PR/comment fetching throws and assert triage/edit still receive existing rules.


// Live PATCH: body-only, one line changed. The job already holds pull-requests: write.
const { api, repo } = await import("./lib.mjs")
const newBody = patchMarkerIntoBody(prBody, marker)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The direct marker PATCH can overwrite concurrent PR-body edits

Suggested fix: Fetch the PR again immediately before patching, apply patchMarkerIntoBody to that latest body, and PATCH the result. Add a test in which the body returned at patch time differs from the initially fetched body and verify the intervening content is preserved. If GitHub exposes a usable conditional-update mechanism, use it to close the remaining fetch/PATCH race.

reason = `source ${a.source} not in candidate sources`
} else if (!/^[a-z0-9][a-z0-9-]{2,48}$/.test(a.id)) {
reason = `invalid id format: ${a.id}`
} else if (existingIds.has(a.id) && !toRemove.includes(a.id)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duplicate IDs within one model response pass validation

Suggested fix: Track IDs accepted from the current add array as well as existing IDs, rejecting a second occurrence. Also compare normalized text against already accepted additions so one response cannot render duplicate rules. Add validation tests for duplicate IDs and duplicate rule text in the same delta.

@iscekic
iscekic merged commit 1740b03 into main Aug 3, 2026
36 checks passed
@iscekic
iscekic deleted the docs-learnings-bfb1 branch August 3, 2026 21:05
iscekic added a commit that referenced this pull request Aug 3, 2026
Three defects from the review of #12823.

- A throw after the learn step started left no prompt artifact, so triage and
  edit ran with no learned rule at all. The step is continue-on-error, so the
  run continued and the failure was silent. learn.mjs now writes both prompt
  artifacts from the checked-out file before any fallible work, and replaces
  them once the rolling branch copy loads.
- The direct marker PATCH sent the body read before the extraction call, so it
  overwrote any body edit made in the minutes since. learn.mjs now re-reads the
  body immediately before the PATCH.
- Two additions in one model response could carry one id or one rule text.
  validateDelta now rejects a duplicate of an earlier accepted addition.

Tests: 10s pins the prompt artifacts across a failed API call and the removal of
a stale block. 10t drives learn.mjs against a stub GitHub API whose second read
returns a maintainer edit, and asserts the edit survives the PATCH. 10u pins
both duplicate rejections. DOCS_SYNC_API_BASE is the new selftest-only hook that
points lib.mjs at the stub server.
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
* feat(docs-sync): learn from maintainer corrections

* feat(docs-sync): apply learnings during sync

* fix(docs-sync): handle standalone review comments

* fix(docs-sync): cover extraction marker routes

* test(docs-sync): verify dry-run marker safety

* chore: retrigger review

* fix(docs-sync): harden extraction input

* fix(docs-sync): compare correction timestamps

* feat(docs-sync): assign and request review on new rolling PR
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…rg#12834)

Three defects from the review of Kilo-Org#12823.

- A throw after the learn step started left no prompt artifact, so triage and
  edit ran with no learned rule at all. The step is continue-on-error, so the
  run continued and the failure was silent. learn.mjs now writes both prompt
  artifacts from the checked-out file before any fallible work, and replaces
  them once the rolling branch copy loads.
- The direct marker PATCH sent the body read before the extraction call, so it
  overwrote any body edit made in the minutes since. learn.mjs now re-reads the
  body immediately before the PATCH.
- Two additions in one model response could carry one id or one rule text.
  validateDelta now rejects a duplicate of an earlier accepted addition.

Tests: 10s pins the prompt artifacts across a failed API call and the removal of
a stale block. 10t drives learn.mjs against a stub GitHub API whose second read
returns a maintainer edit, and asserts the edit survives the PATCH. 10u pins
both duplicate rejections. DOCS_SYNC_API_BASE is the new selftest-only hook that
points lib.mjs at the stub server.

This branch was successfully deployed

1 active deployment
docs-staging – docs — 025ccad9 Deployed Aug 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

human-ready PR is ready for a human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants