fix(docs-sync): address review findings on the learnings step - #12834
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
pandemicsyn
approved these changes
Aug 3, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
lgtm — all three follow-up fixes are correct: the prompt-artifact seed runs before any fallible work and every success path rewrites it, the marker PATCH re-reads the body with a warned fallback, and Reviewed by kimi-k3 · Input: 95.2K · Output: 19.6K · Cached: 812.9K Review guidance: REVIEW.md from base branch |
iscekic
enabled auto-merge (squash)
August 3, 2026 21:49
5 tasks
This was referenced Aug 5, 2026
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #12823. It fixes the three review findings from @pandemicsyn.
All three reproduce. Each fix carries one test that fails without it.
1. A failed API call disabled every learned rule
The learn step is
continue-on-error, andtriage.mjsandedit.mjsread onlydocs-sync-out/learnings-triage.mdandlearnings-edit.md. A throw anywhere inextraction left both files absent, so the whole run ran with no learned rule and
no signal.
learn.mjsnow writes both artifacts from the checked-outLEARNINGS.mdbeforeany fallible work, and replaces them once the rolling branch copy loads. An empty
block now removes the file, so a later replacement can shrink a seeded block.
2. The marker PATCH overwrote a concurrent body edit
The direct PATCH sent the body read at step 1. The extraction call runs for up to
10 minutes between the read and the write, so any edit in that window was lost.
patchOrLogMarkernow re-reads the body immediately before the PATCH. GitHub hasno conditional update for a pull request body, so a short fetch-to-PATCH race
remains. The comment states it.
3. Duplicate ids and rules inside one response
validateDeltacompared each addition against the existing entries only. Twoadditions in one response could carry one id or one rule text, and both rendered.
It now rejects a duplicate of an earlier accepted addition.
Tests
10sasserts both prompt artifacts survive a failed API call and carry thechecked-out rule. It also asserts an empty file clears a stale block.
10tdriveslearn.mjsagainst a stub GitHub API. The second read of the pullrequest returns a maintainer edit. The test asserts the edit survives the
PATCH, the marker holds the new tip SHA, and one marker remains.
10uasserts both duplicate rejections.DOCS_SYNC_API_BASEis a new selftest-only hook that pointslib.mjsat thestub server. The workflow never sets it.
Local proof
node .github/docs-sync/selftest.mjspasses.Every new test was mutation-checked. With the fix reverted:
10sfails withlearnings-triage.md must survive the failure.10tfails withthe concurrent body edit must survive the marker PATCH.10ufails witha repeated id must be rejected.Visual Changes
N/A
E2E: skipped — this change is a GitHub Action and has no local runtime surface.