mx_set_displayname: client-level profile rename with relogin - #11
Merged
Merged
Conversation
Client-level wrapper over mx.api::mx_set_displayname(): builds the session from the client config and retries once through mx_with_relogin() on a rejected token, so long-running bots can rename themselves without hand-rolling session or relogin plumbing. Extracted from corteza's Matrix model badge (corteza#155) per review: the badge policy stays in corteza, the reusable Matrix primitive lives here. Bump version to 0.1.1.1.
user9208212
added a commit
to cornball-ai/corteza
that referenced
this pull request
Jul 12, 2026
Per review: keep the badge policy (mode, session-vs-default comparison, reply stamping) in corteza, but do the profile update through mx.client's new client-level mx_set_displayname() instead of calling mx.api directly. That routes the rename through mx_with_relogin(), so a rotated token gets refreshed and retried instead of silently failing the rename on a long-running bot. matrix_update_displayname no longer needs the mx_sess argument. Requires mx.client >= 0.1.1.1 (cornball-ai/mx.client#11).
user9208212
added a commit
to cornball-ai/corteza
that referenced
this pull request
Jul 12, 2026
CRAN has mx.client 0.1.1, so the Suggests floor added for mx_set_displayname() is unsatisfiable there; install from GitHub like llm.api until the next mx.client CRAN release. CI on this PR stays red until cornball-ai/mx.client#11 lands on main.
Version and NEWS only. The branch predates three bumps and claimed 0.1.1.1, which PR #13 took; renumbered to 0.1.1.4.
TroyHernandez
added a commit
that referenced
this pull request
Aug 3, 2026
Fills the 0.1.1.4 NEWS gap now that #11 has landed.
TroyHernandez
added a commit
to cornball-ai/corteza
that referenced
this pull request
Aug 4, 2026
* Opt-in Matrix model badge: replies and sender line name the model New matrix_configure(model_badge =) key: "never" (default, unchanged behavior), "non_default", or "always". When a badge applies, deterministic post-turn code — not the model — prepends a "<bolt> <model> (<provider>)" first line to each reply and renames the bot to "<name> <bolt> <model>", so a room session that /model-switched to a paid provider is visible on every message and in the sender line. In non_default mode silence means the configured default: the badge appears only while a switch is live and disappears on /clear or a process restart (both reset the profile name). Sessions stamp their creation-time model/provider as the comparison baseline. display_name optionally sets the base name (default: user-id localpart). Bump version to 0.7.0.5. * Badge rename via mx.client::mx_set_displayname (review follow-up) Per review: keep the badge policy (mode, session-vs-default comparison, reply stamping) in corteza, but do the profile update through mx.client's new client-level mx_set_displayname() instead of calling mx.api directly. That routes the rename through mx_with_relogin(), so a rotated token gets refreshed and retried instead of silently failing the rename on a long-running bot. matrix_update_displayname no longer needs the mx_sess argument. Requires mx.client >= 0.1.1.1 (cornball-ai/mx.client#11). * Remotes: cornball-ai/mx.client (dev floor 0.1.1.1 not on CRAN yet) CRAN has mx.client 0.1.1, so the Suggests floor added for mx_set_displayname() is unsatisfiable there; install from GitHub like llm.api until the next mx.client CRAN release. CI on this PR stays red until cornball-ai/mx.client#11 lands on main. --------- Co-authored-by: Troy Hernandez <troy@cornball.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
mx_set_displayname(client, name, save = TRUE)— the display-name client helper discussed for corteza#155: wrapsmx.api::mx_set_displayname(), builds the session from the client config, and goes throughmx_with_relogin()so a rotated token gets one refresh-and-retry instead of a silent failure. Validatesnameas a single non-empty string; returns TRUE invisibly.Lives in a new
R/profile.R(first of the profile endpoints at the client level). Tests followtest_relogin.R's pattern (signature + validation; the relogin path itself is already covered by themx_with_relogintests). Verified live against the cornball.ai homeserver.Naming
Kept
mx_set_displayname(your first suggestion) — it does shadowmx.api::mx_set_displaynamewhen both are attached, though all package code calls via::. Happy to rename tomx_profile_set_displaynameif you'd rather avoid the collision.Context
Extracted from corteza#155 per your review: corteza keeps the badge policy ("should this session wear a model badge?") and reply stamping, and calls this for the profile update. corteza#155 gets reworked on top of this once it lands.
🤖 Generated with Claude Code