Repository navigation
perf(daemon): stop eagerly loading the CLI schema layer and screenshot surface - #3373
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
dcc9524 to
72f840a
Compare
|
Review comments addressed in On the size report's startup medians: those two scenarios exercise the CLI surface, which does not traverse the closure this PR trims, so they neither confirm nor refute the claim. They do show no regression there (+1.5 ms on |
|
The red iOS
Why it could not have been caused by the diff. The failing step was the The risk that deferring 183 files could actually carry is losing an import-time registration. I enumerated all 183 removed modules and scanned each for module-scope side-effect statements: none. Deferral therefore cannot drop a registration the The scenario also failed at different global step numbers across the two attempts (83 then 93), consistent with a host-side CoreSimulator stall in the area upstream is actively settling (#3356, #3354). |
|
The code in 72f840a looks right to me, but I'm holding the final call until two checks that were not run get run. I did not re-run the base closure count (651/102,898); I reproduced only the head count, from an exported copy of the commit. I also did not build the dist bundle, so nobody has checked that the deferred ./screenshot-runtime.ts chunk resolves in the shipped output. I relied on the package check and smoke lanes for that. I did not re-run the test suite either, and the claim that the new test fails on a typo'd specifier comes from reading the code path, not from a mutation run. Could you confirm the base count and that the built daemon loads the screenshot chunk? All 19 checks pass on this head. One iOS Smoke lane failed earlier at Not blocking, and you can take or leave these: the docblock on resolveUserConfigPath in path-resolution.ts could be one line stating the contract, without the zone count that will go stale. The comment above the dynamic import in generic-runtime-execution.ts and the new test comment at generic-route-runtime-completeness.test.ts:149 narrate more than AGENTS.md wants, so one line or nothing is enough. Is there a simpler shape than the two edge cuts here? I looked and found none. The helper could not stay in cli-config.ts, because that file pulls in the schema layer. Both earlier inline threads are fixed at this head, so you can resolve them: the HOME pin in the path-resolution tests (#3373 (comment)) and the timing-narration comment (#3373 (comment)). |
…t surface Plugin discovery imported the CLI config loader for one path helper, dragging option schemas and every command family into the daemon's eager closure; that plugins -> commands edge was the zone graph's only one. The helper needs only env and the home expansions, so it now lives beside them in host-kit, which both callers already imported. The generic dispatcher imported the screenshot runtime statically while awaiting it on a request-only branch. Behind that branch it owns the in-process command surface and the interaction implementations beneath it. Measured over value edges from src/daemon.ts: 651 files / 103,629 loc -> 468 files / 76,166 loc. Both cuts are needed for the full win; seven files drop only when neither path stays eager.
72f840a to
37b22ba
Compare
|
Correction + full diagnosis of the iOS My earlier comment claimed the red lane was a one-off. It is not: across four attempts the lane failed three times, in three different places.
The lane is pre-existing flaky infrastructure, and I should have checked its history before reasoning from first principles. It has failed the same way on unrelated branches and on For the startup failure specifically I measured rather than argued, A/B on the built artifact (5 boots each, fresh state dir, timing until One correction to a claim in my previous comment. I said I had scanned the 183 deferred modules for import-time side effects and found none. My filter skipped Re-scanned properly, the property that actually matters is that none of it is a hidden registration. There are zero bare side-effect imports ( |
|
This PR is ready. At 37b22ba the evidence asked for earlier is reproduced: the base count and the built chunk both resolve and load. The two inline fixes also landed, and the two cubic-dev-ai threads (#3373 (comment) and #3373 (comment)) are fixed at this head, so the author can resolve them. Not blocking: the comment at src/daemon/tests/generic-route-runtime-completeness.test.ts#L66 says a bundler that dropped the chunk would fail the test, but the test imports from source, so it never loads the built chunk; drop that phrase or add a packaging check that imports the built screenshot-runtime chunk. Take it or leave it. All 19 checks pass or are skipped. The iOS Smoke lane failed earlier in three places, and the author reports the same failures on main. It is green on this head, and the author's boot timing shows no slowdown. I did not run the test suite or a mutation run of the new completeness test, and I did not take a live screenshot through the built daemon. The Linux replay lane the author cites is the screenshot evidence. The iOS Smoke history on main and the 5-boot timing are the author's numbers, and I did not re-derive them. No conflicts. Nothing else stands in the way of a maintainer merge. |
|
Summary
The daemon's eager closure carried two edges that did not match what their callers needed.
Plugin discovery imported the CLI config loader for one path helper,
resolveUserConfigPath, pulling option schemas and every command family into daemon startup. The helper needs onlyenvand the home expansions it already sat beside, so it now lives in@agent-device/host-kit/file, which both callers already imported. Thatplugins -> commandsvalue edge was the zone graph's only one between those zones; it is gone.The generic dispatcher imported the screenshot runtime statically while awaiting it on a request-only branch, beneath which the leaf owns an in-process command surface. It now loads at the branch.
8 files, no scope beyond these two edges.
Validation
6eef69a9f837b22baf99pnpm depgraph, over value edges fromsrc/daemon.ts; both cuts are needed for the full number. Rebased onto currentmain, which added eagerly-imported platform files; the cut holds.pnpm check:affected --runon37b22baf99: all runnable checks passed, plus layering, format, lint, typecheck and the eager-closure budget gate, no stale approval row.The new completeness test enters the screenshot arm, which no existing test did, and fails on a typo'd specifier. The shipped bundle resolves the specifier relative to the awaiting chunk, and the Linux replay lane captured real screenshots through the changed arm.
loc is a proxy, not a timing claim: the distribution bundles packages, so no startup-latency number is asserted.