Repository navigation
Take Copilot run lessons from pr_debug fix records into knowledge intake - #225
Conversation
Source 2 of the design (Copilot's own run experience) had a producer and a
consumer that never met. pr_debug drops verified fix records (bugfix-record
v1/v2) into KNOWLEDGE_INTAKE_DIR and posts them to a mailbox issue, while the
knowledge service only read its own inbox/lessons format, so no run ever
became a knowledge event.
- collect_events (with intake.copilot_runs) now also reads fix records:
- dropped on this host into KB_BUGFIX_DIR (default
<state_dir>/inbox/bugfix; set it to the runs' KNOWLEDGE_INTAKE_DIR);
- posted by runs on other hosts to the mailbox issue KB_BUGFIX_MAILBOX
(owner/repo#N).
- A record belongs to the repository whose full name (case-insensitive) or
alias it names exactly. An ambiguous identity is quarantined (renamed
.quarantined), never rewritten; a record for another configured repository
is left for that repository's turn; a malformed one is left for inspection.
- The mailbox is a public issue: only comments by KB_BUGFIX_AUTHORS count,
and without that list the mailbox is not read at all. Each repository keeps
its own comment cursor.
- The mailbox is read from one second before the last seen comment's
creation time (`since` is exclusive and second-grained; the id cursor drops
the overlap), so a busy mailbox never pins the reader behind a fixed page
window and a comment sharing that second is not skipped. The
record is decoded as one JSON object after the fence opener, so a code
fence quoted inside a root cause does not truncate it; a record whose
`files` is not a list is malformed and skipped.
- Event IDs are the records' event_id, so a record delivered twice (drop and
mailbox, or a retry) is one event.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1eff9e0ab2
ℹ️ 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".
| if not isinstance(group, dict) or not isinstance(group.get("files") or [], list): | ||
| return None |
There was a problem hiding this comment.
Reject falsey non-list files values
When a dropped record or allowed mailbox comment has "files": null, omits the field, or supplies another falsey scalar, group.get("files") or [] converts it to an empty list and accepts the malformed record. collect_events then persists it and marks the drop consumed or advances the mailbox cursor, contrary to the malformed-record handling and preventing later inspection or correction; validate the original field directly as a list.
Useful? React with 👍 / 👎.
Resolve the SPEC conflict by keeping both new sections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Source 2 of the design (Copilot's own run experience) had a producer and a
consumer that never met. pr_debug drops verified fix records (bugfix-record
v1/v2) into KNOWLEDGE_INTAKE_DIR and posts them to a mailbox issue, while the
knowledge service only read its own inbox/lessons format, so no run ever
became a knowledge event.
<state_dir>/inbox/bugfix; set it to the runs' KNOWLEDGE_INTAKE_DIR);
(owner/repo#N).
alias it names exactly. An ambiguous identity is quarantined (renamed
.quarantined), never rewritten; a record for another configured repository
is left for that repository's turn; a malformed one is left for inspection.
and without that list the mailbox is not read at all. Each repository keeps
its own comment cursor.
creation time (
sinceis exclusive and second-grained; the id cursor dropsthe overlap), so a busy mailbox never pins the reader behind a fixed page
window and a comment sharing that second is not skipped. The
record is decoded as one JSON object after the fence opener, so a code
fence quoted inside a root cause does not truncate it; a record whose
filesis not a list is malformed and skipped.mailbox, or a retry) is one event.
Tests:
test/test_kb_lessons.py(6); full offline suite green; spec freshness strict clean.🤖 Generated with Claude Code