You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JdbcAgentStateStore via JdbcDistributedStore.create(dataSource).agentStateStore()
scenario
HarnessAgent (project mode) with E2B sandbox filesystem
Problem
After switching the Harness stateStore from JsonFileAgentStateStore to JDBC, every agent run ends with two warnings and the sandbox resume state is never persisted:
WARN SandboxManager - [sandbox] Failed to persist sandbox state:
Failed to save sandbox state for SandboxIsolationKey{scope=SESSION, value='01M31AQP7A24X0Y4A12RKADD5P'}
Caused by: java.lang.IllegalArgumentException: Session ID cannot contain path separators
at io.agentscope.extensions.jdbc.state.JdbcAgentStateStore.validateSlotId(JdbcAgentStateStore.java:548)
at io.agentscope.extensions.jdbc.state.JdbcAgentStateStore.save(JdbcAgentStateStore.java:126)
at io.agentscope.harness.agent.sandbox.SessionSandboxStateStore.save(SessionSandboxStateStore.java:60)
Root cause
Two framework pieces disagree on the sessionId contract:
SessionSandboxStateStore.slotSessionId packs the isolation key into a slash-separated sessionId:
JdbcAgentStateStore.validateSlotId rejects any slot containing / or \\:
if (slotId.contains("/") || slotId.contains("\\\\")) {
thrownewIllegalArgumentException("Session ID cannot contain path separators");
}
The path-separator restriction only makes sense for file-backed stores (JsonFileAgentStateStore splices the sessionId into a directory path); a SQL column has no such limitation. But since the restriction exists, the sandbox store — a core in-house caller — violates it, so sandbox resume state can never be persisted to any JDBC backend. File-backed stores happen to work only because / doubles as a directory separator there.
Expected
Either:
Encode the isolation key in slotSessionId (e.g. URL-encode or join with a safe delimiter) so generated slot IDs satisfy the documented store contract; or
Relax validateSlotId for backends where the slot is an opaque column value (JDBC/Redis), keeping the strict check only in path-based stores.
Option 1 is safer (keeps cross-backend slot compatibility); option 2 fixes only JDBC.
Workaround (app side)
We wrapped the JDBC store in a decorator that URL-encodes (userId, sessionId) before delegating (bijective, plain ULIDs unaffected). Works, but this really belongs in the framework.
@shanhongyu Hi, you are listed as the author of JdbcDistributedStore / JdbcAgentStateStore in the javadoc. Could you take a look at this incompatibility when you have a moment? The sandbox state store (core caller) generates slash-separated slot IDs that validateSlotId rejects, so sandbox resume state can never reach any JDBC backend. Details and two fix options are in the issue body above. Thanks!
JdbcAgentStateStore.validateSlotId (agentscope-extensions-jdbc/.../JdbcAgentStateStore.java:582-592) throws IllegalArgumentException for any / or \.
No intermediate path sanitizes the slot ID (SandboxLifecycleMiddleware.releaseForCall → SandboxManager.persistState → SessionSandboxStateStore.save), so every JDBC-backed sandbox state write fails and is only logged as a warning — sandbox resume state is silently never persisted.
Impact:JdbcAgentStateStore users with harness sandbox enabled; Redis / Mongo / JPA / OSS / COS backends are unaffected. Severity: High (functional blocker; silent data-loss of sandbox resume state).
Fix direction: of the two options in the report, relaxing validateSlotId in the JDBC store (option 2) is the smaller, non-breaking change — slotId is an opaque prepared-statement column value there, and option 1 would alter persisted slot identities for file/Redis backends. The path-separator guard only makes sense for path-based stores. Maintainer input welcome on whether the guard should additionally move into JsonFileAgentStateStore-style stores explicitly.
Hi, I would like to work on this issue, following the evaluation's fix direction (option 2):
Relax the path-separator guard in JdbcAgentStateStore.validateSlotId — the slotId is only ever used as an opaque prepared-statement bind value there, while SessionSandboxStateStore legitimately generates slash-separated slot IDs (sandbox/session/..., sandbox/user/<agentId>/...).
Keep the remaining validations (null/blank, length, etc.) unchanged.
Add a regression test persisting a sandbox-shaped slot ID (sandbox/session/<ULID>) end-to-end through the store's save path.
Whether the guard should move explicitly into path-backed stores (JsonFileAgentStateStore-style) I will leave as the open maintainer question noted in the evaluation.
Activity
chcodex commentedon Sep 21, 2026
@shanhongyu Hi, you are listed as the author of
JdbcDistributedStore/JdbcAgentStateStorein the javadoc. Could you take a look at this incompatibility when you have a moment? The sandbox state store (core caller) generates slash-separated slot IDs thatvalidateSlotIdrejects, so sandbox resume state can never reach any JDBC backend. Details and two fix options are in the issue body above. Thanks!oss-maintainer commentedon Sep 21, 2026
Issue Evaluation
Category:
bug| Status: ConfirmedVerified against current
main(8ca0080ed). All claims reproduce at the code level:SessionSandboxStateStore.slotSessionId(agentscope-harness/.../sandbox/SessionSandboxStateStore.java:84-92) always emits slash-separated slot IDs (sandbox/session/…,sandbox/user/<agentId>/…).JdbcAgentStateStore.validateSlotId(agentscope-extensions-jdbc/.../JdbcAgentStateStore.java:582-592) throwsIllegalArgumentExceptionfor any/or\.SandboxLifecycleMiddleware.releaseForCall → SandboxManager.persistState → SessionSandboxStateStore.save), so every JDBC-backed sandbox state write fails and is only logged as a warning — sandbox resume state is silently never persisted.Impact:
JdbcAgentStateStoreusers with harness sandbox enabled; Redis / Mongo / JPA / OSS / COS backends are unaffected.Severity: High (functional blocker; silent data-loss of sandbox resume state).
Fix direction: of the two options in the report, relaxing
validateSlotIdin the JDBC store (option 2) is the smaller, non-breaking change —slotIdis an opaque prepared-statement column value there, and option 1 would alter persisted slot identities for file/Redis backends. The path-separator guard only makes sense for path-based stores. Maintainer input welcome on whether the guard should additionally move intoJsonFileAgentStateStore-style stores explicitly.Automated evaluation by github-manager-bot
aiyili commentedon Sep 21, 2026
Hi, I would like to work on this issue, following the evaluation's fix direction (option 2):
JdbcAgentStateStore.validateSlotId— the slotId is only ever used as an opaque prepared-statement bind value there, whileSessionSandboxStateStorelegitimately generates slash-separated slot IDs (sandbox/session/...,sandbox/user/<agentId>/...).sandbox/session/<ULID>) end-to-end through the store's save path.JsonFileAgentStateStore-style) I will leave as the open maintainer question noted in the evaluation.PR coming shortly.
fix(jdbc): 放宽 validateSlotId 的路径分隔符限制,允许沙箱形状的 slot ID
fix(postgresql): 废弃模块同样放宽 validateSessionId 的路径分隔符限制
fix(jdbc): allow sandbox-shaped slot ids containing path separators (a…