Repository navigation
fix(canvas): skip learnings hook without Hub connection - #327
Merged
Merged
Conversation
Register the prompt hook only when the startup repository already has a Hub origin, preserving learnings where they can be used without prompting in unrelated directories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0ca06a2-d2d5-4dde-967f-970c6fcec0aa
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The no-origin tests do not isolate REPLICA_HUB_ORIGIN, causing assertions to fail when the documented development override is set in the invoking shell.
1 open issue
What changed in this PR
This PR avoids unnecessary Copilot CLI permission prompts by registering the learnings hook only when the startup repository has a saved Hub selection or configured Hub URL. The prototype canvas remains available without the hook.
Changes:
- Share Hub-origin resolution between startup checks and prompt recall.
- Add tests for disconnected startup, configured origins, and invalid saved origins.
- Document next-session activation and bump the plugin to
1.5.7.
| File | Description |
|---|---|
.github/extensions/replica-prototype/register-prototype-canvas/index.test.mjs |
Tests canvas registration without the learnings hook. |
.github/extensions/replica-prototype/register-prototype-canvas/index.mts |
Conditionally registers the hook at startup. |
.github/extensions/replica-prototype/register-prototype-canvas/index.mjs |
Mirrors conditional registration in the runtime module. |
.github/extensions/replica-prototype/README.md |
Explains startup gating and next-session activation. |
.github/extensions/replica-prototype/plugin.json |
Bumps the plugin version to 1.5.7. |
.github/extensions/replica-prototype/create-learnings-hook/index.test.mjs |
Tests Hub-origin detection and invalid saved data. |
.github/extensions/replica-prototype/create-learnings-hook/index.mts |
Extracts shared resolution and adds the startup check. |
.github/extensions/replica-prototype/create-learnings-hook/index.mjs |
Mirrors resolution and detection in the runtime module. |
Review effort: Balanced (adaptive)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0ca06a2-d2d5-4dde-967f-970c6fcec0aa
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
Copilot CLI asks for elevated permission when the Replica extension registers its learnings prompt hook, even in repositories that are not connected to Hub. That makes starting a session in unrelated directories noisy.
What changes
Register the learnings hook only when the startup repository already has a saved Hub selection or configured Hub URL. The canvas remains available without the hook, and connecting a repository mid-session enables learnings the next time Copilot starts.
The local complete Hub suite could not finish because the devcontainer could not reach the npm registry; that check remains for CI.