fix(mcp): settle render-throttle transient before perf-lever writes return#585
Conversation
…eturn (#519) A renderer-setting write (olo_renderer_settings_set) or scene load (olo_scene_open) landing right after a main-thread stall could return before the editor's render-budget throttle cleared, so the change hadn't actually rendered yet: RendererProfiler::BeginFrame/EndFrame only run inside Renderer3D::BeginScene, which the throttle skips, so GetLastCompletedFrameData() (what olo_perf_snapshot/olo_perf_pass_timings read) stayed frozen on stale pre-change data until an unrelated later frame rendered — the "first write doesn't take effect, repeatable A/B afterwards" symptom from #519's last open item. Both handlers now wait out the throttle/resize transient via AwaitRenderedFrames before returning, mirroring the settle discipline the camera-pose screenshot tools already use for the identical class of problem. Live-verified against a running editor: an immediate olo_renderer_settings_set(depthprepass) + olo_perf_pass_timings pair now shows the change with fresh (non-stale) GPU data on the first read. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughTwo MCP editor tool handlers now block briefly after applying changes, awaiting a small number of rendered frames before returning, to ensure subsequent reads observe updated state. A new integration test validates this settle behavior for the renderer settings tool, and the test is registered in the CMake build. ChangesMCP Tool Settle Wait
Sequence Diagram(s)sequenceDiagram
participant Test as McpPerfSettleTest
participant Host as McpHeadlessHost
participant Tool as McpTools
participant Renderer
Test->>Host: Boot host, warm frames, grant write permission
Test->>Tool: olo_renderer_settings_set(depthprepass=on)
Tool->>Renderer: Apply(setting)
Tool->>Renderer: AwaitRenderedFrames(kSettingsSettleFrames)
Renderer-->>Tool: frames rendered
Tool-->>Test: success result
Test->>Test: Assert frame index advanced by >= 2
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Ran the full MCP test suite locally: `OloEngine-Tests.exe --gtest_filter="Mcp*.*"` → 344 passed, 1 skipped (`McpHeadlessAttachTest.HostUntilDetached`, the interactive-only opt-in test — expected). `McpPerfSettleTest.RendererSettingsSetSettlesBeforeReturning` passes. |
|



Summary
olo_renderer_settings_setandolo_scene_opencould return before the editor's render-budget throttle actually cleared, so a caller readingolo_perf_snapshot/olo_perf_pass_timingsright afterward could see stale pre-change data —RendererProfiler::BeginFrame/EndFrameonly run insideRenderer3D::BeginScene, which the throttle skips for a beat after any main-thread stall (a scene load being the common trigger).AwaitRenderedFrames/IsCaptureUnreadysettle discipline (the same mechanism the camera-pose screenshot tools already use), so a couple of real frames have rendered with the new state by the time either call returns.Test plan
OloEngine/tests/Rendering/PropertyTests/McpPerfSettleTest.cpp(headless MCP host, GPU-gated) assertingolo_renderer_settings_setdoesn't return until the frame counter advances past the settle window.olo_scene_open→ immediateolo_renderer_settings_set(depthprepass=on)→ immediateolo_perf_pass_timingsshows theDepthPrepassGPU sub-pass with fresh (gpuResultsAgeFrames: 1) data; flipping back tooffand re-checking immediately correctly shows it gone.OloEngine-Tests.exe --gtest_filter=McpPerfSettleTest.*— build was still compiling in this environment when I finished; please run before merging if CI doesn't cover it.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests