Skip to content

Open the e2b metrics window at sandbox creation, not a 1h span - #87

Open
gjjkbssg wants to merge 1 commit into
BitMiracle-AI:mainfrom
gjjkbssg:fix/e2b-metrics-default-start
Open

Open the e2b metrics window at sandbox creation, not a 1h span#87
gjjkbssg wants to merge 1 commit into
BitMiracle-AI:mainfrom
gjjkbssg:fix/e2b-metrics-default-start

Conversation

@gjjkbssg

Copy link
Copy Markdown

Fixes #84

The official E2B JavaScript and Python SDKs document an omitted metrics start as "defaults to the start of the sandbox". The compatibility route instead ran the shared resolveWindow with the native verb's one-hour default span, so an unqualified getMetrics() silently dropped every retained sample older than one hour.

Change: when start is absent, the e2b route passes the ledger's row.createdAt as the window start. Explicit start/end behavior, the native history verbs, and the live-reading fallback are unchanged (the fallback still only fires for windows that reach "now", which the creation-anchored default satisfies). The span argument stays because the resolver requires one and the native faces still mean it — noted in a comment at the call site.

Test: regression in compat.test.ts mirroring the issue's reproduction — a sandbox created two hours ago (column backdated directly; createdAt is immutable through the ledger) with retained samples at -90m and -10m; the unqualified call and an explicit start=<createdAt> call both return both samples. Verified the test fails against unmodified main and passes with the fix.

Verification: pnpm --filter @dormice/server test 644/644, typecheck clean, biome clean on the touched files, and the e2e e2b suite green against the fake executor via the official e2b SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2b: getMetrics defaults to one hour instead of sandbox lifetime

1 participant