Conversation
…iveRoomModel GetInsightActiveRoomModel only read options.modelId from the stored ROOM row. The playground writes that key, but RunAgent resolves the model from engine=, ROOM.MODEL_ID, legacy option keys or the workspace config and only sets it on the cached Room, so MCP tools in an agent run got "No model associated with the room". Keep options.modelId first so playground behaviour is unchanged, then fall back to the cached room's model id, the stored MODEL_ID column and the legacy engine/model/engineId option keys. A missing room now gives a clear error instead of a NullPointerException. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AEekNvT8xFqvVam2ADu1Hu
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Overview
GetInsightActiveRoomModelReactoronly checkedoptions.modelIdfrom a fresh DB fetch of the room.AgentRunnerresolves the model through up to four tiers and sets it only on the cached Room object,never writing it back to the options JSON. The reactor therefore always missed it.
The impact is that anything happening in the agent run that might rely on that reactor silently fails.
Changes
Two changes in
GetInsightActiveRoomModelReactor.execute():1. Use
RoomUtils.getOrLoadRoom()instead ofModelInferenceLogsUtils.getRoomById().getOrLoadRoomchecks the user's in-memory room cache first (insight.getUser().getRoomHash()).During an agent run,
AgentRunneralready resolved and set the model on that cached Room viaroom.setModelId(modelId). The old DB fetch bypassed the cache entirely and got a stale copywith no model set.
2. Broaden the model-ID lookup to match
AgentRunner.resolveModelId().The old code only checked
optionsMap.get("modelId")(the options JSON blob, written by theplayground). The fix checks in priority order:
optionsMap.get("modelId")— playground path, preserved as-is.room.getModelId()— theMODEL_IDcolumn, set on room creation whenengine=is passed toRunAgent, and also set byAgentRunneron the cached room afterresolving from any tier.
engine,model,engineId— written by older callers.Reproduction and Testing
In order to demonstrate the error, completed the following test cases:
All runs used workspace
4b862ba6("MCP Model Detection Test") with Pixel MCP projectac57474e("Model Probe MCP") and tool
GetInsightActiveRoomModel. Model engine in all cases:aa876e7e(Claude Sonnet 4-6 Vertex).RunAgent(engine=[...])— new roomengine=paramNo model associated with the roomaa876e7e-...✓engine=MODEL_IDcolumnNo model associated with the roomaa876e7e-...✓CreateRoom(workspaceId=[...])thenRunAgentwith noengine=CONFIG_JSON.model_idNo model associated with the roomaa876e7e-...✓A null room now throws a clear
IllegalArgumentExceptioninstead of an NPE.