Repository navigation
feat(hub): run repository learning loop - #263
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Storage permission or I/O errors can permanently mark comments as redacted without removing their learning-store text, leaving deleted evidence usable indefinitely.
19 open issues
Keep redaction pending on non-ENOENT store errors · New Declare review comment number unique in the Prisma model · New Exclude bookkeeping timestamps from the run snapshot digest · New Use the same canonical application origin in workers · New Guard refusal updates with connection ID and state generation · New Pass dash-leading decision reasons as option values · New Propagate store errors instead of returning an empty overview · New Resolve suggestion evidence from one batched repository snapshot · New Distinguish missing connections from credential refusals · New Record GitHub App token-minting failures as connection refusals · New Handle duplicate active-run requests without aborting the transaction · New Accumulate run progress across recovery attempts · New Map learning-lock contention to a retryable review conflict · New Allow UUID source IDs in TypeScript declarations · New Accept Entra usernames in learning actor validation · New Order Hub transitions by durable sequence, not timestamps · New Test migration redaction and run-state constraints from the exact base · New Move learning contracts and errors out of route modules · New Move active-repository lookup into a repository function · New
What changed in this PR
Connects Hub’s persisted review conversations to the learning package so administrators can run discovery, review evidence, and approve guidance for agent recall.
Changes:
- Adds Learnings overview, run, and decision APIs with administrator checks and security audits.
- Adds persisted runs, worker recovery, usage tracking, and deleted-comment redaction.
- Extends learning contracts for Hub UUID identities and resolution history.
| File | Description |
|---|---|
packages/learning/test/hub-source.test.mjs |
Covers UUID identities and resolution history. |
packages/learning/src/sources/hub-review-comments.mjs |
Imports Hub UUIDs and resolution transitions. |
packages/learning/README.md |
Documents stable Hub identities. |
packages/learning/contracts/v1/common.schema.json |
Allows UUID source identifiers. |
hub/test/fixtures/learning/fail-with-json.mjs |
Supplies failed-command progress output. |
hub/server/workers/configuration.ts |
Registers learning processors and recovery. |
hub/server/workers/configuration.test.ts |
Checks processor and schedule registration. |
hub/server/start-server-processes/index.ts |
Accepts Learnings dependencies. |
hub/server/run-api/index.ts |
Passes Learnings dependencies into the app. |
hub/server/routes/types.ts |
Adds Learnings route dependencies. |
hub/server/routes/index.ts |
Registers Learnings endpoints. |
hub/server/routes/api/security-audits/present-security-audit/index.ts |
Presents learning audit records. |
hub/server/routes/api/security-audits/present-security-audit/index.test.ts |
Covers learning audit presentation. |
hub/server/routes/api/product/create-product-route-dependencies/index.ts |
Connects deletion locks and redaction callbacks. |
hub/server/routes/api/learnings/types.ts |
Defines API records and dependencies. |
hub/server/routes/api/learnings/runs/post/index.ts |
Authorizes explicit run requests. |
hub/server/routes/api/learnings/respond-learning-error/index.ts |
Maps learning failures to HTTP responses. |
hub/server/routes/api/learnings/read-learning-session/index.ts |
Restores the current learning-session user. |
hub/server/routes/api/learnings/index.test.ts |
Covers overview, run, and decision routes. |
hub/server/routes/api/learnings/get/index.ts |
Returns the administrator overview. |
hub/server/routes/api/learnings/errors.ts |
Defines route-level learning errors. |
hub/server/routes/api/learnings/decision/post/index.ts |
Validates and authorizes learning decisions. |
hub/server/routes/api/learnings/create-learnings-route-dependencies/index.ts |
Composes storage, queues, authorization, and audits. |
hub/server/repositories/security-audits/parse-security-audit-event/types.ts |
Includes learning audit event types. |
hub/server/repositories/security-audits/parse-security-audit-event/index.ts |
Validates learning audit events. |
hub/server/repositories/security-audits/parse-security-audit-event/index.test.ts |
Covers learning audit validation. |
hub/server/repositories/security-audits/get-security-audit-data/index.ts |
Maps learning events to stored audits. |
hub/server/repositories/security-audits/create-security-audit/types.ts |
Defines decision and run audits. |
hub/server/repositories/review-comments/mark-review-comment-learning-redacted/index.ts |
Records completed comment redaction. |
hub/server/repositories/review-comments/list-deleted-review-comments/index.ts |
Finds pending comment redactions. |
hub/server/repositories/review-comments/create-review-comment-repository/index.ts |
Persists durable redaction markers on deletion. |
hub/server/repositories/learning-runs/update-learning-run-progress/index.ts |
Saves labeling progress and usage. |
hub/server/repositories/learning-runs/list-queued-learning-runs/index.ts |
Finds unfinished runs for recovery. |
hub/server/repositories/learning-runs/list-learning-runs/index.ts |
Returns recent runs and usage totals. |
hub/server/repositories/learning-runs/list-learning-runs/index.db.test.ts |
Covers history, usage, and active-run uniqueness. |
hub/server/repositories/learning-runs/get-learning-run/index.ts |
Loads run context and requester identity. |
hub/server/repositories/learning-runs/finish-learning-run/index.ts |
Persists terminal run results. |
hub/server/repositories/learning-runs/create-learning-run/index.ts |
Creates or attempts to reuse active runs. |
hub/server/repositories/learning-runs/claim-learning-run/index.ts |
Atomically claims queued runs. |
hub/server/repositories/learning-runs/claim-learning-run/index.test.ts |
Covers run-claim outcomes. |
hub/server/integrations/learning/run-learning-command/index.ts |
Preserves JSON results from failed commands. |
hub/server/integrations/learning/run-learning-command/index.test.ts |
Covers failed-command progress preservation. |
hub/server/integrations/learning/run-learning-command/errors.ts |
Carries partial command results. |
hub/server/integrations/bullmq/enqueue-recoverable-job/index.ts |
Re-enqueues retained terminal jobs. |
hub/server/integrations/bullmq/enqueue-recoverable-job/index.test.ts |
Covers recoverable job deduplication. |
hub/server/index.ts |
Wires Learnings into runtime composition. |
hub/server/index.test.ts |
Covers Learnings runtime wiring. |
hub/server/domains/review-comments/review-comments.db.test.ts |
Checks redaction markers and stable actors. |
hub/server/domains/review-comments/create-review-comment-service/index.ts |
Adds deletion locking and callbacks. |
hub/server/domains/learning/review-comment-learning-source/types.ts |
Defines snapshot and evidence-source contracts. |
hub/server/domains/learning/process-review-comment-redaction/index.ts |
Runs locked package redaction. |
hub/server/domains/learning/process-review-comment-redaction/index.test.ts |
Covers redaction processing. |
hub/server/domains/learning/process-learning-run/index.ts |
Orchestrates import, labeling, and consolidation. |
hub/server/domains/learning/process-learning-run/index.test.ts |
Covers processing, recovery, and failure progress. |
hub/server/domains/learning/jobs/redact-review-comment.ts |
Defines redaction jobs and retries. |
hub/server/domains/learning/jobs/recover-learning-runs.ts |
Defines the recovery sweep job. |
hub/server/domains/learning/jobs/learning-run.ts |
Defines explicit run jobs and retries. |
hub/server/domains/learning/get-learning-overview/index.ts |
Builds suggestions, accepted guidance, and recall previews. |
hub/server/domains/learning/get-learning-overview/index.test.ts |
Covers exact evidence resolution. |
hub/server/domains/learning/execute-learning-decision/index.ts |
Invokes package decision commands. |
hub/server/domains/learning/create-review-comment-learning-source/index.ts |
Captures snapshots and resolves evidence. |
hub/server/domains/learning/create-review-comment-learning-source/index.test.ts |
Covers evidence-source matching. |
hub/server/domains/learning/create-learning-job-processors/index.ts |
Composes run, recovery, and redaction processors. |
hub/server/domains/learning/create-hub-review-collection/index.ts |
Converts snapshots into import collections and digests. |
hub/server/domains/learning/create-hub-review-collection/index.test.ts |
Covers collection conversion and digest stability. |
hub/server/create-app/index.ts |
Wires routes and endpoint-specific JSON parsing. |
hub/schema/user.prisma |
Relates users to requested runs. |
hub/schema/review-comment.prisma |
Adds durable redaction bookkeeping. |
hub/schema/repository.prisma |
Relates repositories to learning runs. |
hub/schema/migrations/20261113190000_learning_run_foundation/migration.sql |
Creates run storage, constraints, and redaction fields. |
hub/schema/membership.prisma |
Relates memberships to requested runs. |
hub/schema/learning-run.prisma |
Models run state, progress, and usage. |
hub/schema/learning-run-state.enum.prisma |
Defines persisted run states. |
hub/docs/learning-foundation.md |
Documents learning APIs and processing flows. |
hub/docs/frontend.md |
Updates Learnings backend integration status. |
hub/docs/background-jobs.md |
Documents learning processors and recovery. |
hub/docs/architecture.md |
Updates learning integration architecture. |
Review effort: Max (adaptive)
alliscode
force-pushed
the
alliscode-learnings-backend-apis
branch
from
November 16, 2026 21:38
6592467 to
e2b3796
Compare
nshki
approved these changes
Nov 17, 2026
Base automatically changed from
alliscode-review-comments-backend
to
build/hub/new
November 17, 2026 00:55
alliscode
force-pushed
the
alliscode-learnings-backend-apis
branch
from
November 17, 2026 02:02
e2b3796 to
6f77176
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
alliscode
force-pushed
the
alliscode-learnings-backend-apis
branch
from
November 17, 2026 02:07
6f77176 to
3cabb41
Compare
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.



Why
Hub can now store repository review conversations, but the Learnings page still needs a backend that turns that evidence into guidance people can review and agents can recall. This upper layer builds on #262 so repository administrators can run that loop without copying comments or prompts between systems.
What changes
The repository Learnings APIs now return exact review evidence, accepted guidance, recall previews, recent runs, and Copilot usage. Administrators can accept, edit, reject, or retire suggestions against the version they reviewed.
An explicit run captures one complete repository review snapshot, imports it into the private learning store, labels bounded batches with Copilot, and consolidates recurring feedback into suggestions. Hub persists progress, usage, and visible failures, and workers recover queued or interrupted work without duplicating active jobs.
Deleting a review comment is serialized with learning mutations. Hub queues durable redaction work, recovers missed jobs, and imports later snapshots with deletion redaction so removed comment text cannot remain eligible evidence.