Skip to content

fix: restart on a rewritten appservice registration - #100

Merged
MattDHill merged 1 commit into
Start9Labs:masterfrom
ok:fix/restart-on-appservice-rewrite
Oct 14, 2026
Merged

MattDHill merged 1 commit into
Start9Labs:masterfrom
ok:fix/restart-on-appservice-rewrite

Conversation

@ok

@ok ok commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • main now .const()-watches every file listed in app_service_config_files, so rewriting an existing appservice registration restarts Synapse the way adding one already does.

Why

Register Appservice writes appservices/<id>.yaml and appends its path to homeserver.yaml. On a first registration the path change restarts Synapse through the existing homeserverYaml.read().const(). On a re-registration (a bridge package reinstalled, minting new tokens and re-raising the task through ensureAppserviceRegistration) only the registration file changes, nothing watched it, and Synapse kept the old tokens in memory: the bridge exited with as_token was not accepted until Synapse was restarted by hand.

Verification

  • Defect reproduced on StartOS 0.4.0.2 with Synapse 1.162.0:4 and a mautrix-signal package that uses this repo's ensureAppserviceRegistration: reinstall the bridge, run the re-raised Register Appservice task, and the bridge is rejected until Synapse is restarted manually.
  • This change passes tsc. It has not yet been built and installed on a box; a reviewer with a bridge package installed can confirm Synapse restarts on its own after the task runs.

🤖 Generated with Claude Code

Synapse reads each appservice registration once at startup. Register
Appservice restarts Synapse when it adds a file, because the path lands
in app_service_config_files and main watches homeserver.yaml; rewriting
an existing registration changes only the registration file, which
nothing watched. A reinstalled bridge mints new tokens, re-registers,
and Synapse keeps the old tokens in memory until restarted by hand,
rejecting the bridge with "as_token was not accepted".

main now reads every registered appservice file with .const(), so any
change to one — tokens, sender, namespaces, URL — restarts Synapse the
same way a new one does.

The defect was reproduced on StartOS 0.4.0.2 with Synapse 1.162.0:4 and
a mautrix-signal package (reinstall, run the re-raised task, bridge
rejected until a manual Synapse restart). This change type-checks; it
has not yet been installed on a box.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ok
ok force-pushed the fix/restart-on-appservice-rewrite branch from 340dc57 to 7fb90ba Compare October 14, 2026 21:51
@MattDHill
MattDHill requested a review from helix-a October 14, 2026 22:15

@helix-a helix-a left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The registration watcher is consistent with the package's registration paths and setupMain reactivity. One release blocker: beta already serves 1.162.0:4 from f5893318f5cf86c64c946852a5640979ec92039f. This fix needs a new downstream revision so existing installs receive it as an update, rather than different code claiming the published version.

The proposal bumps current.ts in place to 1.162.0:5 and replaces the already-shipped Force-Purge Room notes with localized notes for this fix. No migration or historical version file is needed. The other open PR (#99) targets 1.163.0:0, so it does not claim this revision.

Verification: git merge-tree --write-tree origin/master HEAD passed for the reviewed PR head. SDK pin matches npm's current 3.0.6. Both the PR and proposal passed type-check, Prettier check, bundle build, and make synapse.s9pk via helix-build; inspected the returned proposal artifact and confirmed version 1.162.0:5. No runtime bridge-reinstallation test performed; automatic restart remains runtime-unverified.

Proposed changes: 7fb90ba...proposal/100

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@MattDHill

Copy link
Copy Markdown
Member

@helix-a I just merged 1.163.0:0 to master. Rebase this and keep that version intact

@helix-a

helix-a commented Oct 14, 2026

Copy link
Copy Markdown
Member

Updated proposal/100 with the original fix rebased onto master (ee6e869), preserving 1.163.0:0 and its version file unchanged. This replaces my earlier :5 proposal; the version-bump request is withdrawn per your guidance.

Rebased candidate: https://github.com/Start9Labs/synapse-startos/commits/proposal/100

Type-check, Prettier, bundling, and make synapse.s9pk passed. The returned artifact reports 1.163.0:0. Runtime bridge-reinstallation testing remains unverified.

As the reviewer, I left the PR branch untouched. @ok can use the rebased candidate to update it.

@helix-a helix-a left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved against updated master. With Matt's instruction to retain 1.163.0:0, my earlier version-bump objection no longer applies. The PR merges cleanly; the rebased candidate on proposal/100 preserves the version file unchanged and passed type-check, Prettier, bundling, and package build. Inspected the returned artifact and confirmed 1.163.0:0. Runtime bridge-reinstallation testing remains unverified.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@MattDHill
MattDHill merged commit f9b4e17 into Start9Labs:master Oct 14, 2026
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.

3 participants