Repository navigation
feat(canvas): give agents the learnings a repository accepted - #11
Merged
Merged
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Consent and prompt-context delivery cross security boundaries, and GitHub-backed cross-account authorization remains unverified.
2 open findings
What changed in this PR
Adds repository-approved learnings to Copilot sessions through existing Hub connections, without sending prompts to Hub.
Changes:
- Adds consent-gated, rate-limited learning recall.
- Registers a prompt hook with response validation and session-context replacement.
- Updates approval disclosures, persistence, tests, and guides.
| File | Description |
|---|---|
hub/test/integration/canvas_pairings_test.rb |
Tests versioned consent and older approvals. |
hub/test/integration/canvas_learning_recall_test.rb |
Tests recall access, auditing, limits, and timeouts. |
hub/test/fixtures/files/slow-replica-learning.mjs |
Simulates delayed recall and lingering output. |
hub/test/fixtures/files/learning.txt |
Supplies accepted learning text. |
hub/docs/security.md |
Documents recall request limits. |
hub/docs/security-rate-limits.md |
Defines the per-connection recall budget. |
hub/docs/prototype-canvas.md |
Documents recall delivery and validation. |
hub/docs/learnings.md |
Explains agent access to accepted learnings. |
hub/docs/authentication-and-repository-authorization.md |
Explains learning consent during approval. |
hub/db/schema.rb |
Records consent fields and constraint. |
hub/db/migrate/20261013120000_add_learnings_consent_to_canvas_connections.rb |
Adds consent persistence. |
hub/config/routes.rb |
Routes learning recall requests. |
hub/config/locales/canvas_pairings.en.yml |
Adds the learning disclosure. |
hub/app/views/canvas_pairings/show.json.props |
Exposes the disclosure version. |
hub/app/models/canvas_pairing.rb |
Records consent and transfers it to grants. |
hub/app/models/canvas_grant.rb |
Updates schema annotations for consent. |
hub/app/javascript/pages/canvas-pairings-page/types.ts |
Types the disclosure version. |
hub/app/javascript/pages/canvas-pairings-page/stories.tsx |
Updates approval story data. |
hub/app/javascript/pages/canvas-pairings-page/index.tsx |
Submits the disclosure version. |
hub/app/javascript/pages/canvas-pairings-page/index.test.tsx |
Tests disclosure display and submission. |
hub/app/controllers/concerns/security_rate_limiting.rb |
Adds the recall budget. |
hub/app/controllers/canvas_pairings_controller.rb |
Passes the submitted consent version. |
hub/app/controllers/canvas_api/learning_recalls_controller.rb |
Serves consent-gated recall responses. |
hub/app/controllers/canvas_api/base_controller.rb |
Makes permission freshness overridable. |
.github/extensions/replica-prototype/register-prototype-canvas/index.test.mjs |
Tests prompt-hook registration and delivery. |
.github/extensions/replica-prototype/register-prototype-canvas/index.mjs |
Registers the learning hook. |
.github/extensions/replica-prototype/recall-learnings/index.test.mjs |
Tests validation and session delivery behavior. |
.github/extensions/replica-prototype/recall-learnings/index.mjs |
Validates and replaces learning context. |
.github/extensions/replica-prototype/README.md |
Explains delivery and CLI requirements. |
.github/extensions/replica-prototype/hub-client/index.mjs |
Adds recall requests and background renewal. |
🧠 Review effort: Max
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: a0fec4de-471b-4b6e-8d1c-0317e17aea5a
Co-authored-by: Copilot App <[email protected]> Copilot-Session: a0fec4de-471b-4b6e-8d1c-0317e17aea5a
nshki
approved these changes
Oct 16, 2026
nshki
left a comment
Contributor
There was a problem hiding this comment.
Thanks @alliscode! Appreciate you and @thegovind working on the learning loop features here. I believe this closes the core loop.
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
Agents working in a repository should have the guidance its administrators accepted in Hub, without someone repeating those decisions in every session. This change gives agents that context through an approved Hub connection, without sending the person's prompt to Hub.
What changes
When someone submits a prompt, the Replica plugin asks Hub for the repository's accepted learnings and adds them as session context. Hub checks the connection's consent and the person's cached repository read permission. The learning store records the recall as a use by that person.
The connection approval page now explains that Copilot can add accepted learnings to prompts. Hub records consent only when someone approves the current disclosure. Existing connections and older approval forms still connect without learnings; those users must disconnect and connect again to enable them.
The new
POST /api/canvas/learnings/recallendpoint returns the learning text, IDs, and content digests, which identify changes to the wording. The plugin accepts only the bounded format produced byreplica-learning, including its safety guidance that learnings are data, not commands. The first successful response replaces earlier learning context, including after a restart or session resume. Later unchanged responses add nothing; changed or empty responses replace earlier guidance. Turning Learnings off explicitly clears it.The hook uses an existing connection and saved Hub selection; submitting a prompt never starts pairing or Hub discovery. Token renewal happens in the background for a later prompt. Hub limits each connection to 30 recalls per minute and stops slow recalls early enough for the plugin's three-second deadline. Errors, invalid responses, and timeouts add no context and never fail the prompt; older responses cannot overwrite a newer one.
Copilot CLI 1.0.96 requires
--experimentalor/experimental onfor extensions. Loading a repository's project copy in prompt mode (copilot -p) also requiresGITHUB_COPILOT_PROMPT_MODE_EXTENSIONS=true. Its ACP server does not load these hooks, so ACP clients do not receive learnings through this plugin.The live integration check uses an isolated local-mode Hub and synthetic data; GitHub-backed OAuth and cross-account authorization remain unverified by that check. Its off/restore case exercises Hub's
learnings_offresponse, not disconnecting a real Copilot account.