Skip to content

feat(kb): learn upstream PR history in one Codex-reviewed knowledge PR - #283

Merged
tzhouam merged 4 commits into
mainfrom
feat/kb-init-pr-history
Oct 1, 2026
Merged

tzhouam merged 4 commits into
mainfrom
feat/kb-init-pr-history

Conversation

@tzhouam

@tzhouam tzhouam commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

KB init adds a pr-history phase after deepen. It reads the latest 1,000 merged upstream PRs by default, replays them oldest first through the configured model gateway, and opens one draft knowledge PR with one nonempty knowledge-upgrade commit per accepted upstream PR. Codex reviews the complete aggregate diff, prior owner rules, routes and pinned source evidence; only approval of the exact head makes the draft ready.

The phase keeps executable rules with their nearest component or model owner and never writes raw PR archives into knowledge. It checkpoints the immutable window, frozen baseline, completed PRs, pending extraction and cumulative spend, so failures and budget increases resume the same batch. Publication retries preserve the commit series and reject changed inputs. The compact PR description stays within GitHub's limit, while commit trailers retain every upstream reference. Existing init records remain compatible, including completed repositories adding this phase.

Use kb init <repo> --stage pr-history; --pr-count N overrides the default and --budget-usd N can raise the cumulative ceiling. This change adds the phase; production learning runs are invoked separately.

Validation at f337b5c6a263b3433d9760ff072ae1de637d170d:

  • Full offline suite: 2,278 passed, 17 skipped.
  • Independent Codex review: approved the entire 19-file, four-commit diff against 87b16108283f8e27d07b570f213f30285ec4c398, with no remaining actionable findings; its 206 targeted tests passed.
  • Both push and PR CI runs passed, including the full suite, wheel/runtime and CLI checks.
  • Documentation links, citations and strict SPEC coverage/freshness passed.
  • Both knowledge validators passed; the tree checker reports 31 existing warnings.

@tzhouam
tzhouam marked this pull request as ready for review October 1, 2026 11:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T11:58:21.874240Z f337b5c Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tzhouam
tzhouam merged commit 4bdaca6 into main Oct 1, 2026
2 checks passed

@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: f337b5c6a2

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

Comment on lines +355 to +357
if not model_scope_valid(owner.owner, rule["title"] + "\n" + body, paths, models) or \
(not owner.owner.startswith("model:") and
(self._owner_for(paths) != owner or any(owner not in self._owners_at(p) for p in paths))):

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 Route rules by every code path they name

When a generated rule cites evidence under one owner but names a backticked path or symbol belonging to another owner in its trigger/action text, this check validates ownership using only the evidence paths assembled above. Although _screen later validates those named claims, it never rechecks their ownership, so the rule can be written under the wrong component and omitted from Direct reviews of the component it actually governs. Include the paths discovered by _paths_named when selecting and validating the nearest owner.

AGENTS.md reference: AGENTS.md:L12-L17

Useful? React with 👍 / 👎.

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