Skip to content

fix(TeacherWebSocketService): Classroom monitor misses late-joining teams - #2398

Open
Isaries wants to merge 2 commits into
WISE-Community:developfrom
Isaries:fix/classroom-monitor-late-joiner-roster
Open

Isaries wants to merge 2 commits into
WISE-Community:developfrom
Isaries:fix/classroom-monitor-late-joiner-roster

Conversation

@Isaries

@Isaries Isaries commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

The classroom monitor does not pick up teams that join the run after the teacher opened it. When a workgroup joins, each period's classroom topic sends newWorkgroupJoinedRun and TeacherWebSocketService calls ConfigService.retrieveConfig() to refresh the roster, but retrieveConfig() returns a cold HTTP observable and nothing subscribes to it, so the request is never made. The roster stays as it was when the monitor loaded until the teacher reloads or changes a team through Manage Students, whose dialogs do subscribe.

At the start of a lesson, while students join with the access code, the period selector counts and Manage Students stay short, and Student Progress, Grade by Step and the grading lists never show the newcomers, however often the teacher reopens them. Work from those teams appears with an empty name where names are looked up from the roster.

Changes

  • The join message feeds a subject that requests the classroom monitor config at most once every two seconds. auditTime rather than debounceTime, so the roster keeps refreshing while a class is still joining. There is one teacher tab, so no jitter. Each request is mapped with concatMap and runs to completion, so a server slower than the window still answers during a burst. A failed request is swallowed so later joins still refresh, and initialize(), which runs each time a unit's monitor opens, replaces any earlier pipeline.
  • With the roster refreshing, the period selector counts and Manage Students update as teams join, and the other monitor views pick up the new team the next time they initialize instead of only after a reload.

Anonymized discussion views compute pseudonyms from the roster, so this should be merged after #2394, which keeps those pseudonyms stable when the roster changes mid-session.

Test

  • New teacherWebSocketService.spec.ts: the config is requested, once for a burst of joins, repeatedly while joins keep arriving one second apart, again after a failed request, and through one pipeline after a second initialize(). Against the current develop, all five fail, e.g. Expected 0 to equal 1. and Expected 0 to be greater than or equal 3.
  • should finish slow config requests while joins keep arriving: with a request slower than the window, requests still complete while joins continue. With switchMap it fails with Expected 0 to be greater than or equal 2.

…eams

When a new workgroup joins the run, each period's classroom topic sends
a newWorkgroupJoinedRun message and the classroom monitor calls
ConfigService.retrieveConfig() to refresh its roster. retrieveConfig()
returns a cold HTTP observable and nothing subscribed to it, so the
request was never made, and the roster stayed as it was when the
monitor loaded until the teacher reloaded or changed a team through
manage students.

The message now feeds a subject that requests the config at most once
every two seconds. auditTime is used rather than debounceTime so the
roster keeps refreshing while a class is still joining, instead of
waiting for the joins to stop. A failed request is swallowed so later
joins still refresh, and initialize() replaces any earlier pipeline
instead of adding a second one.

With the roster refreshing, the period selector counts and manage
students update as teams join, and the other monitor views pick up the
new team the next time they initialize instead of only after a reload.
Anonymized discussion views compute pseudonyms from the roster, so this
should land after the change that keeps those pseudonyms stable when the
roster changes mid-session.
The roster refresh audits newWorkgroupJoinedRun messages and maps each
audit tick to a config request with switchMap. While a class keeps
joining, the audit window closes again every few seconds and switchMap
cancels the request still in flight. If the config endpoint takes
longer than the window to answer, no request completes until the joins
stop.

Use concatMap instead so each request runs to completion and the
request for the latest joins still runs after the one before it.
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