Repository navigation
Description
Parent
Native Bun APIs: measure and selectively migrate runtime boundaries (#18)
What to build
A reproducible picture of the current environment server's startup, idle CPU, memory, and affected workloads in Bun source and actual standalone-archive builds. Identify which of HTTP/WebSockets, file operations, SQLite, and first-party subprocesses have a measured problem worth prototyping, so later tickets do not migrate APIs merely because their names look native.
This ticket measures and triages; it does not change production adapters or prepare a production refactor.
Ticket-definition review completed on 2026-10-08: Claude Opus 5.5 agrees this ticket is ready for agent implementation with no remaining blockers. Separate review thread. The completed-work review below remains required after execution.
Acceptance criteria
- Read the parent specification and current runtime decisions. Use the checkout's supported Bun pin and capture revision, dependencies, build form, host/OS/architecture, fixture size, readiness milestone, process attribution, and measurement units.
- Reuse the disposable environment-server harness for functional checks. For performance, launch the server entry directly with the pinned Bun, using equivalent serve flags and the server's own origin for source and archive. Exclude Vite, watch mode, launcher CPU, and proxy hops from the source measurements; dev-runner mode is functional evidence only. Any measurement-only harness variant stays outside the repository. Never run against live state or kill processes by matching names/paths.
- Build one fixed representative fixture snapshot once, either from a declared synthetic recipe or a read-only snapshot/copy of real stopped project/thread data. Record project/thread/message counts, plugin databases, size, and hash; copy identical state into every fresh home. Seed plugin/workflow state through a declared fixture if the snapshot tool does not provide it. Raw real-data profiles/heap/logs stay local/private; publish summaries or redacted artifacts, never private conversation contents.
- Build the actual archive from the same measured revision and web assets for the measured target; record its checksum. Its installed execution works without system Node, npm, or Bun. Do not compare a local source revision with an unrelated published archive.
- Declare repeatable workloads covering authenticated HTTP/RPC and Browser streams, file access, core/plugin persistence, and first-party process/helper/service operations. Controlled provider fixtures require no paid account or provider-runtime migration.
- Collect at least five fresh launches for each baseline build form, with identical idle windows of at least 60 seconds after readiness, one authenticated RPC WebSocket connected, and no workload or provider turn. Report per-run results, medians, full ranges, operation latency distributions/tails, and consistent sampling milestones. Sample cumulative per-PID user/system CPU from the same process-rusage source and report its resolution; source measurements attribute the server PID, not its launcher. Use native macOS arm64 as the primary performance host; other native supported-host baselines are optional and any gaps are explicit.
- Report RSS, available platform footprint, and optional JavaScriptCore heap/allocation measurements separately. Measure normal operation before any separately identified GC diagnostic; distinguish the server from child processes and browsers. No short sample is presented as a leak/endurance proof.
- Perform separate CPU/allocation or direct boundary-cost profiling, excluding profiler overhead from timed comparisons. Source-only profiling is allowed if the compiled archive cannot expose profiler flags; identify that limitation and measure direct workload/boundary costs in both forms. Record each boundary's attributable fraction of its preregistered end-to-end workload metric. Counts or missing JavaScript frames alone do not establish cost or its absence.
- Publish a four-boundary triage table: eligible only for a reproducible Bun-specific incompatibility or attributed cost of at least 5%; retained when no qualifying problem exists; inconclusive when attribution cannot resolve a claim. Each row identifies its preregistered workload/metric, per-build median/range, attributed fraction/method, revision, Bun pin, host, and evidence gaps. Inconclusive attribution without an incompatibility authorizes no prototype.
- Deliver a results comment on this issue with versioned links/checksums for disposable measurement tooling, exact commands, fixture recipe, and shareable artifacts outside the repository, so later fresh-context tickets can refresh the same baseline. Private fixture/profile material stays private, with a reproducible public synthetic/redacted recipe where needed. This measurement ticket lands no repository changes and creates no PR.
- Keep the web/server scope, installed distribution, contributor Node tooling, and existing lightweight CI unchanged. No production composition refactors, instrumentation, client diagnostics, broad checks, or runtime/version upgrades land in this ticket.
- Have the completed measurement/triage evidence verified by Claude Opus 5.5 in a fresh separate T3 thread; record its link and resolve blocking findings before completion.
Blocked by
None (can start immediately).
Activity
Igloczek commentedon Oct 8, 2026
Program progress: execution started (2026-10-08)
t3-325d51f7(brancht3/bun-runtime-migration, clean, no stack layer), atorigin/main=d5cee2d8fa(merge of feat(runtime): run the web-only fork on Bun #15)native-bun-19-exec-r1(Codex GPT-6.1-Sol, high reasoning). The brief is kept outside the repository.Status: measuring
Igloczek commentedon Oct 8, 2026
Program progress: completed-work review round 1 (2026-10-08)
mcp:5590e0b2-97bb-4b3e-bde8-04bad293e5bd. It verified the numbers, eligibility calls, archive provenance and privacy. Verdict: CHANGES REQUIRED, on one blocker: the published tooling checksums do not match the scripts that produced the baseline/profile data.native-bun-19-exec-r2). The results comment will be posted after reviewer agreement.Status: fixing review findings
Igloczek commentedon Oct 8, 2026
#19 outcome: complete (measurement/triage; no repository changes, no PR)
perMessageDeflatebut negotiates no extension (Bun 494,592 vs Node 4,206 bytes in matched controls). The CPU fraction is unresolved.node:sqliteexecution is 26.449% (source) and 20.923% (archive) of D1 committed core mutations.Completed-work review: a fresh Claude Opus 5.5 / Gilfoyle review thread
mcp:5590e0b2-97bb-4b3e-bde8-04bad293e5bdran three rounds.BUN_OPTIONSexposes profiler and preload flags in the archive, so archive-form attribution was collected.VERDICT: AGREE — all #19 acceptance criteria satisfied.9425f27. It differs from the final only in four metadata/provenance files and contains no private data.Final artifacts: secret gist revision
8cc8a719. Baseline:d5cee2d8fa, Bun 1.4.2, native macOS arm64. The full report follows.Versioned secret gist: 8cc8a719a3151dc9ca7f2728c3a2291056ef4758 (
public=false). All 92 files verified byte-identical to the published checksum manifest. Historical provenance limitations remain accepted and explicit; the new archive pass has prelaunch-attested tooling. No private database/raw profile/target-bearing span/log/token/pairing URL was published.#19 measurement and triage report
No production changes or native API prototypes. This ticket lands no repository changes and no PR.
Environment and immutable inputs
Revision
d5cee2d8faed9d4923af4f59fdfa7e81009c880c; brancht3/bun-runtime-migration; local and live remote main remained this revision. Bun pin/installed interpreter 1.4.2. Native macOS 27.0.1 / arm64 / Apple M1 Mac mini (Macmini9,1), 8 cores, OS build 26A434. Contributor/client control Node 24.13.0; pnpm 11.10.0 lockfile install. Rust 1.95.0 already installed was used after default Cargo 1.82 rejected edition 2024.No
bun.lockexists. Actual dependency lockpnpm-lock.yamlSHA-256:0481f1411a5b808e3434eea352eac2458a3300119ccfc220432c8c2dd9feb4ee.Build forms: direct pinned Bun
apps/server/src/bin.ts serveand the same-revision actual macOS arm64 standalone archive (ad hoc signed, shippedruntime/bun). Archive 85,231,164 bytes, SHA-256214c518e79ce84a17b39a03c317e856106db793ee1e9c55c41692cca3982c15e. Source web assets and extracted archive client matched byte-for-byte excluding unserved maps; web-assets manifest SHA-25603641dc4f3a21fba0798440745a1d97a57dc58b0ed1aafbe6ce9c8832c810a7a. Installed archive version and full archive transport/persistence/MCP/helper/service fixtures ran with Node/npm/Bun absent from PATH. Baseline safe-bin exposes only git/sh.Readiness = captured server spawn through first published pairing URL. Pairing, one authenticated RPC WebSocket upgrade and six drained HTTP warmups precede idle. Ten fresh copied homes, alternating form order; each idle window 60.063–60.081 seconds, no workload/provider turn. Direct server origins, no Vite/watch/proxy/launcher CPU. Warm filesystem cache; no cache flush, builds or test suites during timed comparisons. No browser or paid account. No forced GC.
CPU is per-PID libproc
proc_pid_rusage(RUSAGE_INFO_V2)cumulative user/system Mach ticks, converted using livemach_timebase_info = 125/3; nominal resolution 41.6667 ns/tick, calibrated against a 200 ms POSIX rusage busy loop. Effective scheduler accounting accuracy is not independently established. Values are milliseconds and percentage of one core. RSS andri_phys_footprintare distinct byte counters, divided by 1,048,576 to MiB and sampled at idle end. Child counters are preserved separately; they are excluded from server CPU. The live native t3-resource-monitor sidecar is also excluded, and its own CPU was not measured. These are server-PID figures, not total installation CPU; aggregate child counters do not resolve the monitor cost. Post-workload vmmap diagnostics are separately timed and do not replace idle-end memory. Workload CPU brackets include client/sampler startup overhead, so primary workload metric is end-to-end wall time.Fixture and preregistration
Built once from a public synthetic recipe: 4 projects / 32 stopped threads / 2,048 messages / 25 Reports / 0 workflow runs, core DB plus plugin catalog/Reports DBs and a 4 KiB workflow placeholder, 4,375,389 bytes. Manifest SHA-256
2cab401236f6543712a9028154d7a5cdd2992ca78d792498d2c5b9795829b3be. Every file hash remained unchanged; all ten stopped copies retained 4/32/2048 records, zero provider runs and zero schedules. Messages are projection-only synthetic history and the 1 MiB.mp4is deterministic range bytes, not a decodable movie. Project/thread creation used actual public events/receipts. The seed script deleted the uncheckpointed workflow WAL; the fixed workflow file has no tables, and each fresh server re-applies its migrations before timed empty-workflow reads. The corrected recipe describes that behavior; the snapshot was not modified. Generated identities/secrets, DB snapshots and raw profiles/logs stay local.Workload declaration at 2026-10-08T19:36:08.688845+00:00, SHA-256
085bd37f33386c4e92759faa8a9a00716dbb544444fa6ef31c9fcca2a40eed2e(corrected nonexistentprojects.listto actualplugins.catalogbefore timing; original declaration hash retained). H1 authenticated HTTP/RPC/upgrades; H2 25-session controlled Browser close path; F1 static/workspace/media range+HEAD/attachment reads; D1 core writes; D2 Reports list/resolve and workflow list/catalog; P1 Git status plus first-party helper/service runtime fixtures. Primary metric is complete batch wall milliseconds with per-operation nearest-rank p50/p95/p99/max; server CPU additionally retained. Full samples and per-run tails are inbaseline.json,latency-tails.json,per-run-results.md.Per-run normal baseline
Median [min,max]; Δ = full max−min range
These are source/archive baselines, not an isolated engine/API comparison. Wide RSS/readiness ranges prevent simple source-versus-archive optimization claims. A 60-second idle pass does not establish leaks or endurance.
Functional evidence
Separate profiling and wire evidence
One source CPU+preload profile and one precise preload-only boundary pass; both excluded from baseline comparisons. Archive got identical direct idle/workload/wire runs. An actual serve-mode argv attempt rejected
--cpu-prof,--cpu-prof-dirand--preload. A correction-round check of the same installed archive withBUN_OPTIONS="--cpu-prof --cpu-prof-dir=<scratch>"reached readiness and emitted a valid CPU profile on shutdown: 365,896 bytes, 2,047 nodes, 681 samples, SHA-2567846630a871b3d57fc1176bd36f4505127c6e7fdb0395a9932d1eca5ad95d177. Captured PID 51205 stopped with exit 130. CPU profiling is supported through the environment. This first startup-only check did not test preload support or workload fractions. The subsequent round-2 checks below establish preload support and archive workload attribution. Seebun-options-check.pyandbun-options-check.json. Version-only flag probing initially returned success because global --version short-circuits parsing; it was not treated as profiler support.Synchronous SQLite spans measure actual API execution; union avoids overlap. File callback intervals measure pending I/O and include queue/scheduling time, so they are upper bounds for intrinsic file cost. FileHandle/promises coverage is incomplete. Spawn API spans exclude child runtime; child lifetime union is reported separately. No operation counts or absent frames establish fractions. CPU profile timeDeltas include off-CPU/idle gaps (up to 5.1601 s) and cannot be used as CPU-duration weights; the observed HTTP checkConnections frame establishes only a hypothesis. Idle CPU attribution remains unresolved.
*These single probe CPU brackets include client startup and source profiler overhead; they are not compression performance comparisons. Byte counters are real TCP data excluding the handshake; the separate handshake counts are preserved.
Application RPC serving explicitly requests perMessageDeflate in server.ts but negotiated no extension in either form. Three same-script Node-compatible
http+wscontrols with perMessageDeflate:true, the same Node client and 100 repeated synthetic responses reproduced: Bun 1.4.2 no extension and 494,592 received bytes every round; Node 24.13.0 permessage-deflate and 4,206 bytes every round. This establishes a Bun-specific compatibility compression problem, not native Bun.serve behavior or a speed gain. Control latencies are not substituted for application baselines.Round-2 actual archive attribution
Startup-only check of the actual archive accepted
BUN_OPTIONS=--preload=<scratch>/preload.cjs; readiness plus 1,868 emitted spans proves preload executed, rather than merely an exit-status flag probe. Fresh unseeded T3/OS homes, captured PID 17086, orderly SIGTERM exit 130. No workload or CPU profiler was used in that check.One separate archive preload-only pass then ran all fourteen main-server sub-batches from unchanged workload.mjs on a fresh
fs.cpcopy of the identical fixed fixture. Captured PID 17240, readiness 1311.543 ms, six drained session warmups, one RPC socket, shutdown exit 130. No idle baseline or wire/Browser/helper fixture rerun. This attribution pass is excluded from every five-run median/range, latency-tail and timed comparison. H2 remains the preregistered separately compiled controlled Browser route fixture, so no main-archive H2 fraction can be resolved; successful JPEG and helper/service-specific attribution gaps remain explicit.archive-r2-prelaunch-hashes.json, written at 2026-10-08T20:57:34.976912+00:00 before either archive launch, records SHA-256 of every root executable tooling file, immutable declaration/fixture manifest, prior measurement inputs and actual control/server executables. Byte copies are retained locally inarchive-r2-tooling-snapshot/. Archive SHA 214c518e… and fixture manifest SHA 2cab4012… were checked, along with each seed file and unchanged workload declaration SHA 085bd37f…. All attested scripts and prior data still matched after the pass. This prelaunch attestation applies only to the new pass; source boundary-pass hashes remain inferred, not pre-run attested, and the accepted historical provenance caveats remain.Fractions use the existing analyzer's union of fully-contained boundary intervals divided by that workload's measured wall duration. Source (S) and archive (A) are separate diagnostic runs, not a paired speed comparison. SQLite spans cover actual synchronous node:sqlite execution (binding plus engine); file callback pending intervals include scheduling and are upper bounds for intrinsic I/O within covered calls; spawn spans cover synchronous parent API calls only. Child lifetime cannot be counted as removable parent API cost. Zero means zero captured fully-contained spans, not absence of cost. Workspace FileHandle reads and parent stream/lifecycle work remain uncovered. Background activity within a window is not causally separated. HTTP work is not wrapped and cannot be derived by subtracting these overlapping/incomplete categories.
boundary-comparison.jsoncarries complete values/counts; sanitized spans allow independent recomputation.D1 archive SQLite 38.244141 / 182.783292 ms = 20.923%, source 37.922363 / 143.379250 ms = 26.449%. Both exceed the 5% triage threshold, with no evidence that bun:sqlite removes this work. Archive attachment pending I/O 28.419189 / 81.618917 ms = 34.819%, source 37.182%; these upper bounds do not qualify a file adapter. Archive P1 synchronous spawn 449.324219 / 12544.984250 ms = 3.582%, source 3.560%; archive child lifetime 96.063%, source 95.817%, is not a parent API fraction. Workflow-catalog spawn is archive 4.810%, source 3.652%, while the earlier source CPU-profile diagnostic sum was 5.044%; scope/noise and incomplete lifecycle attribution still prevent eligibility.
None of the four triage calls changes. HTTP/WebSockets remains eligible because the reproduced deflate incompatibility is unchanged, with boundary CPU/wall fraction unresolved. SQLite remains eligible, now supported by source and actual-archive synchronous execution fractions. File operations remains inconclusive because intrinsic cost/coverage is unresolved. Subprocesses remains inconclusive because measured synchronous spawn is below 5% and parent stream/lifecycle/IPC cost is unresolved. No native API was prototyped or adopted.
Four-boundary triage
All rows: revision d5cee2d, Bun 1.4.2, native macOS 27.0.1 arm64 Apple M1. Milliseconds are median [min,max] and full max-minus-min range. Eligibility authorizes only future isolated evaluation; it does not accept an adapter or authorize this worker to start another ticket.
Provenance correction and reproducibility
The previous claim that the published scripts were the exact measurement-time tooling was incorrect.
tooling-hashes.jsonis an unchanged mid-batch filesystem checkpoint at 19:46:40Z, after the baseline driver started at 19:40:38Z; it is not a pre-launch attestation. The initial startup-loaded baseline entry, runtime module and profile runner were not retained. Their exact producer hashes are unknown.provenance.mdandprovenance.jsonmap every published file to its producing inputs, known hashes and uncertainty, and list known edits and unavailable diffs.shareable-checksums.jsonhashes only the bytes actually published in this correction revision. Current scripts are replay tooling; they are not presented as exact historical producers.The original workload module was reconstructed byte-for-byte (SHA-256
87ad7f17cc719a0867f3a949379d3067b8fe0998fba4fe14f829236cfd845226) and published asworkload-original.mjs; the original preload was retained aspreload-cpu-original.cjs(SHA-256127421e56e6bf755ad1edd5ab61b4ceac3e47519156d0ad5f3a58b345ac2ccd7). The workload diff changes only two epoch labels from Date.now() to high-resolution epoch values, leaving route calls, payloads, counts, order and the monotonic timing loop unchanged. All ten baseline runs and both profile forms contain the same ordered fourteen workloads and expected sample counts. Recorded idle intervals are all 60.063–60.082 s, and the captured command journal proves direct equivalent serving flags and alternating forms. Six session warmups are supported by the pre-run declaration and retained driver; they were not independently request-counted. This is evidence for the declared operation-level replay, with incomplete historical byte-level provenance explicitly retained as a gap. No baseline numbers were replaced or remeasured.SQLite figures and complete F1 metric
26.449% is the SQLite eligibility figure, from the separate preload-only pass with precise epoch timestamps and interval union. The earlier 18.410% is a separate CPU-profiler-plus-preload diagnostic: 39.050758 ms of nonnested synchronous SQLite durations divided by 212.117042 ms. Its denominator is larger than the direct pass's 143.379250 ms and includes CPU-profiler overhead (run variation is not independently separated). The numerator also differs slightly and the historical method summed monotonic durations because its epoch labels were integer milliseconds. The values must not be averaged or substituted for each other.
python3 analyze-sqlite.pyreproduces both from published sanitized D1 span files; no SQL strings, database targets or payloads are included.F1 now reports the sum of all five preregistered 100-operation file sub-batches: static JS, workspace text, media range, media HEAD and attachment, totaling 500 operations/run. The aggregate measures active batch intervals; it excludes signing/setup and sampler gaps between sub-batches.
python3 analyze-f1.pyreproducesf1-summary.json, including all ten aggregate values and per-run pooled operation tails; original route-specific tails remain inlatency-tails.json. Attachment-only attribution remains identified as an illustrative upper bound, not a whole-F1 cost fraction. Drained body-byte totals were not recorded and cannot be recovered reliably from latencies or fixture sizes; this is an explicit metric gap.Carry-forward to #20
Investigate the unresolved dev-runner WebSocket-upgrade timeout before treating the development transport path as proven. Before any HTTP adoption, obtain a representative successful JPEG Browser workload with a slow viewer, bounded pending bytes and close/cancellation behavior against source and the actual main archive, then the requested real-client/remote transport parity evidence. The controlled host-setup-close fixture does not cover that workload.
Explicit gaps
Exact initial baseline/runtime/profile runner bytes were lost; six declared warmup requests were not independently counted. Operation-level replay evidence and all known tooling changes are documented in provenance.md.
F1 drained body-byte totals are missing; resource-monitor sidecar CPU was excluded and unmeasured.
First-party service/helper launch/update/rollback operations have focused functional evidence, but no separate operation-specific latency distribution or complete boundary fraction; timed P1 measures Git status service RPCs.
No bun.lock exists; the actual pnpm lock hash is supplied.
No native Linux x64/arm64 baseline or parity evidence; OrbStack/docker was not started and no emulation attempted.
Synthetic messages are projection-only, not event-replay history; the workflow snapshot has no tables, with migrations recreated per launch and zero workflow runs afterward. Representative active workflow/provider-turn performance and provider SDK replay paths are not measured.
Browser measurements cover controlled host-setup close plus focused frame/ack/auth tests, not representative successful JPEG delivery, sustained slow-viewer backpressure, full main-archive JPEG streaming, or real hosted/remote/relay/tunnel/multi-device clients. No browsers were launched.
Archive argv profiler/preload flags fail in serve mode, but BUN_OPTIONS CPU-profiler and preload flags work. Separate archive preload-only wall fractions are now collected for the fourteen main-server sub-batches. HTTP boundary fraction and main-archive H2/helper-specific fractions remain unresolved because these are not instrumented/covered by the main-server pass. File intrinsic I/O versus callback scheduling and FileHandle/stream costs, and parent process stream/lifecycle/IPC costs remain unresolved. File/subprocess candidates receive no prototype.
Idle timer CPU attribution remains unresolved. No allocation/JSC heap or forced-GC diagnostic was collected; this short run is not endurance/leak evidence. Effective rusage accounting granularity beyond nominal calibrated Mach ticks is not independently established.
One later external tracked dev-runner smoke timed out at WS upgrade, despite the first original and later direct-entry source/archive smoke passes. Cause was not diagnosed in this measurement ticket.
Initial build staging used the default OS temporary directory instead of scratch; its scoped finalizer removed it. All retained measurement material is under the required scratch root; generated repo build/dependency output is gitignored.
PID inventory is incomplete for initial original-smoke supervisors, short-lived samplers and nested compiler/test/Git/helper children. Their owning fixtures awaited exits/finalized captured groups. All journaled direct servers and later smoke/control/Browser supervisors have stop/exit records; no captured process remains active. No process was killed by name/pattern.
Artifact and process audit
Local (unpublished) material includes: environment.json, baseline.json, per-run-results.md, latency-tails.json, fixture-recipe.md, fixture-manifest.json (local identity file hashes only), fixture-summary.json, fixture-integrity.json, workloads.md and preregistration JSON, boundary-attribution.json, profile-workloads.json, browser-results.json, compression-control-results.json, process-summary.json/processes.jsonl, commands.md, archives/t3-0.0.45-darwin-arm64.tar.gz and extracted install. Raw maps/logs/profiles and snapshots remain local. The shareable gist excludes them and includes synthetic/redacted summary/tooling only.
Measured server PIDs, all started/stopped: source 76134, 86749, 91416, 2119, 6388; archive 79257, 82882, 94843, 98814, 9436. Full captured PID inventory and exit statuses are in process-summary.json (93 stopped records, zero active, including both archive startup checks and the round-2 workload pass/supervisor). Shutdown exit 130 is the fixture’s ordinary SIGTERM path; logs show orderly reconciliation. Round-2 captured startup supervisor 17083 and archive 17086, workload supervisor 17239 and archive 17240 all completed/stopped. Short-lived analysis/CLI supervisors and sampler/Git children are not exhaustively journaled; the existing inventory limitation remains. No kill-by-pattern.
Repository HEAD stayed fixed and
git status --porcelain=v1is empty. No tracked changes, commits, branch creation, PRs, GitHub issue comments, merges, releases, packages or deployments. No ~/.t3/userdata access; no browser/computer use. Model/harness: GPT-6.1-Sol, high reasoning, Codex in T3 Code.Igloczek commentedon Oct 8, 2026
Closing: measurement/triage acceptance criteria and the completed-work Opus review gate passed (see results comment above). This ticket lands no repository changes.