Skip to content

chore(support-bot): rewrite with opencode and remote GitHub MCP - #2182

Open
KavithaSiva wants to merge 20 commits into
chore/support-bot-github-toolsfrom
chore/support-bot-opencode
Open

chore(support-bot): rewrite with opencode and remote GitHub MCP#2182
KavithaSiva wants to merge 20 commits into
chore/support-bot-github-toolsfrom
chore/support-bot-opencode

Conversation

@KavithaSiva

@KavithaSiva KavithaSiva commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Context

Rewrites the support bot workflow with opencode
Also moves the license from cloud sdk repo to in-house.

@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Chore: Rewrite Support Bot with OpenCode and Remote GitHub MCP

What this PR does and why it is needed

This PR rewrites the support bot by migrating from a custom agent implementation to OpenCode with a remote GitHub MCP integration.

Key changes

Removed files:

  • agent.ts — custom agent scaffolding removed
  • github-tools.ts — custom GitHub tool wrappers removed

Added files:

  • opencode.json — OpenCode configuration defining:
    • SAP AI Core as the LLM provider
    • Remote GitHub MCP (via api.githubcopilot.com/mcp/readonly) for repo, issues, and code search
    • Remote Context7 MCP for documentation search
  • package.json — standalone package definition for the support-bot module with @opencode-ai/sdk and opencode-ai as dependencies

Modified files:

  • reply.ts — The agent logic (previously in agent.ts) has been merged directly into reply.ts. The implementation now uses @opencode-ai/sdk with a multi-pass prompting strategy:

    1. Draft pass — full tool-calling loop (docs search, issue search, code lookup)
    2. Self-verify pass — model re-checks factual claims against source
    3. Final answer pass — extracts the verified, clean answer
    • Includes a completeness check ensuring the ## Related Issues section is always present
    • Detailed system prompt with security constraints, required tool-call strategy, and answer rules
  • issue-reply.yml — Updated workflow to:

    • Add a dedicated pnpm install step for the support-bot package
    • Update the working directory to ./sample-code/src/support-bot
    • Simplify the run command from pnpm exec node src/support-bot/reply.ts to node reply.ts

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.29.33

  • Correlation ID: 0f0f85a0-9cc2-11f1-9362-a3500d1cdb4f
  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Repository PR Template
  • Summary Prompt: Default Prompt
  • Event Trigger: pull_request.opened

Comment thread sample-code/src/support-bot/opencode.json
"github": {
"type": "remote",
"url": "https://api.githubcopilot.com/mcp/readonly",
"headers": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[q] I wonder if some MCP proxy/gateway would make sense here to further filter any tool calls, even though the risk is lower with slack-only.
Either way, I assume opencode has shell access so either way hard to secure without a real (container-based or likewise) sandbox.
But it might still be able smuggle the AI core credentials if it wants to, https://github.com/SAP/ai-sdk-js-backlog/issues/583 would reduce the risk a bit here, I assume AI core will get IAS soon?

@KavithaSiva KavithaSiva Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. I have added "permission": { "bash": "deny" } to opencode.json to close the most direct exfiltration channel. The bot doesn't need shell access, it only uses context7 and GitHub MCP tools.

  2. The GitHub MCP endpoint is /readonly, which limits write channels.

  3. Output is Slack-only, so blast radius is limited.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not sure about the timeline of AI Core with IAS.

Comment thread sample-code/src/support-bot/reply.ts Outdated
@@ -39,7 +265,6 @@ function extractErrorMessages(body: string): string[] {
}

function stripBoilerplate(body: string): string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume opencode has native ways to handle large inputs, consider providing the issue and so on as files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Opencode has a way to provide files as attachments, but I would prefer to do this in a follow-up.

Comment thread .github/workflows/issue-reply.yml Outdated
'- github__search_issues — search GitHub issues (pass keywords only; repo scope is automatic)',
'- github__get_issue — fetch full body of a specific issue by number',
'- github__search_code — search code examples (pass keywords only; repo scope is automatic)',
'',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[pp] Also tell the model to look at the local checkout?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can be improved in a follow-up.

Comment thread sample-code/src/support-bot/reply.ts Outdated
Comment thread sample-code/src/support-bot/reply.ts Outdated
Comment thread sample-code/src/support-bot/reply.ts Outdated
Comment thread sample-code/src/support-bot/reply.ts Outdated

@davidkna-sap davidkna-sap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread package.json Outdated
@KavithaSiva

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants