Skip to content
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
airtonix merged 2 commits into
mainfrom
fix/skill-agent-reset
Feb 13, 2026
Merged

fix(skill-injection): keep active agent when loading skills (#28)#30
airtonix merged 2 commits into
mainfrom
fix/skill-agent-reset

Conversation

@airtonix
Copy link
Copy Markdown
Contributor

Summary

Preserve the active agent when injecting skill prompts so OpenCode does
not fall back to the default agent.

Linked Artifact

Closes #28

Changes

  • pass toolCtx.agent into injected prompts in skill_use and
    skill_resource
  • update createInstructionInjector to include agent in
    session.prompt body
  • add OpenCodeChat.test.ts regression coverage for injected prompt
    agent propagation and noReply behavior
  • add issue analysis notes in .memory/issue-28-analysis-comment.md

Testing

  • Unit tests added/passing
  • Integration tests passing
  • Manual testing completed

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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 createInstructionInjector to require and use the agent parameter when sending prompts
  • Modified skill_use and skill_resource tool execution to pass toolCtx.agent to 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.
@airtonix airtonix merged commit d6b9b43 into main Feb 13, 2026
3 checks passed
@airtonix airtonix deleted the fix/skill-agent-reset branch February 13, 2026 05:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: skill loading resets agent to default one

2 participants