Skip to content

Stabilise MSC4222: support the stable use_state_after identifiers on /sync - #20170

Open
barodeur wants to merge 4 commits into
element-hq:developfrom
barodeur:stabilize-state-after
Open

Stabilise MSC4222: support the stable use_state_after identifiers on /sync#20170
barodeur wants to merge 4 commits into
element-hq:developfrom
barodeur:stabilize-state-after

Conversation

@barodeur

@barodeur barodeur commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Part of #19414 (Support Matrix 1.16).

⚠️ Before merging, wait for the following PRs to be merged first:


Since Matrix 1.16, the spec defines the stable identifiers for MSC4222: the use_state_after query parameter on GET /_matrix/client/v3/sync, and the state_after room response field:

use_state_afterboolean — Controls whether to receive state changes between the previous sync and the start of the timeline, or between the previous sync and the end of the timeline. If this is set to true, servers MUST respond with the state between the previous sync and the end of the timeline in state_after and MUST omit state. […]

state_after — […] Required if use_state_after was set to true in the request, even if it is empty. Added in v1.16

Matrix Spec

Synapse so far only implemented the unstable identifiers (org.matrix.msc4222.use_state_after / org.matrix.msc4222.state_after), gated behind the msc4222_enabled experimental flag and the per-user experimental features admin API.

This PR:

  • accepts the stable use_state_after query parameter, unconditionally, and responds with the stable state_after field. The unstable query parameter is kept for a transition period; clients opting in with it get the unstable response field name back, so unstable-era clients see an unchanged wire format. If both parameters are set, the stable one wins.
  • removes the msc4222_enabled experimental flag and the msc4222 per-user feature from the experimental features admin API, since the behaviour is no longer gated.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

Accept the stable `use_state_after` /sync query parameter and respond
with the stable `state_after` field. The unstable identifiers are kept
for a transition period: clients opting in with the unstable query
parameter get the unstable response field name back.
Now that the feature is stable, `state_after` is always available and
no longer gated per-user via the experimental features admin API.
@barodeur
barodeur marked this pull request as ready for review September 1, 2026 15:59
@barodeur
barodeur requested a review from a team as a code owner September 1, 2026 15:59
@barodeur
barodeur requested review from MadLittleMods and removed request for a team September 1, 2026 15:59
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.

1 participant