What happened
The official E2B JavaScript and Python SDK contracts say that omitting metrics start defaults to the start of the sandbox. Dormice instead applies the shared history resolver with a fixed one-hour default span, so getMetrics() drops retained samples older than one hour.
Focused reproduction:
- Create a sandbox row whose
createdAt is two hours ago.
- Insert retained metrics samples from 90 minutes ago and 10 minutes ago.
- Call the official SDK's
getMetrics() without start.
- Call it again with the sandbox creation time explicitly supplied as
start.
Expected: The default call returns both samples, from sandbox creation through now.
Actual: The default call returns only the 10-minute sample. Supplying start explicitly returns both, confirming that the older data exists and was filtered only by the undocumented one-hour default.
Impact: Monitoring, accounting, and diagnostics integrations silently receive incomplete histories for long-lived sandboxes unless they override what the SDK documents as the correct default.
Relevant code and contract:
packages/server/src/e2b/control.ts:463-479 calls resolveWindow(..., 3600_000, now) rather than using row.createdAt when start is absent.
packages/server/src/db/metrics.ts:238-258 turns an omitted start into endMs - defaultSpanMs.
e2b 2.31.0 SandboxMetricsOpts.start documents “defaults to the start of the sandbox”; Python 2.31.0 documents the same behavior for get_metrics.
dor doctor output
Not applicable — this is an E2B control-plane query default and can be reproduced with a focused database/route test.
Environment
- Dormice commit:
4417ae14938273f5d937c476cf7cdc57e22e53a5
- SDKs checked:
e2b JavaScript and Python 2.31.0
- Executor: independent of executor
- Verification: route/database trace with retained samples on both sides of the one-hour cutoff
What happened
The official E2B JavaScript and Python SDK contracts say that omitting metrics
startdefaults to the start of the sandbox. Dormice instead applies the shared history resolver with a fixed one-hour default span, sogetMetrics()drops retained samples older than one hour.Focused reproduction:
createdAtis two hours ago.getMetrics()withoutstart.start.Expected: The default call returns both samples, from sandbox creation through now.
Actual: The default call returns only the 10-minute sample. Supplying
startexplicitly returns both, confirming that the older data exists and was filtered only by the undocumented one-hour default.Impact: Monitoring, accounting, and diagnostics integrations silently receive incomplete histories for long-lived sandboxes unless they override what the SDK documents as the correct default.
Relevant code and contract:
packages/server/src/e2b/control.ts:463-479callsresolveWindow(..., 3600_000, now)rather than usingrow.createdAtwhenstartis absent.packages/server/src/db/metrics.ts:238-258turns an omitted start intoendMs - defaultSpanMs.e2b2.31.0SandboxMetricsOpts.startdocuments “defaults to the start of the sandbox”; Python 2.31.0 documents the same behavior forget_metrics.dor doctor output
Not applicable — this is an E2B control-plane query default and can be reproduced with a focused database/route test.
Environment
4417ae14938273f5d937c476cf7cdc57e22e53a5e2bJavaScript and Python 2.31.0