Skip to content

fix(ton-bridge): add fallback for missing customMessage in ton_bridge_custom_message#32

Merged
xlabtg merged 3 commits intoxlabtg:mainfrom
konard:issue-31-f90d4a0d8be9
Mar 23, 2026
Merged

fix(ton-bridge): add fallback for missing customMessage in ton_bridge_custom_message#32
xlabtg merged 3 commits intoxlabtg:mainfrom
konard:issue-31-f90d4a0d8be9

Conversation

@konard
Copy link

@konard konard commented Mar 23, 2026

Problem

ton_bridge_custom_message has customMessage listed as required in its JSON Schema parameters, but LLMs can and do call tools without providing required fields. When customMessage is omitted, params.customMessage is undefined, which gets passed directly to sdk.telegram.sendMessage(chatId, undefined, ...) — causing a crash.

Fix

Add a ?? fallback chain (per CONTRIBUTING.md guidelines — use ?? not ||) in the execute function:

const customMessage =
  params.customMessage ??
  sdk.pluginConfig?.customMessage ??
  "TON Bridge — The #1 Bridge in the TON Catalog\n\nClick the button below to open TON Bridge Mini App.";

This is consistent with how ton_bridge_open already handles params.message.

The fallback priority is:

  1. LLM-provided params.customMessage
  2. Operator-configured sdk.pluginConfig.customMessage
  3. Hardcoded default message

Tests

Added 2 new unit tests:

  • Falls back to sdk.pluginConfig.customMessage when param is missing
  • Falls back to hardcoded default when both param and config are missing

All 27 tests pass.

Closes #31

konard and others added 2 commits March 23, 2026 20:57
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: xlabtg#31
…_custom_message

When the LLM calls ton_bridge_custom_message without providing customMessage
(despite it being in the JSON Schema required array), params.customMessage is
undefined and gets passed directly to sdk.telegram.sendMessage, causing a crash.

Add a ?? fallback chain: params.customMessage ?? sdk.pluginConfig?.customMessage
?? hardcoded default, consistent with how ton_bridge_open handles params.message.

Closes xlabtg#31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] The problem is with the TON Bridge plugin fix(ton-bridge): add fallback for missing customMessage in ton_bridge_custom_message Mar 23, 2026
@konard konard marked this pull request as ready for review March 23, 2026 20:59
@konard
Copy link
Author

konard commented Mar 23, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.369192
  • Calculated by Anthropic: $0.405209 USD
  • Difference: $0.036017 (+9.76%)

🤖 Models used:

  • Tool: Claude
  • Requested: sonnet
  • Model: Claude Sonnet 4.6 (claude-sonnet-4-6)

📎 Log file uploaded as Gist (449KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Author

konard commented Mar 23, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@xlabtg xlabtg merged commit 277851e into xlabtg:main Mar 23, 2026
6 checks passed
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.

The problem is with the TON Bridge plugin

2 participants