Skip to content

Fix token (and other secret) loss when saving channel config by correctly including edited secret fields in save payload#2123

Closed
lbriers wants to merge 2 commits intosipeed:mainfrom
lbriers:main
Closed

Fix token (and other secret) loss when saving channel config by correctly including edited secret fields in save payload#2123
lbriers wants to merge 2 commits intosipeed:mainfrom
lbriers:main

Conversation

@lbriers
Copy link
Copy Markdown

@lbriers lbriers commented Mar 28, 2026

📝 Description

When editing channel secrets (e.g., token) the secret could be dropped from the saved JSON if the edited secret field (_token) was empty or the plain secret key was missing from editConfig. This ensures secret fields are preserved — preferring non-empty edited values (e.g., _token) and falling back to existing plain values (e.g., token) — and makes buildSavePayload robust.

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

📚 Technical Context (Skip for Docs)

The previous implementation iterated editConfig and skipped underscore keys, then relied on encountering the plain secret key to copy or choose the edited secret. If the plain key was absent in editConfig, the secret could be omitted from payload, causing deletion on save. The new approach explicitly sets secret keys, avoiding accidental omission.

🧪 Test Environment

  • Hardware: RPI zero 2W
  • OS: RASPI OS lite
  • Model/Provider: Gemini
  • Channels: Telegram

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 28, 2026

CLA assistant check
All committers have signed the CLA.

@sipeed-bot sipeed-bot bot added type: bug Something isn't working domain: channel labels Mar 28, 2026
@lbriers
Copy link
Copy Markdown
Author

lbriers commented Mar 28, 2026

This caused issue: when inputting telegram channel token and pressing save, detected token field as being empty.

@yinwm
Copy link
Copy Markdown
Collaborator

yinwm commented Mar 29, 2026

Closing in favor of #2024 which includes the same frontend fix plus backend secret field mapping and regression tests. Thanks for the contribution!

@yinwm yinwm closed this Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: channel type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants