You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(learning): add local learning mode with an MCP server and setup - #434
People prototyping alone need a way to turn their feedback into learnings without deploying Hub. This second of five stacked pull requests builds on the storage and scoring in #433.
What changes
replica-learning setup prepares local learning in a prototype checkout and writes a private MCP configuration. After restarting Copilot CLI with that configuration, an agent can get accepted guidance, submit conversations, and report which learnings it used. A person decides whether to share chats and whether to accept suggestions. Clients with form support show decisions in forms; other clients provide commands for the person to run.
Saved feedback is analyzed in the background. The canvas also passes completed Pick & Polish notes and confirmed replies to the learning server. The starter ignores .replica/, and the setup and canvas guides explain how to try the flow.
This layer now sits on the latest storage layer. That layer saves an applied update and its decision together, so the earlier recovery step for half-finished applies is gone.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical consent and privacy gaps allow screenshot sharing without an active grant, expose internal review details, and leave chat data at risk of being committed to Git.
Builds on #433’s storage and scoring foundation to let prototype users collect feedback and approve learnings locally, without Hub. Shared MCP tools prepare the same flow for future Hub integration.
Changes:
Add checkout setup, a private MCP configuration, and .replica/ ignore rules.
Provide guidance, session submission, usage reporting, human review forms, and background analysis.
Connect Pick & Polish notes, document onboarding, and add CLI coverage and public MCP types.
File
Description
starter/.gitignore
Ignore local learning data and configuration.
README.md
Introduce local learning and its privacy model.
packages/learning/test/cli.test.mjs
Cover MCP tools, forms, setup, activity, and background analysis.
packages/learning/src/setup.mjs
Prepare local storage and write the private MCP configuration.
packages/learning/src/mcp.mjs
Define shared learning tools, schemas, and agent instructions.
packages/learning/src/local-learning.mjs
Add background execution, logs, consent, and review forms.
packages/learning/src/cli.mjs
Integrate setup, MCP serving, and analysis activity recording.
packages/learning/README.md
Document local setup, tools, consent, and review.
packages/learning/package.json
Export the MCP module and declare optional dependencies.
packages/learning/package-lock.json
Lock the MCP SDK and supporting dependencies.
packages/learning/mcp.d.mts
Define the public MCP backend and screenshot types.
docs/README.md
Link the learning guide from the documentation index.
docs/prototype-repository-setup.md
Add local learning as an optional onboarding step.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical issues can overwrite linked files, write private chats into tracked stores, and leave learning updates partially applied without a reliable retry path.
Accept underscores in imported session author logins
packages/learning/src/cli.mjs:2158
A Pick & Polish note with a managed-user login such as jdoe_acme rejects the entire session, including its chat messages. The canvas accepts underscores, but sources/agent-sessions.mjs:19,184–187 still rejects them for original-note and reply authors. Align the importer with the supported login syntax and cover both author positions.
Show grant IDs and runnable withdrawal commands
packages/learning/src/local-learning.mjs:120
The consent form's stop command is not runnable after the documented setup: the CLI is not installed on PATH, and withdrawal requires a grant ID, purposes, and --by. The form also never gives the person the newly created chat or optional screenshot grant IDs. Provide store-specific commands to list those grants and withdraw their permitted purposes.
Show proposal context and evidence lookup before approval
packages/learning/src/local-learning.mjs:177
The form asks a person to approve guidance without showing its support, disagreement, rationale, or evidence references. It does not include the proposal ID either, so the person cannot look up that context from the form. Include the relevant review context and an evidence lookup path before confirmation, as show does in cli.mjs:1193–1225.
Do not accept original wording when supplied edits are blank
packages/learning/src/local-learning.mjs:290
Clearing the Wording field to an empty or whitespace-only string drops the edit and accepts the original wording instead. The recorded acceptance therefore differs from the text the person confirmed. Leave the suggestion undecided or ask again when explicitly supplied wording is blank.
Validate that screenshots specify exactly one source
packages/learning/src/mcp.mjs:60
This schema accepts screenshots with neither source or with both file and data, although McpScreenshot promises exactly one. A host backend therefore receives input that violates its declared type. Validate the exclusive choice in the shared schema before calling the backend.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical consent and data-integrity flaws can send commit diffs without permission, store conversations remotely despite local-only assurances, and lose messages during concurrent submissions.
Finding — medium: Run bounded-analysis follow-ups without relying on the MCP server. The detached launcher only relays the analysis exit code (packages/learning/src/local-learning.mjs:24-29), while follow-up runs start in the MCP server’s child-close handler (packages/learning/src/cli.mjs:2232-2250). If Copilot closes the server while a run has more work, the detached run survives and exits with the “more work” code, but no process starts the next batch; remaining feedback waits for another tool call or a manual run. Keep continuation in the detached worker or a persistent queue.
Verification: I found no failed Actions runs on either stacked branch; the latest Learning CI run is still in progress. My focused local run could not complete because @modelcontextprotocol/sdk is not installed.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The origin check accepts a different host with the same repository path, causing the server to reuse the previous GitHub scope and consent grants for guidance and chat storage.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical grant-handling defects can expose proposals outside the selected allowlist and suppress fresh consent when existing grants do not cover the submitted evidence.
Review found one issue: --max-requests can be exceeded by a single scoring operation. The cap is checked before score at packages/learning/src/cli.mjs:1829, but askBest() can send multiple requests (including a probe and fallback), and the CLI accounts for usage only after the operation. A run with a limit of 1 can therefore send more than one Copilot request. Enforce the remaining budget at each send, including fallback and failure paths.
CI note: the base branch’s latest Learning CI run passed. On this branch, Learning CI and Hub image smoke failed at npm ci with E401 (invalid registry authentication), before tests or the image build ran.
Return fixed safe summaries to agents while keeping original failures available to host diagnostics.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 459b160c-a7ab-4c14-8a06-098ca9096352
[P1] Enforce the remaining request budget at each send — packages/learning/src/cli.mjs:1839 checks the cap only before starting a score operation, then counts usage after it returns. askBest() can send multiple requests for one score, including an unbudgeted Auto probe and a fallback; a failed step is counted as only one request. A run can therefore exceed --max-requests.
Fixed in commit 837b53a: analysis now enforces the cap for every authorized model send, including fallback probes, and counts failed sends for both scoring and drafting. Added focused regression coverage. @copilot review
Fixed in commit 837b53a: analysis now enforces the cap for every authorized model send, including fallback probes, and counts failed sends for both scoring and drafting. Added focused regression cov...
No further findings in 837b53a. The focused evaluation, labeling, and update tests pass locally. Learning CI and Hub image smoke both stop at npm ci with E401, before their checks run, so the CLI integration path remains unverified.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The Auto probe can inherit an unintended schema and fail before the real request, while authorization failures during fallback can discard accumulated usage and underreport costs.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed to evaluate cross-cutting correctness risks in consent recovery, feedback freshness, labeling validation, and usage accounting.
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
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
People prototyping alone need a way to turn their feedback into learnings without deploying Hub. This second of five stacked pull requests builds on the storage and scoring in #433.
What changes
replica-learning setupprepares local learning in a prototype checkout and writes a private MCP configuration. After restarting Copilot CLI with that configuration, an agent can get accepted guidance, submit conversations, and report which learnings it used. A person decides whether to share chats and whether to accept suggestions. Clients with form support show decisions in forms; other clients provide commands for the person to run.Saved feedback is analyzed in the background. The canvas also passes completed Pick & Polish notes and confirmed replies to the learning server. The starter ignores
.replica/, and the setup and canvas guides explain how to try the flow.This layer now sits on the latest storage layer. That layer saves an applied update and its decision together, so the earlier recovery step for half-finished applies is gone.