- Retry the exit once when a broker boots the wrong core and the first exit
fails: the broker refuses every activate while that game runs, and the
released claim leaves nothing behind to stop it.
- Stamp the launch's core tier on the session and report it through the
status poll, so a tab that missed launch-ready still warns about an
untested or broken core, once.
- Translate the core-untested and core-blocked warnings in every locale.
- Replace the inline bytes-to-text decodes with redis_handler.as_text
- Add utils.auth.token_device_id for a request's token-bound device
- Look up a group's member tokens in one query and close them in one pass
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Port the branch's emulator labels and live-state flag onto master's typed
streaming schemas, and carry the labelled state reason into
useSaveStateTabs now that the EmulatorJS view delegates to it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- A failed LaunchBox or Switch TitleDB download, or an unreadable LaunchBox
archive, now fails the task instead of returning empty stats, so its
starter hears it failed rather than finished.
- The inbox replays changes made while a fetch is in flight onto its
response, so a push, read or dismissal is not undone by an older list.
- A refused mark-read turns its rows unread again, and the inbox view tries
each row once a visit so a failing server is not asked in a loop.
- Recipient resolution and sender attribution move from the endpoint into
notification_handler.
- SendNotificationSection inherits attributes again, and record_termination
loses a docstring sentence the code already says.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- One home for pushing to a user's room: `SocketHandler.emit_to_user`, on a
write-only manager kept per event loop and on the server's own channel.
Streaming's push_to_user and the sync and scan emitters use it too.
- Notifications are stored in one transaction per send, so a broadcast is one
commit, and pushed concurrently. Recipients are resolved from id and
enabled only, and the actor is loaded with just the fields it shows.
- notify_user_or_admins holds the "whoever started it, else the admins"
rule both the scan and the task runner applied by hand.
- A scan notifies from finish(), so no exit path can forget it.
- `data` is never null, dropping its guards; the toast host, the inbox and
the admin form share one tone icon map; the inbox icon uses RAvatar.
- The store keeps its list when a socket echo changes nothing, and small
dead parameters and duplicated lists are gone.
- The socket reconnect after a logout moved from the inbox to AppLayout,
since every v2 feature depends on the socket's identity.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Toasts disappear after a few seconds, and nothing reaches a user who has no
tab open. Notifications are now stored per user and kept until dismissed, so
what a background job or another user did is waiting the next time RomM is
opened.
Backend:
- `notifications` table (0130) with kind, level, data, actor and read_at, capped
at the newest 200 per user.
- /api/notifications: list, mark read, dismiss one, dismiss all.
- notify()/notify_admins() store the row and push `notifications:new` to the
user's socket room; read/dismiss push to the user's other tabs.
- Producers: a scan's end (to whoever started it; an unattended scan tells
the admins when it failed or found new games), a manual task's end (to who
ran it; a scheduled task's failure to the admins), an admin ending someone's
stream, and an admin changing someone's role.
Frontend (v2):
- Unread count badge on the navbar avatar, and a Notifications entry in the
user menu and settings sidebar.
- Notifications view: marks what it shows read, links each row to what it is
about, dismiss one or all.
- Live toast for a new notification, except scans, which already toast.
- The text is rendered from the kind in the reader's language (18 locales).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The desktop view takes its room from the claim POST and re-claims on reload, and the status poll never answers for a desktop, so the stored room was a dead write.
The repo caps a comment at two lines and a docstring at one sentence plus Args and Returns. Several comments and docstrings this branch wrote or edited ran to three lines or more, so they are tightened, with parameter notes moved under Args.
resolve_owned_session's include_desktop was never passed, and the two
teardown helpers and stamp_launched defaulted arguments every caller
supplies. The 409 builder's holder snapshot no longer reuses the name of
the container above it.
The room URL only ever existed in the launch-ready push, so a socket that
dropped while the game was coming up left the tab loading forever over a
session that was running, with no way out but a release.
The session now records the room the launch answered with, the status poll
reports it along with the container it was found on, and a loading tab enters
the stream on that answer.
The termination notice named only the platform, so a tab could not tell
which of the account's claims had ended. One room carries them all: a
player holding two sessions from a pool, or an admin with a desktop open
alongside a game, tore down the wrong screen.
The notice now names the container it ended and whether that claim was a
desktop. Stream.vue ignores a desktop notice and one for a container it
did not claim; Desktop.vue gains the listener it never had, so a
force-released desktop says so at once instead of at the next heartbeat.
The tombstone also moves ahead of the drain in both teardown paths: the
session is over the moment the marker lands, and a poll during the
seconds of broker round trips that follow found no reason at all.
A container can serve several platforms while holding one session, so a
lookup that starts from the caller has to match the platform it was asked
about. Otherwise a ps2 session shadows the same container's ngc row: the
claim reads as a duplicate and 409s, status reports it active on a
platform the caller holds nothing on, and an unnamed heartbeat or release
lands on it.
A desktop session is only reachable when the caller names its container,
which is what the desktop view does, so a game tab no longer beats or
releases an admin's desktop, and a desktop no longer blocks its admin's
own game claim. Occupancy is still the reservation's job: the claim walk
just fails that container's SET NX and moves on.
The ownership check and the reservation that follows it are separate Redis
round trips, so two concurrent claims from one player could each read no
session of their own and then win a different member of the pool, leaving
the second one unreachable. A per-player, per-platform gate held across the
pair makes the loser read the winner's session instead of a free container.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Session ownership and lifecycle, mostly around who a teardown belongs to:
- file the exit state, save states and state frames under the session's
owner rather than the caller, so an admin driving someone else's session
no longer collects their saves
- beat the heartbeat from the admin desktop view, which the stale sweep was
tearing down three minutes in
- take the claim through release_own_session when a launch aborts, instead
of deleting a key another player may already hold
- require the same claim to stamp a launch, so a late activate cannot revive
a drain marker with a six hour TTL
- pull the in-game save archive on every teardown path, not just the two
that remembered to
- skip draining keys in the admin force-release sweep
Plus: pool members must share a protocol, since the head's capabilities are
what the frontend renders; a claim clears terminations across the whole pool;
multiplayer is only recorded where the broker can actually seat a joiner; and
an unserializable config no longer caches forever on a repr() that repeats.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- The five new modules each defined `log = logging.getLogger("romm")`, which is
what `logger.logger` already exports; they import it now.
- `ACK_TIMEOUT` had two homes. It is a protocol fact, so `protocol.py` owns it
and the endpoint imports it from there; the unused
`BROKER_LOAD_STATE_TIMEOUT` copy goes.
- Module and function docstrings trimmed to what the code cannot say: the
change history and the justifications belong in the commit messages they came
from.
- `asset_store` takes the union `write_file` accepts rather than `Any`.
- Four hand-rolled `setInterval` pairs (presence beat, session poll, exit
chord, live sessions, activity tick) become `useIntervalFn`, which also
cleared a real gap: the presence composable's timer had no scope teardown.
- The launch pushes are matched on the container the claim's 202 named, not on
the platform: a pool serves one platform from more than one container, so a
second tab could otherwise act on the first's launch.
- Test helpers typed: the push capture and the resume-claim tuple carry real
types, and an unused `_claim_ready` helper goes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`POST /streaming/sessions` blocked for up to STREAMING_LAUNCH_TIMEOUT (10
minutes) while a broker unpacked a pkg or archive, and four mechanisms existed
to keep that survivable: a 3s status poll the client ran alongside it purely
for progress, `launch_timeout` shipped through /config so the client could size
its own axios ceiling, and a cancel-then-undo branch that re-released a session
the player had already abandoned, because a blocking POST cannot be cancelled.
The claim now answers 202 as soon as the container is reserved and everything
that can fail synchronously has (404, 409, 428 are all still the claim's own
status). The launch runs detached and pushes to the user room the
force-release notice already used:
- `streaming:launch-ready` carries the room URL and the resume outcome
- `streaming:launch-failed` carries the reason; the claim is already freed
- `streaming:launch-phase` carries the broker's extraction phase
The backend polls the broker for that phase itself, once, however many tabs are
watching, and only pushes changes. `GET /sessions/{platform}/status` stays as
the fallback for a tab that missed a push.
That retires the client's launch poll, the `launch_timeout` plumbing and the
cancel-then-undo branch. Leaving during a launch is now just a release, and the
launch-ready handler hands the container back if the player has already gone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`endpoints/streaming.py` held a general-purpose Redis session store and an HTTP
client alongside its routes, so both were reachable only through the ASGI test
client and neither could serve a second caller. They now sit in
`handler/streaming/` next to the container and protocol modules, matching how
`handler/netplay_handler.py` already owns its Redis room state.
- `session_store.py`: the keys, TTLs, compare-and-set helpers, drain markers,
staleness rule and termination notices. Its names are public now, because the
module boundary is the privacy boundary.
- `broker.py`: the urllib transport, its bounded reads and byte caps, and the
translation of a transport failure into the 502/503 the frontend parses.
The endpoint module drops from 5157 lines to 3616 and keeps the routes, the
claim and teardown flows, and the asset sync.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>