Skip to content

feat(learning): scope learnings by GitHub repository ID - #375

Draft
nshki wants to merge 11 commits into
nshki/chore/learning/copilot-sdk-1-0-34from
nshki/feat/learning/github-repository-identity
Draft

nshki wants to merge 11 commits into
nshki/chore/learning/copilot-sdk-1-0-34from
nshki/feat/learning/github-repository-identity

Conversation

@nshki

@nshki nshki commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Why

Repository names can change. Learnings need a stable identity so a rename or transfer does not mix histories or hide existing guidance.

What changes

Solo and Hub now use the numeric GitHub repository ID for learning scope. Solo saves the ID after looking it up with the person's GitHub CLI sign-in. Hub reports learnings as unavailable when a repository has no GitHub ID.

Existing SQLite history moves transactionally and rejects older writers. Solo users confirm the old repository identity and stop all clients first. JSON Lines and custom providers can be copied offline into SQLite without changing the original store. Providers that cannot discover old names require an explicit old name or confirmation of a new empty store. Matching histories retain their records and respect prior redactions and consent withdrawals. The guides explain recovery, retained copies, and renamed repositories.

Hub can still remove deleted review text from an ID-less legacy store without exposing the store for learning.

The inherited PR workflows have not been scheduled on the base commit, so its full CI evidence remains unavailable.

The fresh decision-model walkthrough has not been verified end to end.

Storybook screenshots

Repository administrators can see redaction follow-ups in Learnings.

Hub/Pages/Learnings — RedactionFollowUp, light theme, 1200 × 1279.

Learnings page showing redaction follow-up details

nshki and others added 4 commits November 25, 2026 08:11
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Preserve overlapping histories and their consent, redaction, and snapshot records during offline migration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Allow deletion recovery without exposing legacy learning stores and keep repository lookups in the repository layer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
@nshki
nshki added this pull request to stack #367 November 25, 2026 17:18
@nshki
nshki requested an adaptive review from Copilot November 25, 2026 17:18
nshki and others added 2 commits November 25, 2026 09:21
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711

Copilot AI 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.

🟡 Changes recommended

Unresolved critical migration and redaction defects can reintroduce removed text, omit required deletion follow-ups, and permanently block learning proposals.

15 open issues
What changed in this PR

This PR moves Solo and Hub learning scopes to numeric GitHub repository IDs so repository renames and transfers can retain their learning history.

Changes:

  • Resolves and caches GitHub repository identities, and blocks Hub learning access when an ID is unavailable.
  • Adds transactional SQLite scope migration and offline copying from legacy providers.
  • Updates Hub learning, decision-model, and redaction flows, along with fixtures and recovery guidance.
