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
perf(clone): stream cat-file into import via SDK ImportSession — 0.911s -> 0.754s (2.58x -> 2.22x) on codex
ImportSession holds one pooled connection and the dir-path->ino map across
chunk calls; agentfs clone imports directories up front, then overlaps
blob parsing with bounded-channel import chunks. Also de-flakes
overlay_reads_flag_off test (global counter -> per-inode has_pending).
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .agents/specs/2026-06-12-enosys-open-eliminate-open-release-round-trips-via-kernel-no_open.notes.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,3 +50,8 @@ User comment: none
50
50
**Type**: decision
51
51
**Context**: (1) agentfs clone remeasured on codex under current defaults: 0.911s / 2.58x (n=5, verified) — noopen+uring do not help the write/SQLite-bound path. Stage budget: clone-no-checkout 293ms + ls-tree 34ms + cat-file 124ms + import 355-382ms + index 6ms + mount ~90ms. Pipelining cat-file into import (-120ms) and import txn tuning land ~0.7s (~2.0x); 1.5x (0.53s) is blocked by the whole-state-in-DB double content write (pack + worktree, 2x43MB into SQLite vs native raw-FS writes). (2) Edit phase decomposed: the benchmark fsyncs each edited file; per-edit floor = fsync drain txn (~154us) + close-time WRITE RT + 2 stat GETATTRs (the same kernel close-time STATX_BLOCKS invalidation). Exact-shape micro: default 2.5-2.8ms per 8 edits — the <=3ms target is already met at micro level; the codex 6-7ms adds larger appends, deeper lookups, and noise. Deferred SETATTR (AGENTFS_DRAIN_ON_SETATTR=0) wins the micro -30% but is codex-parity for the third time (edit 7ms, total noisier) — stays opt-in.
52
52
**Resolution**: Neither miss is legitimately knockable to threshold in userspace: clone's floor is the double write (pipeline work would buy ~0.2s but cannot cross 1.5x, offered to user), edit's residual is the same kernel invalidation plus the fsync txn floor. Scoreboard annotated; per-phase work concludes with 5 of 8 at/under 1.5x and every miss carrying a named, measured floor.
**Context**: SDK gained `ImportSession` (`begin_import` / `import_chunk` / `finish`): one pooled connection plus the directory-path->ino map persist across chunk calls, so imports can be fed incrementally; `import_entries` is now the buffered one-shot wrapper over it. `agentfs clone` now imports all directories in one up-front chunk, then a producer thread parses `git cat-file --batch` output blob-by-blob and sends 4MB/512-entry chunks down a bounded channel while the async consumer imports them — the 124ms cat-file stage now hides entirely under import (stage timings: stream-import 369ms ~= old import alone). Codex n=5: median 0.754s vs native 0.340s = 2.22x (was 0.911s / 2.58x). Correctness: byte-identical `diff -r` vs native clone, clean `git status`, `agentfs integrity` all-ok (cross-chunk parent nlink bumps included), SDK 168 tests x3 parallel + CLI 109 green, noopen-coherence 6/6 both modes. Also fixed a pre-existing test flake exposed by the refactor's timing shift: `overlay_reads_flag_off_falls_back_to_drain_on_write` asserted equality on the process-global batcher enqueue counter, which races under parallel tests; it now asserts the per-inode `has_pending` state immediately after pwrite (a strictly tighter check).
57
+
**Resolution**: ~2.2x is the streaming landing, consistent with the floor analysis: remaining budget is git-clone-no-checkout ~300ms + import ~355ms (SQLite ingest of 43MB at ~120MB/s) + mount ~90ms; 1.5x (0.53s) stays blocked by the whole-state double content write. Clone work concludes here.
0 commit comments