fix(sandbox): serialize only sandboxId to prevent Jackson circular dependency#108
Open
itxaiohanglover wants to merge 1 commit into
Open
fix(sandbox): serialize only sandboxId to prevent Jackson circular dependency#108itxaiohanglover wants to merge 1 commit into
itxaiohanglover wants to merge 1 commit into
Conversation
…pendency writeValueAsString(sandbox) triggers getDesktopUrl() which calls managerApi.getInfo(sandbox) in remote mode, causing infinite recursion and StackOverflowError. Fix: serialize only sandboxId (same as local mode) instead of the full Sandbox object. The remote API only needs the sandbox ID for container lookups. Fixes agentscope-ai#105
|
|
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 #105
Problem
SandboxServiceremote mode methods callmapper.writeValueAsString(sandbox), which triggers Jackson to traverse all getters includinggetDesktopUrl(). In remote mode,getDesktopUrl()callsmanagerApi.getInfo(sandbox), which callswriteValueAsString(sandbox)again — creating an infinite recursion that results inStackOverflowError.What changed
Replaced all 5
writeValueAsString(sandbox)calls withwriteValueAsString(Map.of("sandboxId", sandbox.getSandboxId())):createContainer(Sandbox)— line 153getInfo(Sandbox)— line 539listTools(Sandbox, ...)— line 602callTool(Sandbox, ...)— line 633addMcpServers(Sandbox, ...)— line 663The remote API only needs the sandbox ID for container lookups — same as local mode (
sandboxMap.getSandbox(sandbox.getSandboxId())).Validation
@JsonIgnoreongetInfo()was already correct — the issue wasgetDesktopUrl()lacking it@JsonIgnoretogetDesktopUrl()because it prevents any future getter from causing similar issues