Skip to content

review: whole-repo round — claims projection off the claim path, single-pass find/list, outbound frame cap, typed SDK errors - #126

Merged
CMGS merged 6 commits into
mainfrom
review/night-2026-09-03
Sep 2, 2026
Merged

CMGS merged 6 commits into
mainfrom
review/night-2026-09-03

Conversation

@CMGS

@CMGS CMGS commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Whole-repo quality round for sandbox (sandboxd, silkd, boot/init, protocol/wire, sdk/go, sdk/python, sdk/langchain, mcp, e2e).

Hot paths, measured:

  • sandboxd claim path: the claims projection is kept incrementally instead of rebuilt under the manager mutex per claim — 5000 live claims: 580 µs / 5018 allocs → 30 ns / 0 allocs (same-machine A/B, interleaved).
  • silkd fs.find: one blocking pass with batched, bounded streaming instead of three async hops per file — 10 000-file tree on .79, same sandboxd and rootfs, July silkd vs this silkd: 350–670 ms → 51–76 ms (3 claims × 5 calls each).
  • sandboxd startup egress resync: one netlink listing instead of one socket per adopted claim; mesh epoch persisted as a leased ceiling (2 fsync/s under churn → 2 per 1024 bumps).

Correctness:

  • silkd writes enforce the same 8 MiB frame cap every client enforces (the connection fails server-side with a log line instead of the client rejecting the frame); fs.replace skips files over the find bound; a started LSP server nothing attaches is reaped after 300 s; init waits for all NICs against one deadline.
  • Python SDK: socket/decode failures are typed (ProtocolError, StreamTimeout); proxy_port joins the outbound pump before close (parity with the Go SDK); langchain exec states its 5-minute bound.
  • Go SDK: Pty.Write chunks at the stdin chunk size; decoder tables are compile-checked through named pointer constraints.
  • docs/sandboxd-api.md: reconcile records nothing for the claims it drops.

Style and docs: comment budget applied across every module (test files carry no comments), one-line docs, modern Go 1.27 and Rust idioms (LazyLock, let-else), README/Makefile state the real reason for GOWORK=off (the workspace includes these modules).

Held: truncation/batching for git.status and find frames over the cap (wire change), parallel EROFS mounts (needs a boot trace A/B), the pkg-level fake hoist (inverts the module DAG), sandboxd's cocoon vm list per e2b request (caller-side fix in sandbox-operator).

Gates: GOWORK=off make go-lint (10 × 0 issues: five modules × two GOOS), golangci-lint fmt --diff clean in every module, asl ./... on both GOOS, go test -race -count=1 in every module, sandboxd tests in a Linux container (golang:1.27, linux/arm64); silkd and boot/init: cargo fmt/clippy -D warnings/test on macOS and in a Linux container (rust 1.98.0); ruff check + pytest for the Python SDK (153) and langchain (6).

CMGS added 6 commits September 3, 2026 03:39
…ngle listing, leased mesh epoch, comment budget

The claim store keeps its persisted projection incrementally (set/del/mark
under the store mutex, the file write under a second one), so a claim no
longer copies every live claim under the manager mutex (5000 claims: 580 µs
and 5018 allocs → 30 ns, 0 allocs). Startup egress resync lists locked taps
once instead of one netlink socket per claim; the mesh epoch is persisted as a
leased ceiling so gossip churn stops fsyncing twice a second; the guest port
handshake reads through the existing buffered reader; docs/sandboxd-api.md
states that reconcile records nothing for dropped claims. Test files carry no
comments; the comment budget is applied across the daemon (−1683 lines).
… frame cap, LSP attach TTL, typed errors

fs.find walks the tree in one spawn_blocking and streams batched matches
through a bounded channel (10k files on .79: 350–670 ms → 51–76 ms); fs.list
scans a directory in one blocking pass; fs.replace skips files over the find
bound; the write side enforces the same 8 MiB frame cap every client enforces;
watch drains up to 64 events per write; the LSP broker drops its three
Arc<Mutex> and reaps a server nothing attaches within 300 s; session ids come
from getrandom; init waits for every NIC against one deadline. The Python SDK
wraps socket and decode failures as ProtocolError/StreamTimeout, joins the
proxy pump before close, and the langchain toolkit states its 5-minute exec
bound.
…decoder tables, comment budget; README and Makefile go.work wording

Pty.Write chunks like every other writer so a large paste cannot exceed the
frame cap; the decoder tables use named pointer constraints so a mispaired
entry fails to compile; frameTag returns bytes (one allocation off every
decoded frame); apiError drains its body for connection reuse. README and
Makefile now say why GOWORK=off is needed: the workspace includes these
modules, CI has none.
Reconcile's ordering rule, recLock's shared mode, the recLocks eviction rule,
the S3 lifecycle rule behind SweepStaging and the randHex suffix on the wake
return path each carried a fact the code cannot show; they return as one-line
comments.
…API error bodies

A client that vanishes between lsp_request taking the stdio halves and the
Ready write left a child the attach TTL no longer covered; the write error now
reaps it. The Go SDK's apiError drains resp.Body itself instead of the already
exhausted LimitReader. The watch e2e no longer assumes the first event after
ready is its own write: FSEvents replays the watched directory's creation
first on macOS.
@CMGS
CMGS merged commit d19b677 into main Sep 2, 2026
4 checks passed
@CMGS
CMGS deleted the review/night-2026-09-03 branch September 2, 2026 20:18
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.

1 participant