Repository navigation
frontend: Shared fallback warning with a countdown (obs_frontend_warn_fallback) - #2238
Merged
Merged
Conversation
vpacher
force-pushed
the
feat/2218-fallback-warning
branch
from
October 24, 2026 21:46
e4fb12b to
530f3cd
Compare
…#2218) Add rust/obs-fallback-warning with its safe API as stubs, the C ABI shim the frontend will call (types only, it delegates), and the tests: - show: the first warning with a visible main window shows the dialog; the same id shows it once per session; another id shows its own; with no visible window it accepts now and is not remembered; an empty id is never remembered. - end: the countdown and "Accept anyway" accept; Cancel and Close stop a caller that can stop, and accept when there is nothing to stop. - progress: 3 s, 0 to 100, and 100 after the end. - log line: "[fallback] <id>: <message> This may become an error in a future version of OBS." - ffi: the same through the C ABI, with null strings. The tests run in obs-gpu-status's obs-tests-gpu (one test executable per category, ci/test_binary_cap.py; both crates are the frontend's Rust). Tier 2 does not build the crate, so local-gate.toml drops it from the tier2-linux inputs, as it does obs-gpu-status (ci/test_tier2_proof_inputs.py). 19 of 24 fail against the stubs. Refs obs-rust#2218 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The safe core of the warning that the maintainer decided on obs-rust#1092 for fallbacks that lower security: - Session::begin: a dialog only with a visible main window, once per id per session; no window means log only and accept, and is not remembered; an empty id is never remembered. - accepted: the countdown and "Accept anyway" accept; Cancel and Close stop a caller that can stop, and accept otherwise. - progress_percent: 0 to 100 over COUNTDOWN_MS (3 s), then 100. - log_line: "[fallback] <id>: <message> " + FUTURE_ERROR. obs-tests-gpu: 171 of 171 pass, with the 24 fallback-warning tests. Refs obs-rust#2218 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frontend's one Rust staticlib gets a general name, as decided on obs-rust#2218: two staticlibs in one binary would duplicate the Rust std symbols, so later frontend crates (first obs-fallback-warning) join this one. Only the name changes; the GPU status light builds and behaves as before (still with ENABLE_GPU_STATUS, still OFF in the Flatpak). The crate directory, its package and library name (libobs_frontend.a), frontend/cmake/feature-gpu-status.cmake, ci.toml, local-gate.toml, ci/test_rust_cargo_build_order.py, rust/obs-build, rust/README.md and the docs follow. naming.md lists the kind "Frontend staticlib: obs-frontend". The CI evidence records in docs/ci-evidence/ keep the old name. Refs obs-rust#2218 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#2218) As decided on obs-rust#2218, the frontend's Rust staticlib no longer depends on the GPU light: - frontend/cmake/frontend-rust.cmake imports and links rust/obs-frontend whenever cargo is available, and defines OBS_FRONTEND_RUST. Without cargo (the OBS_LIBOBS_BACKEND=C rollback build) it configures without it and says so. - feature-gpu-status.cmake now only switches the light: ENABLE_GPU_STATUS and the staticlib, as before. The Flatpak still sets it OFF. - obs-frontend re-exports obs-fallback-warning's C ABI next to obs-gpu-status's. Refs obs-rust#2218 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st#2218) The window of the shared fallback warning: the caller's texts, a countdown that accepts by itself, "Accept anyway" and, when the caller can stop, "Cancel". It takes every text from its caller, so it builds without the frontend, in its own unity group. test_fallback_warning_dialog builds it on Qt's offscreen platform and checks that the countdown, both buttons, Escape and the window close each end the dialog exactly once, with the End value of the C ABI of rust/obs-fallback-warning, and that the window then deletes itself. The window does nothing yet, so the tests fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) The window shows the caller's title, message and future-error sentence, a progress bar for the countdown, "Accept anyway" and, with a cancel text, "Cancel" as the default button (the safe choice; the countdown accepts anyway). It is not modal and deletes itself on close. Every way out (countdown, either button, Escape, window close) goes through one finish() that reports only the first end, and closeEvent() does not call QDialog::closeEvent(), which would call reject() and keep the visible window open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vpacher
force-pushed
the
feat/2218-fallback-warning
branch
from
October 25, 2026 07:51
530f3cd to
04ae04e
Compare
The glue between callers of the shared fallback warning and its window, with frontend/utility/obs-fallback-warning.h, the C ABI of rust/obs-fallback-warning. Its own unity group; built always, and with the C header when the frontend's Rust is built. FallbackWarning::Warn() runs on any thread and logs the warning at error level at once. Then, on the UI thread and never inside the call, it shows OBSFallbackWarning or accepts, as the Rust session decides, and calls the caller back once. Warnings wait until the main window hands over itself and the translated texts (SetMainWindow), so the glue does not use App() or OBSBasic. One dialog shows at a time. SetMainWindow (nullptr) at shutdown closes the open dialog and accepts the rest. Without the frontend's Rust it only logs and accepts. test_fallback_warning_queue builds the glue and the window with the real Rust staticlib when it is built (else it checks the rollback path), with its own blog() to check the log line. The glue does nothing yet, so the tests fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Warn() logs the line from rust/obs-fallback-warning (the same line in C++ on the rollback build) at error level, then queues the warning to the UI thread. The queue runs once the main window is set, until a warning shows a dialog: the Rust session decides from the id and whether the main window is visible. The dialog's end goes through the Rust accepted() to the caller, and the next warning runs after it closed. A dialog deleted without an end (its main window went away first) answers as closed. SetMainWindow(nullptr) closes the open dialog and accepts the rest. Without the frontend's Rust every warning accepts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bs-rust#2218) obs_frontend_warn_fallback(id, title, message, can_cancel, cb, param) for plugins that fall back to a less safe mode: the browser source without its sandbox (obs-rust#1092), RTMPS to RTMP (obs-rust#2205). The caller translates title and message. OBS logs at error level, warns with the countdown, and calls cb once on the UI thread with whether to continue in the fallback mode. Declared in obs-frontend-api.h, a new method of obs_frontend_callbacks, and stubs in the API library and OBSStudioAPI. test_frontend_warn_fallback: with no frontend (no callbacks) the API library logs the line at error level and accepts at once, inside the call, without the "no callbacks" error. The stubs do nothing yet, so the test fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-rust#2218) With the OBS frontend, OBSStudioAPI hands the warning to FallbackWarning::Warn(). Without a frontend (no callbacks) the API library logs the line of rust/obs-fallback-warning at error level and accepts at once, inside the call: there is nobody to warn and no UI thread to wait for. It does not log the "no callbacks" error, as this is not a mistake of the caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
obs-rust#2218) OBSBasic hands itself and the translated texts to FallbackWarning once it has loaded, right after OBS_FRONTEND_EVENT_FINISHED_LOADING, so warnings from plugins that loaded with the scene collection show then. At exit, before the scripts shut down and the scene data is cleared, it answers every warning, also the queued ones, while their callers still exist. New strings: FallbackWarning.AcceptAnyway and FallbackWarning.FutureError (Cancel is the existing string). docs/fallback-warning.md gives the rules for every fallback (decision on obs-rust#1092) and how a plugin uses obs_frontend_warn_fallback(). The API reference and the features ledger have their entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
obs-rust#2218) ci/test_tier2_proof_inputs.py finds the crates Tier 2 builds by their names in test/cmocka's CMake files, so the comment that named rust/obs-fallback-warning made it a Tier 2 root, which it is not (Tier 2 builds without the frontend). Say "the C ABI" instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st#2218) A live run showed it: OBS's first-run wizard opens right after the main window has loaded, so a warning that runs then shows behind the wizard, takes no input while it is open, and accepts unseen when the countdown ends. waits_while_another_dialog_is_modal: with a modal dialog open, a warning shows nothing and answers nobody; after it closes, the warning shows (it was not yet counted as shown) and Cancel stops the caller. Without the frontend's Rust it accepts as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) While another modal dialog is open over the visible main window (the first-run wizard opens right after the main window has loaded), the queue does not run: it looks again every 250 ms. It looks before the Rust session counts the warning as shown, so the warning still shows once the dialog has closed. With a hidden main window, at shutdown and without the frontend's Rust, warnings accept as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…log (obs-rust#2218) The live run showed the second half: OBS queues the first-run wizard right after the main window has loaded, so a warning that started just before it is covered by it, takes no input, and accepts unseen when the countdown ends. Waiting before a warning shows does not cover a modal dialog that opens later. countdown_pauses_while_another_dialog_is_modal: while another modal dialog is open the countdown does not move and the warning does not end; after it closes the countdown goes on and accepts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bs-rust#2218) Each tick adds the time since the last one only while no other modal dialog is active; under one the countdown pauses. When that dialog has closed, the warning comes to the front and counts on. So a modal dialog that opens after the warning (the first-run wizard, queued right after the main window has loaded) no longer lets it accept unseen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The policy doc gets the standard words that obs-rust#2218 asks for: the title says what runs without what, the message says what failed, what OBS does instead and what the user can do, "sandbox" and "unencrypted" as terms, "Accept anyway" and "Cancel" as buttons, and the id format. New fallbacks use the helper instead of their own dialogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vpacher
marked this pull request as ready for review
October 25, 2026 08:53
zackees
approved these changes
Oct 25, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: approved.
Checked:
- API:
obs_frontend_warn_fallbackis a new additive export inobs-frontend-api.h(decided on #1092), and no existing declaration changes. The no-frontend path logs the same line and accepts, so other hosts keep working. - Threading:
Warn()copies the strings, logs on the calling thread and hands the request to the UI thread throughinvokeMethod(..., QueuedConnection). All queue state is UI-thread only. Every way out of the dialog ends infinish(), which reports only the first end, and thedestroyedhandler covers a dialog that dies without one. Socbruns exactly once per warning that reaches the queue. - Modal handling: the pump defers while another modal dialog is up, and
tick()pauses the countdown under one. That's the first-run-wizard case the live run found. - Shutdown:
SetMainWindow(nullptr)plussendPostedEventsincloseWindow()answers everything while the callers still exist. - Rust core: the C ABI only converts types, null strings become empty, and the log line strips NULs. The crate is named
obs-<area>, the features ledger has a line, and there are Tier 1 tests plus the cmocka queue, dialog and API tests.
Nits (non-blocking):
docs/fallback-warning.mdsayscbis "never inside the call", but without the OBS frontendobs_frontend_warn_fallbackcalls it inside the call, as the PR body and the rst say. One sentence would align them.- A
Warn()that arrives aftercloseWindow()has flushed the posted events (for example from a source's destroy during shutdown) is queued to an event loop that no longer runs, so itscbnever fires. Callers that freeparamincbwould leak, not crash. You could accept at once when the queue has shut down, or document it.
zackees
pushed a commit
to obs-rust/obs-browser
that referenced
this pull request
Oct 25, 2026
* test: RED warning when the CEF sandbox cannot work When the browser runs without the CEF sandbox (the fallback of obs-rust/obs-studio#1092), it is to warn through the shared fallback warning (obs-rust/obs-studio#2218, obs_frontend_warn_fallback()), not only log. SandboxWarningFor() says whether to warn, with the id "browser.sandbox", the locale keys of the title and of the message for the cause (as root, or no user namespaces and no usable chrome-sandbox), and can_cancel false: the browser has nothing to stop. sandbox-decision.cpp checks every probe case, and that both keys exist in data/locale/en-US.ini (the runner passes its path). The stub never warns, so the four fallback cases fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: warn when the CEF sandbox cannot work SandboxWarningFor() warns only for the fallback: id "browser.sandbox", title "Browser source without the sandbox", and the message for the cause: as root, run OBS as a normal user; else allow unprivileged user namespaces, or install chrome-sandbox setuid root. can_cancel is false. UseCefSandbox() passes it to obs_frontend_warn_fallback() (obs-rust/obs-studio#2218), which logs the error line (also on stderr) and shows the dialog with the countdown once the main window has loaded. The plugin's own "CEF sandbox off" error line goes, as the shared one replaces it; the info line when the sandbox is on, or off on a platform without a probe, stays. Needs obs_frontend_warn_fallback() in obs-studio (obs-rust/obs-studio#2238). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
6 of 7 tasks
chriscoveries
pushed a commit
to chriscoveries/obsrust-fork
that referenced
this pull request
Oct 25, 2026
…s) (obs-rust#2378) Moves plugins/obs-browser from 7bab463c9 to 4583599fe, with: - obs-rust/obs-browser#3: the CEF sandbox where it can work on Linux (obs-rust#1092) - obs-rust/obs-browser#5: os_event_init results checked in module load and ExecuteOnBrowser - obs-rust/obs-browser#6: WebAudio resumes after the audio service dies (obs-rust#2328) - obs-rust/obs-browser#7: browser audio that arrives too late to mix is dropped (obs-rust#2335) - obs-rust/obs-browser#8: the fallback warning when the sandbox can't work (obs-rust#2218) One bump instead of three (obs-rust#2333, obs-rust#2351 and ours), as agreed on obs-rust#2351. docs/features.md gets the two audio lines from obs-rust#2333 and obs-rust#2351 as they are, a line for the sandbox, and the browser on the fallback warning line, which obs-rust#2238 merged on 2026-10-25. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
6 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2218
The shared warning for fallbacks that lower security, as decided on #1092 (#1092 (comment)): OBS logs the fallback at error level (also on stderr), and warns the user with a 3-second countdown that accepts "Accept anyway" by itself, with "This may become an error in a future version of OBS." Plugins call
obs_frontend_warn_fallback(). The callers follow in their own PRs: obs-browser (sandbox fallback, #1092) and the RTMPS fallback (#2205).What changed
rust/obs-fallback-warning: show or accept (a visible main window, once per id per session), what each end means (accepted(end, can_cancel)), the countdown, the log line, and the C ABI.obs-gpu-status-frontendis renamedrust/obs-frontend, the frontend's one staticlib with both C ABIs. It is built whenever cargo is available (OBS_FRONTEND_RUST). Without cargo (theOBS_LIBOBS_BACKEND=Crollback) the frontend configures without it, and fallback warnings only log and accept.frontend/dialogs/OBSFallbackWarning: the caller's title and message, the future-error sentence, a progress bar, "Accept anyway" and, when the caller can stop, "Cancel" as the default button. Not modal. It takes all texts from its caller, so it builds without the frontend (own unity group).frontend/utility/FallbackWarning: logs at once on any thread; then, on the UI thread and never inside the call, shows the dialog or accepts, and calls the caller back once. Warnings wait for the main window, one dialog shows at a time, and at exit the open dialog closes and the rest accept.obs_frontend_warn_fallback(id, title, message, can_cancel, cb, param)inobs-frontend-api.h. Without the OBS frontend (another host) it logs and callscb(param, true)inside the call.OBS_FRONTEND_EVENT_FINISHED_LOADING, and answers every warning incloseWindow()before the scripts shut down and the scene data is cleared.docs/fallback-warning.md(rules, standard wording, usage, code map), the API reference, and the features ledger. New strings:FallbackWarning.AcceptAnyway,FallbackWarning.FutureError.RED → GREEN
obs-tests-gpu: 171 of 171test_fallback_warning_dialogtest_fallback_warning_queue(real Rust staticlib, ownblog())test_frontend_warn_fallbacktest_fallback_warning_queuetest_fallback_warning_dialogobs-studiotarget builds without new warnings.ci/test_build_groups.py,ci/platform_ifdef_ratchet.py, the cmocka and Tier 2 input checks, clippy and rustfmt pass.075262d1fkeeps the crate name out of the test CMake, so Tier 2 still does not build it (ci/test_tier2_proof_inputs.py).obs_module_load(), from a plugin thread, and again with the same id. All three log lines come at once, at error level. The first-run wizard opens over the first dialog: nothing is answered while it is open. After Escape closes it, dialog 1 comes to the front, counts down and accepts. On dialog 2 Return cancels it (Cancel is the default button), so the caller getsaccepted=0. The same id again accepts without a dialog. Every answer runs on the UI thread. The browser sandbox run follows with the obs-browser caller.Checklist
masterdocs/features.md(Scenes and UI, pending merge)-W..., ratchets): nonerust/README.mdlists the crateNotes:
test_properties_dialog_refresh; PR CI builds the frontend on both.ci/test_*.pysuite on macOS fails the same 13 tests as master (environment), and no new ones.AI note: Claude Code (Claude Opus 5.5) wrote the code, the tests, the commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.