Repository navigation
fix(mcp): support network log pagination - #356
Conversation
|
@Prajwal2246 is attempting to deploy a commit to the superserve Team on Vercel. A member of the Team first needs to authorize it. |
|
There was a problem hiding this comment.
sandbox_network_log gains an optional before input so a caller can page past the tool's 200-event cap, forwarded unchanged to the control plane's GET /sandboxes/{id}/network.
Watching
- The control plane's DB pool — the share of connection acquisitions that wait for a free connection, since each page costs two audit queries (
ListNetFlowEvents+ListProxyAuditEvents) on the pool that also serves sandbox lifecycle work, and the loop's length is decided by a model. - Sandbox create/pause/resume/delete failure rate, where pool pressure stops being internal and becomes a failed operation.
- Resumes per pause — the change promises paging stays control-plane-only and never wakes a paused sandbox, and this is the one part of that promise production can falsify.
Would fail it
- Waiting acquisitions rise by 5+ points and at least double against the 24h pre-deploy baseline.
- Lifecycle failures rise 2+ points and 1.5× against baseline.
- Resumes per pause rise 1.5× and by 0.2 against baseline.
One note, since it affects whether the fix works rather than whether it's safe: before is validated as z.string().datetime({ offset: true }), but the server's next_cursor is base64url JSON from encodeNetworkCursor (sandbox:internal/api/handlers_network.go), not a timestamp. The API accepts either form; the new zod constraint accepts only the timestamp, so the loop the tool description advertises looks likely to be refused at the MCP boundary. The test passes because its mock returns an RFC3339 next_cursor.
Note also that neither the MCP server nor that endpoint emits any telemetry today, so whether a second page is ever fetched is not observable from here — the checks above cover the cost of paging, not its success.
changes/superserve-ai--superserve--pr-356 · awaiting merge
|
Thanks for catching this. I checked Fixed in fde8e6e: The regression now uses the backend's encoded |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Related Issues
Fixes #355
Description
sandbox_network_logreturnsnext_cursorbut cannot accept it, so callers cannot retrieve older pages beyond the tool's 200-event cap.Add an optional string
beforeinput, document how to reusenext_cursor, and forward it unchanged to the network-log endpoint. The input supports opaque pagination tokens and RFC3339 time bounds; the backend validates the format. Requests remain control-plane-only and do not resume the sandbox.Additional Context
Regression tests exercise the real MCP transport, handler, and API client with mocked HTTP responses. They cover the backend's base64url-encoded
{t, k, i}cursor, RFC3339 timestamp support, schema discovery, and rejection of non-string inputs. The opaque-cursor case was confirmed to fail with timestamp-only validation and pass after its removal.Testing
Tested locally
Added/updated tests
All tests passing (with the locale noted below)
bun run lintbun run format:checkbun run typecheckbun run docs:check-navLC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 bun run testbun run buildThe initial test run under this Mac's default locale failed two existing console hourly-label assertions (
1 Jun, 5 amversusJun 1, 5 AM). The affected console files are unchanged from upstream; the tests pass with the US locale they expect.MCP: 96 tests passed; 2 credential-dependent E2E tests skipped. No live sandbox/API pagination was tested.
Screenshots/Demo
No UI changes. To run the focused regression: