fix(telegram): resolve env SecretRef token for status path#34297
fix(telegram): resolve env SecretRef token for status path#342977inspire wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes an issue where Changes:
Minor gap: The per-account Confidence Score: 4/5
Last reviewed commit: 6d2ce35 |
Additional Comments (1)
The PR description states the fix was applied to both Consider adding a test analogous to the top-level one: it("resolves per-account env SecretRef object when env var is available", () => {
vi.stubEnv("WORK_TELEGRAM_TOKEN", "resolved-account-from-env");
const cfg = {
channels: {
telegram: {
accounts: {
work: { botToken: { source: "env", provider: "default", id: "WORK_TELEGRAM_TOKEN" } },
},
},
},
} as unknown as OpenClawConfig;
const res = resolveTelegramToken(cfg, { accountId: "work" });
expect(res.token).toBe("resolved-account-from-env");
expect(res.source).toBe("config");
});This would confirm the fix works end-to-end for the multi-account configuration that is also called out in the PR description. |
Summary
Fixes #34292.
openclaw statuscould fail with:channels.telegram.botToken: unresolved SecretRef "env:default:TELEGRAM_BOT_TOKEN"even when Telegram was healthy and
doctorreported OK.Root cause: Telegram token resolution in this path treated env
SecretRefas unresolved instead of resolving from process env.What changed
SecretRefvalues (source=env,provider=default) by readingprocess.env[ref.id].channels.telegram.botTokenchannels.telegram.accounts.<id>.botTokenFiles
src/telegram/token.tssrc/telegram/token.test.tsTests
Added/updated tests to cover:
SecretReftoken resolves correctly when env variable is presentRisk
Low, small scope: