Prerequisites
Background / Description
When context compression replaces older messages with a summary, WorkspaceBase.offload_context() can preserve the removed messages in sessions/<session_id>/context.jsonl.
The existing implementation extracts Base64 media from top-level DataBlock objects into the workspace data/ directory and replaces the archived source with a workspace:// URL. However, the message model also allows DataBlock objects inside:
ToolResultBlock.output
HintBlock.hint
These nested blocks are not currently inspected, so their complete Base64 payloads remain embedded in context.jsonl.
For example, this is a valid message structure:
AssistantMsg(
name="assistant",
content=[
ToolResultBlock(
id="call-1",
name="get_image",
output=[
DataBlock(
source=Base64Source(
data=image_base64,
media_type="image/png",
),
),
],
state=ToolResultState.SUCCESS,
),
],
)
After offload_context() processes this message, the nested source is still serialized as:
{
"type": "base64",
"media_type": "image/png",
"data": "<complete Base64 payload>"
}
A top-level DataBlock containing the same media is instead stored in the workspace data directory and archived as:
{
"type": "url",
"url": "workspace:///data/<content-hash>.png",
"media_type": "image/png"
}
Nested media should use the same existing offloading behavior. The archived copy should contain the workspace:// source, while the original message supplied by the caller remains unchanged.
#2146 changes only the message copies sent to context summarization and intentionally preserves the original messages used for workspace offloading. This issue covers that separate archival path.
Error Messages
No exception is raised. The complete Base64 payload remains embedded in context.jsonl.
Steps to Reproduce
- Create an
AssistantMsg containing a Base64-backed DataBlock in ToolResultBlock.output.
- Pass the message to
WorkspaceBase.offload_context().
- Read the resulting
sessions/<session_id>/context.jsonl.
- Observe that the nested source still has
"type": "base64" and contains the complete payload.
- Move the same
DataBlock to the top level of the message and repeat the operation.
- Observe that the top-level source is replaced with a
workspace:// URL.
The same omission occurs for a DataBlock inside HintBlock.hint.
Environment
- AgentScope Version: 2.0.10dev
- Python Version: 3.14.7
- OS: macOS 26.6.1 (arm64)
Prerequisites
Background / Description
When context compression replaces older messages with a summary,
WorkspaceBase.offload_context()can preserve the removed messages insessions/<session_id>/context.jsonl.The existing implementation extracts Base64 media from top-level
DataBlockobjects into the workspacedata/directory and replaces the archived source with aworkspace://URL. However, the message model also allowsDataBlockobjects inside:ToolResultBlock.outputHintBlock.hintThese nested blocks are not currently inspected, so their complete Base64 payloads remain embedded in
context.jsonl.For example, this is a valid message structure:
After
offload_context()processes this message, the nestedsourceis still serialized as:{ "type": "base64", "media_type": "image/png", "data": "<complete Base64 payload>" }A top-level
DataBlockcontaining the same media is instead stored in the workspace data directory and archived as:{ "type": "url", "url": "workspace:///data/<content-hash>.png", "media_type": "image/png" }Nested media should use the same existing offloading behavior. The archived copy should contain the
workspace://source, while the original message supplied by the caller remains unchanged.#2146 changes only the message copies sent to context summarization and intentionally preserves the original messages used for workspace offloading. This issue covers that separate archival path.
Error Messages
Steps to Reproduce
AssistantMsgcontaining a Base64-backedDataBlockinToolResultBlock.output.WorkspaceBase.offload_context().sessions/<session_id>/context.jsonl."type": "base64"and contains the complete payload.DataBlockto the top level of the message and repeat the operation.workspace://URL.The same omission occurs for a
DataBlockinsideHintBlock.hint.Environment