This repository was archived by the owner on Feb 14, 2026. It is now read-only.
fix(skill-injection): keep active agent when loading skills (#28)#30
Merged
Conversation
Pass through the tool context agent when injecting skill and resource\nprompts so OpenCode does not fall back to the default agent.\n\nAlso add a regression test for createInstructionInjector and include\nissue analysis notes for issue #28.
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where skill loading would reset the active agent to the default one. The fix ensures that when skills are injected into the chat via silent prompts, the original agent context is preserved by explicitly passing the agent parameter from the ToolContext.
Changes:
- Updated
createInstructionInjectorto require and use theagentparameter when sending prompts - Modified
skill_useandskill_resourcetool execution to passtoolCtx.agentto injected prompts - Added unit test to verify agent preservation in silent prompt injection
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/lib/OpenCodeChat.ts | Added agent parameter to sendPrompt props and included it in the session prompt body |
| src/index.ts | Updated both skill_use and skill_resource tools to pass toolCtx.agent to sendPrompt calls |
| src/lib/OpenCodeChat.test.ts | Added regression test verifying that createInstructionInjector preserves the agent and sets noReply flag |
| .memory/issue-28-analysis-comment.md | Documentation of the issue analysis and proposed fix (non-code) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove .mise task scripts from the repository, including the watch task\nthat uses unsupported metadata in GitHub Actions' mise version.\n\nAlso drop pull_request_target from the PR workflow trigger to avoid\nrunning duplicate PR check workflows for the same branch update.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Preserve the active agent when injecting skill prompts so OpenCode does
not fall back to the default agent.
Linked Artifact
Closes #28
Changes
toolCtx.agentinto injected prompts inskill_useandskill_resourcecreateInstructionInjectorto includeagentinsession.promptbodyOpenCodeChat.test.tsregression coverage for injected promptagent propagation and
noReplybehavior.memory/issue-28-analysis-comment.mdTesting