Repository navigation
refactor(limrun): write the network HAR on artifacts and close instead of live - #4080
Conversation
…d of live Keep completed requests in memory, capped at 500 entries with 64 KiB bodies, and write the HAR file when artifacts or close asks for it. This drops the live rewrite loop, the 8 MiB UTF-8 ring, the async write queue, the 32-capture retention with deletion, and the path checks. Failures become a count plus the last typed kind and Limrun's last dial failure reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
… and correct the host-limit help Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the change. I found one problem at 4c7714c that should be fixed before merge. CI is green: 20 checks, none failing. There are no conflicts. Truncation is counted as a failure, and it hides real failures. In network-har.ts:110, Not blocking, and you can take or leave these: the eviction loop at runtime.ts:430 deletes in capture-start order, so it can evict the record just written for the current lease and any live lease whose capture is On the earlier inline threads, all now resolved: the in-place rewrite of the advertised path still applies (#4080 (comment)) and so does the settle-order point on the 32-record bound (#4080 (comment)). The other eight are fixed or benign at this commit: #4080 (comment) (chmod after write, fixed), #4080 (comment) (failing hosts vs bypass, fixed), #4080 (comment) (docs wording, fixed), #4080 (comment) (retry path already covered), #4080 (comment) (close routed and asserted, fixed), #4080 (comment) (release writes before shutdown), #4080 (comment) (providerSessionId restores the old contract), #4080 (comment) (no drain on tunnel close, docs no longer claim a final HAR). I did not reproduce the live Limrun run. It was taken before this commit added the chmod and the eviction loop, and neither touches device dispatch, so it is not required. I did not run |
Truncation no longer goes through the failure count, so an earlier request-failed or inspection-error stays in failures.last. Released capture records are evicted in settle order and only for leases whose session is gone. A failed HAR write keeps its error message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, addressed in 2ba9ed2. Blocking: truncation hid real failures. Non-blocking notes:
Checks: |
|
The code looks good at 2ba9ed2. The earlier findings from the first review are fixed, and the two new tests now fail on the previous commit. Not blocking: the 33-lease eviction test allocates and releases each lease back to back, so deleting the delete-then-set at runtime.ts:432-434 keeps both new tests green and the settle-order comment is not pinned. You can take or leave a fix: allocate one extra capture before the loop, release it inside the loop before the last two releases, then assert it is still ready while released-0 and released-1 are gone. On the open inline threads: the eviction thread (#4080 (comment)) is fixed at this head and covered by the 33-lease test, and it is already resolved. The in-place rewrite thread (#4080 (comment)) does not apply: the path rewrite at network-har.ts:158 is unchanged, and artifacts and close are the only writers, which the earlier review accepted. It is already resolved too. CI is green: 20 checks reported and none failing at 2ba9ed2. There are no conflicts. Cubic has not re-reviewed this head. I did not run check:affected or the provider-limrun tests locally, and I did not do a new live Limrun run, since this change only touches failure accounting and record eviction. I did not verify that the daemon serializes artifacts and close for one lease. Events that arrive between the release write at runtime.ts:430 and capture.close() at :440 are not in the HAR, which the earlier review accepted. |
Summary
Follow-up to #4043. It keeps the same flags and replaces the live HAR file with a simpler design.
--provider-network-logskeeps completed requests in memory.artifactsandclosewrite them to<state-dir>/network-har/<lease-id>.har(mode 0600) and print the path.inspection.maxBodyBytesand the SDK assembler). The capture keeps the latest 500 requests and counts each dropped request ashar-truncated.metadata.failures = { count, last: { kind, host, port }, lastDialFailure }.kindis typed.lastDialFailureis Limrun's typed reason, such asdns_not_found. No error text is matched.providerSessionId, and their tests (network-har.test.tsand four runtime tests). Two runtime tests remain: a capture writes a private HAR with its failures onartifactsand at release, and a capture that can't start is an unavailable artifact.limrun.mdsays traffic exits through the machine that runs agent-device, the HAR holds secrets, and pinned, DNS-over-HTTPS and HTTP/1.1-only TLS hosts can't be captured. It also tells users to pass--provider-network-hosts.Why not Limrun's persisted HAR:
inspection.persistuploads anetworkLogsession artifact (listSessionArtifacts(id, 'networkLog')→downloadUrl) only after the tunnel stops.artifactsmust work mid-session, so the in-memory entries are needed anyway, and they cover close too.Diff vs main: 9 files, +291/−1009. #4043 by itself was +1377/−31; the two together are +647/−30.
Validation
pnpm check:affected --runat fae6cb3 and 4c7714c (head): format, lint, typecheck, layering, fallow and build pass.vitest-relatedfails only on two Apple timing tests under host load average ~240.ios-record-tracealso fails on clean main f1a17d9.apple-platform-output-guardpasses alone on this branch (2 of 2 runs).docs-linksanddocs-prosepass viapnpm gate. At d252150, which has the same feature files, all 25 remaining static gates passed viapnpm gate.check:affectedthere fails only onios-record-trace, which also fails on main.docs-linksanddocs-prosepass.connect limrun --platform ios --provider-network-logs --provider-network-hosts httpbin.org,agent-device-missing-q7z.com,open https://httpbin.org/get, thenopen https://agent-device-missing-q7z.com/.-rw-------and the directory isdrwx------. After disconnect anddaemon stop, the Limrun API listed no non-terminated iOS or Android instances.🤖 Generated with Claude Code