Conversation
RunAgent only overlaid the workspace on the room for the length of a run, so a room started by RunAgent never got ROOM.WORKSPACE_ID or options.workspace saved, unlike a room created with CreateRoom. A run that starts an empty room now saves both, after checking the workspace is active and viewable by the user. Rooms that already have messages keep their saved workspace and still get the per-run overlay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015nRQJ4qQU5EHJvmuq96eDc
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
AgentRunneroverlaid the workspace on the room only for the duration of a run — setting itin memory via
applyWorkspaceOverlayand restoring the original state infinally. A roomstarted by
RunAgenttherefore never hadWORKSPACE_IDoroptions.workspacepersisted tothe database, unlike a room created with
CreateRoom(workspaceId=[...]).The impact is that rooms belonging to an agent are invisible to
GetWorkspaceRoomsand anyother workspace-scoped query, making agent conversation history effectively undiscoverable from
the workspace.
Changes
One targeted change in
AgentRunner.run():Save
WORKSPACE_IDandoptions.workspacewhen RunAgent starts a room with no messages.After the room is loaded and the workspace is resolved, if the room has no messages yet — meaning
this is the first run against it — both fields are written to the database. The check on message
count ensures that rooms already in use keep their saved workspace and are not silently
re-pointed by a later run that passes a different
workspaceId. Rooms with existing messagesstill get the per-run overlay as before.
The save is gated on the workspace being active and viewable by the calling user, matching the
same access checks applied elsewhere in the agent pipeline.
Reproduction and Testing
All runs used workspace
4b862ba6("MCP Model Detection Test") and model engineaa876e7e(Claude Sonnet 4-6 Vertex). Before/after state was observed via
GetWorkspaceRooms(workspaceId=["4b862ba6-..."]).Before fix: only the room explicitly created with
CreateRoom(workspaceId=[...])appeared.Every room started by
RunAgentwas absent regardless of how many times it was reused.GetWorkspaceRoomsbeforeGetWorkspaceRoomsafterRunAgent— new room, workspace passedf137466fCreateRoom(workspaceId)thenRunAgenta2a85513CreateRoom(workspaceId)aloned6a880ced6a880ceAfter the fix,
GetWorkspaceRoomsreturns all four rooms that belong to the workspace.Existing rooms with prior messages are unaffected: they retain their persisted workspace and
still receive the per-run overlay for the duration of the run.