File Description
packages/​learning/​test/​labeling.test.mjs Supplies numeric and legacy scopes to labeling commands.
packages/​learning/​test/​decision.test.mjs Seeds cached repository identities for decision tests.
packages/​learning/​test/​config.test.mjs Tests numeric scope parsing and name rejection.
packages/​learning/​test/​cli.test.mjs Updates CLI fixtures and assertions for ID-based scopes.
packages/​learning/​test/​agent-memory-repo.test.mjs Exercises migration before publishing learning records.
packages/​learning/​src/​store.mjs Reconciles migrated evidence, consent, redactions, and proposal identities.
packages/​learning/​src/​scope-migration.mjs Adds verified scope transformation and history reconciliation.
packages/​learning/​src/​providers/​sqlite.mjs Adds atomic migration, durable mappings, and old-writer fencing.
packages/​learning/​src/​providers/​json-lines.mjs Adds discovery of legacy repository scopes.
packages/​learning/​src/​consolidators/​recurrence.mjs Accounts for duplicate evidence across migrated histories.
packages/​learning/​src/​config.mjs Resolves identities and manages migration and legacy maintenance.
packages/​learning/​src/​cli.mjs Exposes migration commands and scope options.
packages/​learning/​README.md Documents stable scopes, migration, and retained-copy risks.
packages/​learning/​index.d.mts Adds source-repository context and migration-related store options.
packages/​learning/​examples/​demo.mjs Seeds a cached identity for the standalone demo.
packages/​learning/​examples/​agent-memory-repo/​demo.mjs Uses numeric scopes in the publishing demo.
packages/​learning/​contracts/​v1/​collection.schema.json Clarifies matching historical collection retention.
hub/​server/​scripts/​seed-decision-model-walkthrough/​index.ts Uses persisted GitHub scope and shared command arguments.
hub/​server/​routes/​api/​learnings/​respond-learning-error/​index.ts Maps unavailable repository scopes to HTTP 409.
hub/​server/​routes/​api/​learnings/​create-learnings-route-dependencies/​index.ts Resolves and rechecks scopes around learning operations.
hub/​server/​repositories/​repository-access/​find-repository-github-id/​index.ts Adds the persisted GitHub ID lookup.
hub/​server/​repositories/​learning-runs/​list-due-learning-repositories/​index.ts Requires positive GitHub IDs during scheduled discovery.
hub/​server/​repositories/​learning-runs/​list-due-learning-repositories/​index.db.test.ts Gives scheduling evidence an ID-backed repository fixture.
hub/​server/​repositories/​learning-runs/​is-learning-run-repository-available/​index.ts Requires a positive GitHub ID when requested.
hub/​server/​integrations/​learning/​redact-legacy-review-comment/​index.ts Invokes restricted redaction for UUID-scoped stores.
hub/​server/​domains/​learning/​review-comment-learning-source/​types.ts Carries numeric scope and legacy snapshot digest metadata.
hub/​server/​domains/​learning/​reconcile-learning-decision-operation/​index.ts Uses migration-aware arguments during decision recovery.
hub/​server/​domains/​learning/​reconcile-learning-decision-operation/​index.test.ts Checks numeric and legacy recovery arguments.
hub/​server/​domains/​learning/​process-review-comment-redaction/​index.ts Selects ID-backed or legacy-only redaction.
hub/​server/​domains/​learning/​process-review-comment-redaction/​index.test.ts Covers legacy redaction, retries, and migrated mappings.
hub/​server/​domains/​learning/​process-learning-run/​index.ts Checks scope drift and accepts legacy queued-run digests.
hub/​server/​domains/​learning/​process-learning-run/​index.test.ts Covers migration arguments and scope changes during runs.
hub/​server/​domains/​learning/​prepare-learning-store/​index.ts Validates numeric scopes while retaining UUID storage directories.
hub/​server/​domains/​learning/​prepare-learning-store/​index.test.ts Updates store-preparation expectations for numeric scopes.
hub/​server/​domains/​learning/​learning-store-arguments/​index.ts Centralizes numeric and legacy CLI scope arguments.
hub/​server/​domains/​learning/​get-learning-repository-scope/​index.ts Resolves valid GitHub IDs or reports learning unavailability.
hub/​server/​domains/​learning/​get-learning-overview/​index.ts Reads the overview using the resolved numeric scope.
hub/​server/​domains/​learning/​get-learning-overview/​index.test.ts Verifies migration-aware overview arguments.
hub/​server/​domains/​learning/​execute-learning-decision/​index.ts Passes the resolved scope to decision commands.
hub/​server/​domains/​learning/​execute-learning-decision/​index.test.ts Checks numeric and legacy decision arguments.
hub/​server/​domains/​learning/​create-review-comment-learning-source/​index.ts Binds captured review evidence to a checked repository scope.
hub/​server/​domains/​learning/​create-review-comment-learning-source/​index.test.ts Covers missing IDs, large IDs, and capture-time scope drift.
hub/​server/​domains/​learning/​create-learning-job-processors/​index.ts Wires ID-based learning and legacy redaction into workers.
hub/​server/​domains/​learning/​create-learning-job-processors/​index.test.ts Covers redaction recovery and persisted-ID selection.
hub/​server/​domains/​learning/​create-hub-review-collection/​index.ts Adds numeric scope to review digests while preserving source identity.
hub/​server/​domains/​learning/​create-hub-review-collection/​index.test.ts Checks scope-sensitive and legacy digest behavior.
hub/​server/​domains/​decision-model/​create-hub-decision-taskset-source/​index.ts Uses ID-backed stores and scope-bound taskset evidence.
hub/​server/​domains/​decision-model/​create-hub-decision-taskset-source/​index.test.ts Covers ID-less rejection and migration-aware commands.
hub/​docs/​learning-foundation.md Explains Hub scope migration and legacy maintenance behavior.
docs/​adr/​0001-learning-extension-architecture.md Updates the identity model and migration rationale.

Review effort: Max (adaptive)

Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
nshki and others added 5 commits November 25, 2026 10:08
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
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