Skip to content

fix(gateway): refresh Telegram setup replay config#832

Merged
artemgetmann merged 2 commits into
mainfrom
codex/fix-telegram-setup-replay-config-refresh
May 31, 2026
Merged

fix(gateway): refresh Telegram setup replay config#832
artemgetmann merged 2 commits into
mainfrom
codex/fix-telegram-setup-replay-config-refresh

Conversation

@artemgetmann
Copy link
Copy Markdown
Owner

Review Fast Path

  • User path fixed: Jarvis Consumer Telegram onboarding Verify Telegram sees a bot token saved after gateway startup.
  • Proof: pnpm exec vitest run src/gateway/server.channels.test.ts --testNamePattern "setup-replay"; pnpm exec vitest run src/gateway/server.channels.test.ts; pnpm exec vitest run src/config/io.runtime-snapshot-write.test.ts; pnpm exec oxfmt --check src/gateway/server-methods/channels.ts src/gateway/server.channels.test.ts; git diff --check.
  • Shared-state footgun removed: setup replay no longer trusts the stale gateway runtime config snapshot for the just-written Telegram token.
  • Still hurts: not packaged or relaunched; RC app live proof belongs to the packaging worker.

Why This Matters

  • The RC gateway can start before onboarding writes channels.telegram.botToken and channels.telegram.accounts.default.botToken.
  • channels.telegram.setup-replay was reading exported loadConfig(), which returns runtimeConfigSnapshot first.
  • That made Verify Telegram report Telegram bot token is not configured. even when the config file had the token.

Scope Boundary

  • Changed only the setup replay verification path to read the current config file via existing config IO.
  • Added a regression test for stale runtime snapshot plus later token write.
  • Did not alter token logging, packaging, launchd ownership, /Applications/Jarvis.app, /Applications/Jarvis Consumer.app, or shared ai.openclaw.gateway.

Summary

  • Problem: Verify Telegram could read stale startup config and miss a token saved during onboarding.
  • Why it matters: users get blocked after entering a valid Telegram bot token.
  • What changed: setup replay now loads fresh current config before resolving the Telegram account/token.
  • What did NOT change (scope boundary): no packaging/relaunch/runtime ownership changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Related: Jarvis Consumer Telegram onboarding RC regression

User-visible / Behavior Changes

Verify Telegram can proceed when the token is present in the current config file but absent from the gateway startup runtime snapshot.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS local dev lane
  • Runtime/container: temp worktree .worktrees/fix-telegram-setup-replay-config-refresh-20260531
  • Model/provider: N/A
  • Integration/channel (if any): Telegram setup replay
  • Relevant config (redacted): channels.telegram.botToken and channels.telegram.accounts.default.botToken present after startup

Steps

  1. Initialize runtime config snapshot without Telegram token.
  2. Write Telegram token to config file after snapshot initialization.
  3. Call channels.telegram.setup-replay.

Expected

  • Setup replay resolves the freshly written token and reaches replay handling.

Actual

  • Before this fix, setup replay read runtimeConfigSnapshot and reported Telegram bot token is not configured.
  • After this fix, regression test reaches replay handling and does not return the missing-token error.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: missing token still reports missing; valid token reaches replay; disabled Telegram still reports disabled; stale runtime snapshot plus later token write reaches replay.
  • Edge cases checked: runtime snapshot write behavior suite still passes.
  • What you did not verify: packaged RC app, live Telegram bot, launchd restart, or UI smoke.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps: N/A

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert commit 8238ade54a8ae7da863aaa0bb9326def5285d5f0.
  • Files/config to restore: src/gateway/server-methods/channels.ts, src/gateway/server.channels.test.ts.
  • Known bad symptoms reviewers should watch for: Verify Telegram returning stale config state or setup replay failing before bot replay starts.

Risks and Mitigations

  • Risk: setup replay now rereads config from disk and could surface current config validation errors.
    • Mitigation: scoped to onboarding verification; uses existing config IO and existing validation behavior.

AI Assistance

  • AI-assisted
  • Testing degree: targeted

- What: read the current config file for Telegram setup replay instead of the gateway runtime snapshot.
- Why: Jarvis Consumer can save the Telegram token after gateway startup, leaving the runtime snapshot stale.
- Risk: low; scoped to setup replay verification and preserves token secrecy.
@artemgetmann artemgetmann marked this pull request as ready for review May 31, 2026 11:10
@artemgetmann artemgetmann merged commit bac9cc0 into main May 31, 2026
4 of 9 checks passed
@artemgetmann artemgetmann deleted the codex/fix-telegram-setup-replay-config-refresh branch May 31, 2026 11:40
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.

1 participant