Skip to content

mx_set_displayname: client-level profile rename with relogin - #11

Merged
TroyHernandez merged 2 commits into
mainfrom
feat/set-displayname
Aug 3, 2026
Merged

TroyHernandez merged 2 commits into
mainfrom
feat/set-displayname

Conversation

@user9208212

Copy link
Copy Markdown
Collaborator

What

mx_set_displayname(client, name, save = TRUE) — the display-name client helper discussed for corteza#155: wraps mx.api::mx_set_displayname(), builds the session from the client config, and goes through mx_with_relogin() so a rotated token gets one refresh-and-retry instead of a silent failure. Validates name as 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 follow test_relogin.R's pattern (signature + validation; the relogin path itself is already covered by the mx_with_relogin tests). Verified live against the cornball.ai homeserver.

Naming

Kept mx_set_displayname (your first suggestion) — it does shadow mx.api::mx_set_displayname when both are attached, though all package code calls via ::. Happy to rename to mx_profile_set_displayname if 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

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
Version and NEWS only. The branch claimed 0.1.1.1, taken by PR #13;
renumbered to 0.1.1.5, assuming #11 lands 0.1.1.4 first.
@TroyHernandez
TroyHernandez merged commit 5698c75 into main Aug 3, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the feat/set-displayname branch August 3, 2026 19:39
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>
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