fix: apply admin password and SMTP changes without a manual restart - #83
Merged
Conversation
…1.156.0:4 → 1.156.0:5 Set Admin Password wrote pendingAdminPassword to store.json and returned. main read the store with .once(), so nothing reacted, and the apply-admin-password oneshot that actually sets the password only runs at startup — the new password did not work until the user restarted by hand. The action now calls sdk.restart(effects). Dropped the stray whole-store .const() the oneshot registered after clearing the field: it only ran on boots that had a pending password, so store reactivity came and went. SMTP had the same problem and was also folded into the Config action, where an SMTP-only change left homeserver.yaml byte-identical and so never tripped main's watch. Split it into a manage-smtp action per the packaging guide's Set Up SMTP recipe: the action writes only the selection to store.json, and main watches that field with .const() plus getSystemSmtp().const() when the selection is system, so both a user change and a host credential change restart Synapse. The store read is scoped rather than whole-store because the oneshot clears pendingAdminPassword in the same file. main renders the email block before it const-reads homeserver.yaml, so the write is not a write-after-const — the original ordering would have thrown Canceled: write after const on the first start after any SMTP change once the field became reactive. Disabling SMTP now writes email: null, which Synapse reads as an absent key; previously main only wrote when the selection was not disabled, so stale credentials survived being turned off. Also removes the Create Bot User action, which duplicates what the bundled Ketesa admin dashboard already does from its Users tab. Nothing consumes it — the only reference in either registry is a fully commented-out block in openclaw-startos. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Bumps
1.156.0:4→1.156.0:5.Set Admin Password
The action wrote
pendingAdminPasswordtostore.jsonand returned.mainread the store with.once(), so nothing reacted, and theapply-admin-passwordoneshot that actually sets the password only runs at startup — so the new password silently didn't work until the user restarted Synapse by hand.The action now calls
sdk.restart(effects). Applying the password needs both the Synapse image (forhash_password) and a running PostgreSQL, so it stays in the oneshot rather than moving into the action; on a stopped servicerestartis a no-op and the password is applied at the next start, which is why the action still allows any status.This also drops a stray whole-store
.const()the oneshot registered right after clearing the field. It only ran on boots that had a pending password, so store reactivity came and went depending on the previous boot.SMTP
Same root cause, plus SMTP lived inside the
configaction — where an SMTP-only change lefthomeserver.yamlbyte-identical, so it never trippedmain's watch either.Split out into a
manage-smtpaction following the packaging guide's Set Up SMTP / Email recipe:store.jsonmainwatches that field with.const(), and when the selection issystemalso watchessdk.getSystemSmtp(effects).const()— so both a user change and a change to StartOS's own SMTP settings restart SynapseThe store read is scoped to
smtprather than whole-store because the oneshot clearspendingAdminPasswordin the same file; that field is read with a scoped.once().Two behavior changes fall out:
mainrenders theemailblock before it const-readshomeserver.yaml. The original ordering merged after the const read, which would throwCanceled: write after conston the first start after any SMTP change once the field became reactive.email: null. Previouslymainonly wrote the block when the selection was notdisabled, so turning SMTP off left the old credentials inhomeserver.yamlindefinitely. Verified againstghcr.io/element-hq/synapsethatEmailConfig.read_configdoesemail_config = config.get("email"); if email_config is None: email_config = {}, so null reads as an absent key.No migration needed:
mainrenders from the store on every start, so an install that set SMTP under:4gets it applied by the upgrade restart.Removes Create Bot User
Duplicates what the bundled Ketesa admin dashboard already does from its Users tab. Nothing consumes it — the only reference across
Start9LabsandStart9-Communityis a fully commented-out block inopenclaw-startos.Test plan
admin.start-cli package attach synapse -n synapse-sub -- cat /data/homeserver.yamlshows theemailblock. Trigger a password reset from a Matrix client and confirm the mail arrives.homeserver.yamlnow hasemail: null, and that Synapse starts healthy.