GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(calls): keep a group call known while anyone is in it, let ending win over a late registration (#1628, #1630) by Storypapst · Pull Request #1641 · OpenResilienceInitiative/ORISO-UserService

Conversation

@Storypapst

@Storypapst Storypapst commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

What this fixes

The call message in an encrypted conversation asks the server whether a call is still running. Three things were still wrong after the call-tracking fix (#1625):

  1. The person who started the call goes offline while others keep talking. Only their browser kept the call "known" to the server. About 10 minutes later the server said "unknown", and the message switched to "ended" with no Join button, although people were still in the call.
  2. An end that arrives before the registration. The browser gives up on the registration after 30 seconds. If the call ended in that window, the end found nothing to end and the late registration stayed "running".
  3. The server held a database connection open while it waited for Matrix. Under load this can exhaust the connection pool.

With this PR:

  • The server itself looks, at most once a minute per call, at who is still in the call (the call memberships in the call room, which are readable even in encrypted calls). While any member of the conversation is still in it, the call stays "running", whoever started it. When everybody has left, the call is marked ended within about a minute. If the server cannot tell (Matrix unreachable, unknown format), it changes nothing.
  • An end that arrives first leaves a marker, and the late registration of the same call is refused. The call stays ended.
  • Every Matrix lookup now happens before the short database write. No transaction is open while Matrix is called.

No Frontend change is needed: the existing call message polling and the creator's existing registration are enough.

Merge after #1638. This branch is built on #1638 (1:1 session calls), because both change the same lines in the registration code. Until #1638 is merged, this PR's diff also shows #1638's commits.

Refs #1628
Refs #1630

How to test (after deployment to Dev)

  • Start a call in an encrypted internal group, let a second person join, then close the creator's tab. Wait more than 15 minutes. The second person's call message still shows the call as running with Join, and a third member can still join.
  • The last participant leaves. Within about a minute the call message shows the call as ended.
  • Start and end an internal group call normally. The message shows "ended" within a minute.
  • Start a call in a 1:1 conversation (needs fix(calls): let the server observe encrypted 1:1 session calls (#2237) #1638 and Frontend#2238). Joining and ending work as described in fix(calls): let the server observe encrypted 1:1 session calls (#2237) #1638.

Verified: local only (unit tests, and an integration test on MariaDB 10.11 in Testcontainers). Not yet verified on Dev.

For developers: change details and test evidence (skip if you only need the status):

#1630 (a) No transaction around Matrix calls
- MatrixCallObservationService.register/end and MatrixCallStateService.read are no longer @Transactional.
  Order: Matrix lookups -> one short TransactionTemplate write (lock + read + write) -> notifications
  (each notification already runs in its own transaction). Binding read path keeps a short read-only
  TransactionTemplate around the lazy device map.
- Guard: MatrixCallObservationServiceTest records every Matrix/notification call made while the test
  transaction manager has a transaction open (mutation-checked: a Matrix call moved inside the write
  makes registrationCallsMatrixAndNotifiesOutsideAnyTransaction fail). MariaDB IT asserts the same with
  TransactionSynchronizationManager.isActualTransactionActive().

#1630 (b) Race test on MariaDB
- MatrixCallObservationMariaDbIT.parallelFirstRegistrationsLeaveOneRowAndOneInvitation: two first
  registrations meet inside their write transactions (CyclicBarrier). Observed: MariaDB 1213 deadlock
  for the loser -> PessimisticLockingFailureException (controller answers 409), exactly one row, and the
  loser's retry renews without a second invitation.

#1628 (2) End wins over a late registration
- /observations/end with no row: a current member of the conversation writes a tombstone row
  (origin END_TOMBSTONE, media_room_id NULL, ended_at = expires_at = now). register rejects any ended row,
  so the same creator's late registration gets 404. A tombstone written by somebody other than the
  registering creator is deleted and replaced by the real registration, so a member cannot suppress
  another person's call. Unique-key or deadlock collision between tombstone and registration: end retries
  once and then ends the registered row.

#1628 (1) Liveness from MatrixRTC membership
- readState: when lastSeenAt and livenessCheckedAt are both >= 60 s old, the server reads the media room
  state (MatrixSynapseService.getCallRoomState, as the creator if still joined, else another joined
  conversation member) and parses org.matrix.msc3401.call.member with the existing
  MatrixRtcMembershipEvent parser. Only senders who are current conversation members count.
  - someone active (non-empty, not expired) -> keepAlive: lease = now + 10 min, also after it ran out
  - every parsed membership departed/expired and registered >= 2 min ago -> finishAt(last presence),
    call.ended notifications to members (deduplicated per room+call)
  - no parsable membership, Matrix unavailable, nobody to read as -> no change (only livenessCheckedAt)
- Known limit: a browser that crashes without its delayed leave event keeps its membership until the
  membership expires (Element Call default 4 h), same as the existing binding path.
- No Frontend change: non-creators cannot renew through POST /observations (it checks the media-room
  creator), and with server-side liveness they do not need to.

Schema: Liquibase 20261113_call_observation_lease_1628
  matrix_call_observation.media_room_id -> NULL allowed; + liveness_checked_at BIGINT NULL.
  Rollback deletes tombstones (media_room_id IS NULL), restores NOT NULL, drops the column.
  uk_call_observation_media_room unchanged (NULLs do not collide on MariaDB).
MatrixCallObservationIsolationTest: allows the service's own private nested types (records/enums).

#1630 (c) Dev check, 13 Nov 2026 00:49 UTC, read-only SELECT on Dev MariaDB:
  matrix_call_observation 0 rows, matrix_call_binding 0 rows (observation changeset applied 2026-11-11).
  Nothing stuck on Dev, but also no observed call there to inspect. Staging: no DB access set up; not checked.
#1630 (d) 1:1 session calls: #1638 (server) + Frontend#2238. Internal group chats: already on dev via #1625.

Tests (JDK 21):
  ./mvnw -B test -Dtest='MatrixCallObservation*Test,MatrixCallStateControllerTest,CallObservationRetentionServiceTest' -Dsurefire.failIfNoSpecifiedTests=false
  ./mvnw -B test -Dtest=MatrixCallObservationMariaDbIT -Dsurefire.failIfNoSpecifiedTests=false   (Docker)
  ./mvnw -B test (full unit suite)  -> 8944 run, 0 failures, 0 errors, BUILD SUCCESS; spotless:check clean.
  Targeted: 67 run, 0 failures. MariaDB IT: 3 run, 0 failures.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Storypapst @claude
fix(calls): keep a group call known while anyone is in it, let ending…
5f727c0
… win (#1628, #1630)

- No database transaction is open while Matrix is called: register, end and
  the state read do Matrix lookups first, then one short write transaction,
  then notifications (#1630 a).
- MariaDB race test for parallel first registrations (#1630 b).
- An end that arrives before the registration leaves a tombstone; the late
  registration of the same call is rejected (#1628).
- At most once a minute per call, the server reads the MatrixRTC memberships
  of the media room: someone from the conversation still in the call extends
  the lease; everybody gone ends the call. Inconclusive answers change
  nothing (#1628).
- Liquibase: media_room_id nullable, liveness_checked_at.

Refs #1628
Refs #1630

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Storypapst
Storypapst requested review from Shirloin, hasanbarisgok and shazia-k November 13, 2026 00:52
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 93 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: OpenResilienceInitiative/ORISO-UserService
  • Branch: fix/1628-1630-call-lease
  • File: .coderabbit.yaml
  • Commit: 7886b77
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 91a815a9-8ace-402b-9120-e559f7fb409b
Commits

Reviewing files that changed from the base of the PR and between d6be1fa and 7886b77.

Files selected for processing: 21

  • src/main/java/de/caritas/cob/userservice/api/adapters/matrix/MatrixSynapseService.java
  • src/main/java/de/caritas/cob/userservice/api/model/MatrixCallObservation.java
  • src/main/java/de/caritas/cob/userservice/api/model/MatrixCallObservationEnd.java
  • src/main/java/de/caritas/cob/userservice/api/port/out/MatrixCallObservationEndRepository.java
  • src/main/java/de/caritas/cob/userservice/api/service/matrix/MatrixCallObservationService.java
  • src/main/java/de/caritas/cob/userservice/api/service/matrix/MatrixCallStateService.java
  • src/main/java/de/caritas/cob/userservice/api/service/matrix/MatrixRtcMembershipEvent.java
  • src/main/java/de/caritas/cob/userservice/api/workflow/callobservationretention/service/CallObservationRetentionService.java
  • src/main/resources/db/changelog/changeset/20261112_call_observation_session_2237/changeSet.xml
  • src/main/resources/db/changelog/changeset/20261113_call_observation_chat_nullable_2237/changeSet.xml
  • src/main/resources/db/changelog/changeset/20261113_call_observation_end_1628/changeSet.xml
  • src/main/resources/db/changelog/changeset/20261113_call_observation_lease_1628/changeSet.xml
  • src/main/resources/db/changelog/userservice-master.xml
  • src/test/java/de/caritas/cob/userservice/api/CallObservationEndMigrationMariaDbIT.java
  • src/test/java/de/caritas/cob/userservice/api/CallObservationSessionMigrationMariaDbIT.java
  • src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/MatrixCallStateControllerTest.java
  • src/test/java/de/caritas/cob/userservice/api/service/matrix/MatrixCallObservationIsolationTest.java
  • src/test/java/de/caritas/cob/userservice/api/service/matrix/MatrixCallObservationMariaDbIT.java
  • src/test/java/de/caritas/cob/userservice/api/service/matrix/MatrixCallObservationServiceTest.java
  • src/test/java/de/caritas/cob/userservice/api/service/matrix/RecordingTransactionManager.java
  • src/test/java/de/caritas/cob/userservice/api/workflow/callobservationretention/service/CallObservationRetentionServiceTest.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 13, 2026
Follow-ups from the call-tracking fix (#1625) #1630
Open
Keep a group call known while anyone is still in it, and let ending win over a late registration #1628
Open
Go-Live Readiness & Final Acceptance OpenResilienceInitiative/ORISO-Frontend#585
Open
fix(calls): let the session's own counsellor share a running 1:1 call (FE#2209) #1642
Merged
Storypapst added a commit that referenced this pull request Nov 13, 2026
@Storypapst @claude
fix(calls): close the review gaps of the 1:1 session call binding (FE…
addfe2d
…#2209)

Security review round 1 of US#1642:
- A known ORISO conversation room (session, chat, occurrence, team,
  supervisor, support) is never accepted as a call room.
- "Ending wins" (#1641): the caller's end tombstone, or an ended or lapsed
  observation of the call, refuses a late binding. Deny-only read.
- Assignment and account are checked again under the session lock.
- An ended or no longer live binding is never renewed; a live exact
  binding is confirmed without any Matrix lookup.
- Guest admission requires a live call (MatrixCallBinding.isLive), and a
  session call that was never observed ends 10 minutes after its invite
  ran out, revoking outstanding seats.
- A race on the uk_call_binding_* keys is a 409, not a 500.
Tests: unit cases for each, controller cases, and a CallShareLinkIT case
for bind -> share link -> knock -> seat -> never-observed end on a real DB.

Refs OpenResilienceInitiative/ORISO-Frontend#2209

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Storypapst @claude
fix(calls): keep inconclusive liveness checks from ending a call (#1628)
5cccff4
- A liveness verdict is discarded when a renewal or another check
  committed while Matrix was read, so an older "everybody left" cannot
  overtake a newer confirmed presence.
- A call-member event of a conversation participant that this server
  cannot parse makes the check inconclusive instead of counting as a
  departure.
- The liveness_checked_at column is added in its own changeset with a
  MARK_RAN precondition, as the master changelog requires.

Addresses CodeRabbit review on US#1642.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shirloin
Shirloin previously approved these changes Nov 13, 2026
View reviewed changes

@Shirloin Shirloin left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Checked the call lifecycle change: a group call now stays running while any member is still in it and ends within about a minute after the last one leaves, a late registration can no longer revive an ended call, and Matrix is no longer called inside a database transaction. Merge after #1638, which this branch is built on.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Shirloin
Shirloin added this pull request to the merge queue Nov 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to invalid changes in the merge commit Nov 13, 2026
@Storypapst
Storypapst dismissed Shirloin’s stale review November 13, 2026 07:29

The merge-base changed after approval.

Storypapst added a commit that referenced this pull request Nov 13, 2026
@Storypapst @claude
fix(calls): end the session binding with the call, cross-tenant room …
200befc
…check (FE#2209)

- An explicit end by the binding's caller now ends the session call's
  binding after the observation end, then revokes guest seats after the
  commit, so share links, knocks and seats stop at once.
- The binding reads the call's observation row with a write lock, so an
  end that commits meanwhile either refuses the binding or ends it.
- The ORISO-room check counts sessions and team discussions with native
  queries, so another Träger's room (or a missing tenant context) never
  passes as a dedicated call room.
- Tests: expired retained device seats nobody; the guest admitted before
  a never-observed call ends is revoked, removed and its power level
  cleared.
- Merges the #1641 CodeRabbit fixes from fix/1628-1630-call-lease.

Addresses CodeRabbit review on US#1642.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shirloin
Shirloin previously approved these changes Nov 13, 2026
View reviewed changes

@Shirloin Shirloin left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-approving after #1638 merged; the code is unchanged. A group call stays running while anyone is still in it and ends within about a minute after the last person leaves.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Storypapst
Storypapst dismissed Shirloin’s stale review November 13, 2026 09:02

The merge-base changed after approval.

Storypapst and others added 3 commits November 13, 2026 10:10
@Storypapst
Merge remote-tracking branch 'origin/dev' into fix/1628-1630-call-lease
9e2071c
@Storypapst @claude
fix(calls): store every end of an observed call per person (#1628)
6a9f382
An end that arrived before the registration was kept as one END_TOMBSTONE row
in matrix_call_observation. The unique key on (source room, call) allowed one
such row, so the creator's own cancellation was dropped when another member
had ended first, and the creator's late registration then went through.

Ends now live in matrix_call_observation_end, one row per (source room, call,
actor). The creator's stored end refuses a late registration (locking read, so
an end being written is waited for); other people's ends are kept but do not
suppress it. A call ended before its registration still reads as ended. The
new changesets create the table (MARK_RAN when it exists), move existing
tombstone rows into it, and make media_room_id required again. Retention also
ages out stored ends.

#2237: the session_id changeset gets an onFail=MARK_RAN precondition. Liquibase
4.27 leaves preconditions out of the checksum (9:135d1aa1... before and after),
so Dev is unaffected. A follow-up changeset applies the chat_id nullability
that a MARK_RAN would skip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Storypapst @claude
Merge origin/dev (#1639) into fix/1628-1630-call-lease
7a99982
Keeps #1639's group waiting room changeset (20261112, already on dev) ahead of
the #1628/#2237 call observation changesets of this branch, in date order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Storypapst
Storypapst enabled auto-merge November 13, 2026 09:56
@Storypapst @claude
Merge origin/dev into the call branch
7886b77
Keep dev's 20261113_communication_stat include ahead of this branch's
20261113 call-observation changesets in userservice-master.xml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
shazia-k
shazia-k approved these changes Nov 13, 2026
View reviewed changes
@shazia-k
shazia-k disabled auto-merge November 13, 2026 10:41
@shazia-k
shazia-k added this pull request to the merge queue Nov 13, 2026
Merged via the queue into dev with commit 2483de6 Nov 13, 2026
17 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@shazia-k
shazia-k deleted the fix/1628-1630-call-lease branch November 13, 2026 10:56
Storypapst added a commit that referenced this pull request Nov 13, 2026
@Storypapst @claude
Merge origin/dev (#1641 merged) into fix/2209-session-call-binding
a55a203
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Storypapst Storypapst mentioned this pull request Nov 17, 2026
v2.0.17 merge queue OpenResilienceInitiative/ORISO-Frontend#2277
Open
62 tasks done
@Hassan9215 Hassan9215 mentioned this pull request Nov 18, 2026
Release UserService v2.0.17 #1688
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@shazia-k shazia-k shazia-k approved these changes
@Shirloin Shirloin Shirloin left review comments
@hasanbarisgok hasanbarisgok Awaiting requested review from hasanbarisgok

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Storypapst @Shirloin @shazia-k
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.