fix(config): align channel config types with built-in registry#1289
fix(config): align channel config types with built-in registry#1289zhijianma merged 3 commits intoagentscope-ai:mainfrom
Conversation
Made-with: Cursor
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses inconsistencies in the channel configuration system by aligning channel configuration types and API handling with the built-in channel registry. It ensures that the OpenAPI schema is complete and that the configuration API correctly processes typed configurations for all built-in channels, improving overall system consistency and robustness. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aligns channel configuration types with the built-in registry by adding MatrixConfig to ChannelConfigUnion and handling mattermost, mqtt, and matrix channels in the configuration API. However, it introduces significant security risks as the configuration API endpoints lack authentication, allowing unauthorized modification of sensitive settings. Specifically, adding MatrixConfig to the public configuration union exposes sensitive access tokens in plain text. Additionally, the current implementation of channel handling logic in put_channel could be refactored to improve maintainability and reduce code repetition.
|
@JasonBuildAI |
Made-with: Cursor
Made-with: Cursor
|
Welcome to CoPaw! 🎉Thank you @JasonBuildAI for your first contribution! Your PR has been merged. 🚀 We'd love to give you a shout-out in our release notes! If you're comfortable sharing, please reply to this comment with your social media handles using the format below:
Thanks again for helping make CoPaw better! |
Summary
Align channel configuration types and API handling with the built-in channel registry.
Changes
MatrixConfigtoChannelConfigUnionso that the/config/channels/{channel_name}API and the generated OpenAPI schema correctly include thematrixbuilt-in channel.PUT /config/channels/{channel_name}to construct typed configs formattermost,mqtt, andmatrixchannels using their respective Pydantic models, consistent with existing handling for other built-in channels.Rationale
The built-in channel registry (
src/copaw/app/channels/registry.py) already declaresmattermost,mqtt, andmatrixas built-in channels, andChannelConfigincludes amatrix: MatrixConfigfield. However:ChannelConfigUnionomittedMatrixConfig, leading to an incomplete OpenAPI schemaThis PR makes the config schema and API behavior consistent across all built-in channels.
Testing
flake8,mypy,pylint)pre-commit run --all-files(pending full dev environment setup due tollama-cpp-pythonbuild requirements)pytest(pending full dev environment setup)Note: The changes are minimal and follow existing patterns exactly. The
MatrixConfigomission is a clear bug, and the added branches input_channelmirror the existing implementation fortelegram,dingtalk, etc. No functional behavior changes are expected.Backwards Compatibility
Fully backwards compatible:
Type of Change