Skip to content

fix: owner_id was stored as string when recovered from settings on restart#2561

Merged
henrypark133 merged 3 commits intonearai:stagingfrom
gagdiez:fix/telegram-owner-id-type
Apr 17, 2026
Merged

fix: owner_id was stored as string when recovered from settings on restart#2561
henrypark133 merged 3 commits intonearai:stagingfrom
gagdiez:fix/telegram-owner-id-type

Conversation

@gagdiez
Copy link
Copy Markdown
Contributor

@gagdiez gagdiez commented Apr 17, 2026

Summary

  • Telegram channel stopped working on staging
  • The issue is that we correctly store the owner-id (after pairing) as u64, but then recover it as a string, and that makes the channel unable to start:
00: 45:07.702 ERROR Failed to start channel telegram: Channel telegram failed to start: Channel telegram callback failed: Failed to parse config: invalid type: string "176326495", expected 164 at line 1 column 47
  • This PR fixes this by correctly casting the stored value as u64 using an already existing function
  • Regression test added

Change Type

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • CI/Infrastructure
  • Security
  • Dependencies

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all --benches --tests --examples --all-features -- -D warnings
  • cargo build
  • Relevant tests pass:
  • cargo test --features integration if database-backed or integration behavior changed
  • Manual testing: I discovered this because my telegram stopped working, this fixes it
  • If a coding agent was used and supports it, review-pr or pr-shepherd --fix was run before requesting review

Security Impact

None

Database Impact

None

Blast Radius

Fixes telegram channel


Review track: A (small fix)

…start

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gagdiez gagdiez requested review from Copilot and serrrfirat April 17, 2026 01:24
@github-actions github-actions bot added scope: channel/wasm WASM channel runtime size: S 10-49 changed lines labels Apr 17, 2026
@gagdiez gagdiez requested a review from henrypark133 April 17, 2026 01:24
@github-actions github-actions bot added risk: medium Business logic, config, or moderate-risk modules contributor: regular 2-5 merged PRs labels Apr 17, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the register_channel function in src/channels/wasm/setup.rs to attempt parsing the owner_id as an integer before defaulting to a string representation in the configuration updates. The test suite has been updated to reflect this change by asserting the owner_id as a numeric value. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a WASM channel startup failure caused by injecting owner_id into channel runtime config as a JSON string instead of a JSON number (notably impacting Telegram after restart when owner_id is recovered from settings).

Changes:

  • Coerce owner_id into a numeric serde_json::Value when the resolved owner ID is parseable as an integer; otherwise keep it as a string.
  • Update the affected test assertion to expect a numeric JSON value for owner_id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/channels/wasm/setup.rs Outdated
Comment thread src/channels/wasm/setup.rs Outdated
Guillermo Alejandro Gallardo Diez and others added 2 commits April 17, 2026 03:31
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added size: M 50-199 changed lines and removed size: S 10-49 changed lines labels Apr 17, 2026
@gagdiez
Copy link
Copy Markdown
Contributor Author

gagdiez commented Apr 17, 2026

fixes an elusive bug introduced in #2515

cc @henrypark133

@henrypark133
Copy link
Copy Markdown
Collaborator

Thank you so much for catching/fixing this! Really appreciate it

Copy link
Copy Markdown
Collaborator

@henrypark133 henrypark133 left a comment

Choose a reason for hiding this comment

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

Review: telegram owner_id recovery fix looks sound

I verified the checked-out change in src/channels/wasm/setup.rs:227: runtime config now goes through build_runtime_config_updates(...), so a recovered numeric owner_id stays a JSON number instead of being stringified on restart. The added regression test covers the settings-recovery case that broke Telegram startup.

Residual risk: I did not rerun the full WASM/channel suite in this pass; review here is based on code inspection plus the focused regression coverage in the diff.

@henrypark133 henrypark133 merged commit fe5cdce into nearai:staging Apr 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: regular 2-5 merged PRs risk: medium Business logic, config, or moderate-risk modules scope: channel/wasm WASM channel runtime size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants