Skip to content

fix(whatsapp): stop hardcoding the push name to "Moltis" - #1218

Merged
penso merged 3 commits into
moltis-org:mainfrom
vikng-dev:whatsapp-push-name
Aug 20, 2026
Merged

fix(whatsapp): stop hardcoding the push name to "Moltis"#1218
penso merged 3 commits into
moltis-org:mainfrom
vikng-dev:whatsapp-push-name

Conversation

@vikng-dev

Copy link
Copy Markdown
Contributor

The WhatsApp client asserted a hardcoded push name. That name rides the
presence stanza, so it is what shows to anyone who does not have the number
saved as a contact: a bot configured as "Ada" appears in group chats as
"Moltis".

The builder hook it used is not meant for this. Its own doc comment says the
value exists so a mock server can assign phone numbers deterministically
during multi-device testing.

Resolution order is now account override, then agent identity, then the old
constant:

[identity]
name = "Ada"

[channels.whatsapp.support]
push_name = "Support" # optional, overrides identity for this account

The account level exists because one instance can run several numbers.
Falling back to [identity] name means a configured bot is not called
something else on WhatsApp without anyone asking for it, and an instance
that sets neither is unchanged.

Blank values fall through rather than being honoured. An empty push name
makes send_presence refuse to send at all, so a stray name = "" would
otherwise disable presence silently.

Only the name this client sends changes. The account profile is untouched:
Client::set_push_name would rewrite it server side, and on a number paired
from a personal phone that would rename the owner's real WhatsApp profile.

with_os("Moltis") is left alone. That is the Linked Devices entry, where
naming the client software is correct.

🤖 Generated with Claude Code

@vikng-dev

Copy link
Copy Markdown
Contributor Author

Heads up for whoever merges: this and #1219 both insert a field into the same spot in crates/whatsapp/src/config.rs (right after group_allowlist), so whichever lands second will need a one-line textual rebase. They are independent otherwise.

@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR now resolves the WhatsApp push name from the account override, then the configured agent identity, and finally "Moltis".

  • Adds account-level push_name configuration and propagates the identity name into WhatsApp connection startup.
  • Treats blank names as unset to preserve presence behavior.
  • Documents the setting in both the generated configuration template and WhatsApp reference page.
  • Adds tests covering fallback resolution and template discoverability.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/whatsapp/src/connection.rs Implements the documented push-name precedence and blank-value fallback before constructing the WhatsApp client.
crates/whatsapp/src/config.rs Adds the optional account-level push_name configuration with a backward-compatible default.
crates/whatsapp/src/plugin.rs Carries the optional agent identity name from plugin construction into connection startup.
crates/gateway/src/server/init_channels.rs Supplies the configured identity name when initializing the WhatsApp plugin.
crates/config/src/template.rs Adds a valid WhatsApp account example that documents push_name and its fallback order.
docs/src/whatsapp.md Documents the account-level setting, its user-visible effect, and fallback behavior.
crates/config/src/loader/tests/core.rs Protects discoverability by asserting that generated configuration includes the new setting.

Reviews (3): Last reviewed commit: "docs(config): add WhatsApp push name to ..." | Re-trigger Greptile

Comment thread crates/whatsapp/src/config.rs
The WhatsApp client asserted a hardcoded push name. That name rides the
presence stanza, so it is what shows to anyone who does not have the number
saved as a contact: a bot configured as "Ada" appears in group chats as
"Moltis".

The builder hook it used is not meant for this. Its own doc comment says the
value exists so a mock server can assign phone numbers deterministically
during multi-device testing.

Resolution order is now account override, then agent identity, then the old
constant:

  [identity]
  name = "Ada"

  [channels.whatsapp.support]
  push_name = "Support"   # optional, overrides identity for this account

The account level exists because one instance can run several numbers.
Falling back to [identity] name means a configured bot is not called
something else on WhatsApp without anyone asking for it, and an instance
that sets neither is unchanged.

Blank values fall through rather than being honoured. An empty push name
makes send_presence refuse to send at all, so a stray name = "" would
otherwise disable presence silently.

Only the name this client sends changes. The account profile is untouched:
Client::set_push_name would rewrite it server side, and on a number paired
from a personal phone that would rename the owner's real WhatsApp profile.

with_os("Moltis") is left alone. That is the Linked Devices entry, where
naming the client software is correct.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vikng-dev

Copy link
Copy Markdown
Contributor Author

Thanks, the documentation half of this is right and is now fixed: docs/src/whatsapp.md gains a push_name row in the configuration reference table.

The crates/config/src/template.rs half does not apply here. That file carries no WhatsApp account block at all, only the channel name inside the offered array and a pointer line saying to see the docs or defaults.toml for full channel configuration examples. Its commented examples are Slack, Teams and Nostr. There is nothing to append the field to without inventing a whole [channels.whatsapp.<account>] example section, which is outside what this PR opened.

One clarification on the change itself, since the description could be read as promising more than it delivers: the resolved name is best-effort rather than sticky. history_sync.rs overwrites the stored push name with the server's own_pushname whenever a history sync carries one, and pair.rs sets it from business_name at pairing. The previous hardcoded "Moltis" was equally exposed to that, so this is not a regression, but the configured value can still be replaced at runtime by the server.

@vikng-dev

Copy link
Copy Markdown
Contributor Author

Updating the earlier merge-order note: this and #1219 now overlap in two files rather than one. Both insert a field after group_allowlist in crates/whatsapp/src/config.rs, and both append a row after otp_cooldown_secs in the configuration table in docs/src/whatsapp.md. Whichever lands second needs a two-hunk textual rebase, no semantic overlap. #1217 merges cleanly with both.

@penso

penso commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

@greptileai review

penso added 2 commits August 19, 2026 22:47
Expose the new account-level push_name setting in the generated configuration template and cover it with the existing template generation test.
@penso

penso commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

@greptileai review

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.

2 participants