From 1ec8fc2b0e8ae5f957156bde8fbc0de11a8b30cd Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Thu, 8 Oct 2026 15:36:48 -0400 Subject: [PATCH] Start typed renderer workers before first ordered ACP update --- .../SOURCE.md | 102 ++ .../baseline-timings.json | 892 ++++++++++++++++++ .../before-consumers.txt | 32 + .../installed-timings.json | 851 +++++++++++++++++ .../proxy-timings.jsonl | 21 + src/toad/app.py | 16 +- src/toad/render_backend.py | 37 +- src/toad/render_processes.py | 28 +- src/toad/render_service.py | 6 +- src/toad/work_preparation.py | 4 - tests/renderer_warmup_pilot.py | 83 -- 11 files changed, 1943 insertions(+), 129 deletions(-) create mode 100644 evidence/cold-validation-bootstrap-20261008/SOURCE.md create mode 100644 evidence/cold-validation-bootstrap-20261008/baseline-timings.json create mode 100644 evidence/cold-validation-bootstrap-20261008/before-consumers.txt create mode 100644 evidence/cold-validation-bootstrap-20261008/installed-timings.json create mode 100644 evidence/cold-validation-bootstrap-20261008/proxy-timings.jsonl delete mode 100644 tests/renderer_warmup_pilot.py diff --git a/evidence/cold-validation-bootstrap-20261008/SOURCE.md b/evidence/cold-validation-bootstrap-20261008/SOURCE.md new file mode 100644 index 000000000..d0d2729d3 --- /dev/null +++ b/evidence/cold-validation-bootstrap-20261008/SOURCE.md @@ -0,0 +1,102 @@ +# First-update validation and worker startup + +Based on current main 6d741e75d (merged583, production source identical to +installed c22db896f). Earlier80d9 remains published/integrated. Core608d5033 and +84c312dd are retained checkpoints in the same cold-open workflow. Original clocks +remain in their original evidence files; buffered-line gaps are not capture costs. + +## Required ingress and delivery + +AgentProcess reads a line, logs it, and awaits IncomingWireMessage.receive. +Ordered session/update dispatch enters SessionNotificationOwner.receive under +its existing lock and captured ClientSessionRequest. ApplicationValidationOwner +submits ValidateSessionUpdateTask through PreparedRenderer/PreparationRuntime. +The worker validates the official SDK SessionNotification, then NotificationItems +checks the SDK plan policy that otherwise silently drops invalid entries. +decode_updates independently validates backend extension facts through FieldCodec. +These are different required answers, not duplicate decoders. + +DecodeCommsMetadataTask handles request/response metadata that is not a complete +SessionNotification. Load metadata carries configuration/goal/queue/cursor facts; +the original supplied history page arrives in TranscriptSnapshotUpdate. Removing +response decoding or substituting that page would lose independently changing +metadata. Both original task types and their codecs remain unchanged. + +RenderTask.capture_result owns validation and the declared prepared representation. +The process pool transports PreparedValue; Renderer/PreparationRuntime materialize +it in existing thread workers, then validate delivery. SessionNotificationOwner +rechecks captured authority before typed MRO dispatch. Snapshot publication retains +original session/surface/source fences, preparation and mounted-frontier admission. +Notification ordering and source/session currentness are unchanged. + +## Repair through original startup owners + +App.on_load now starts its selected existing renderer. RenderProcessPool.start +acquires its configured workers once, using the original executor field. Importing +or constructing a pool still starts nothing. RendererSpawn owns shared real pool +launch; both the local pool and independent RenderService use it. The persistent +service retains its original build checks, request identity and lease lifetime. +Remote clients still connect on demand. + +The shared initializer clears inherited agent identities, then imports the actual +sdk_boundary declarations. Required SDK/schema imports now finish during worker +bootstrap instead of unpickling the first ordered task. No fake notification, +dummy rendering task, second registry, adapter or cache is created. + +Deleted the first-paint warm-up flag, App display trigger, Renderer Markdown/Patch +dummy submissions, PreparedRenderer forwarding method and their obsolete pilot. +Formatting/preparation now receives actual viewport work. Existing spawn context, +capacity, cancellation accounting, worker replacement and joined shutdown remain. +CPython ProcessPoolExecutor has no public prestart operation: RendererSpawn uses +its original launch/manager hooks before submissions and closes the executor if +launch raises. Qualification here is Python3.14.2, the required installed runtime. + +AST via NRA covered Core, current Toad and native production roots:862 modules, +zero omissions. Determining sites are in before-consumers.txt. Changed modules +were parsed/compiled and their installed bytes verified against wheel/source. +Dynamic external/pickle imports are not exhaustively resolved by this AST pass. + +## Installed original saved attachment + +Both comparison runs use Core84c312dd, native0fbb915d, ACP SDK0.12.1, original +saved agent-comms-ux owner477574 and canonical frontier147260275. Baseline is +installed c22db896f/current-main source; candidate contains this owner repair. +Both use copied original settings and actual captured seven visible categories. +No source/session fork, owner restart, user/provider input or global installation. + +The existing observer was corrected to import App/SDK instrumentation only inside +its guarded main. Previously, spawn replayed those top-level observer imports in +children, unlike the guarded installed CLI. Original old clocks are retained, +but their1.342/1.498s handler durations are not the corrected baseline below. + +| Seconds | Current-main baseline | Completed candidate | +| --- | ---: | ---: | +| First ApplicationValidationOwner call | 0.543 | 0.021 | +| Initialize | 2.587 | 1.210 | +| Session-load | 1.152 | 0.546 | +| App open to visible history | 5.427 | 4.133 | + +Starting processes alone left first validation at0.446s. Required SDK declaration +imports were still deferred to the first task; moving them into the initializer +completed the repair. That intermediate measurement remains in the existing +artifact directory, not a separate published branch or claimed result. + +The demonstrated first-update wait reduction is about522ms. Total opening also +changed, but initialize varied materially under host load: this single comparison +does not prove a repeatable1.29s end-to-end gain or resolve the whole reported5s. +The completed run still took4.13s; initial page publication/preparation took0.872s. +Remaining source, ACP initialization and visible preparation work is not removed. + +Both original Apps finished without error or provider input, with four visible +bodies and loading0. Five existing process-pool checks passed after the completed +SDK bootstrap, covering spawn identity/import safety, errors, bounded parallel +admission, cancellation and joined shutdown; CPU heartbeat maximum gap11ms. +No mock startup score or provider replay. Optional persistent transport is absent +from this runtime: its source family was migrated, but no persistent installed +acceptance is claimed. Original worker477574 was preserved, so Core owner-side +TranscriptReplay encoding still awaits reviewed worker installation. + +Private copied settings/state were removed after App teardown. Compact original +clocks are retained here. Candidate wheel/runtime/control remain under +.artifacts/cold-validation-bootstrap-20261008 for Parent integration. Public +launchers/packages are unchanged; independently qualified frontend work can ship. diff --git a/evidence/cold-validation-bootstrap-20261008/baseline-timings.json b/evidence/cold-validation-bootstrap-20261008/baseline-timings.json new file mode 100644 index 000000000..7953f90f1 --- /dev/null +++ b/evidence/cold-validation-bootstrap-20261008/baseline-timings.json @@ -0,0 +1,892 @@ +{ + "rows": [ + { + "t": 3.2692153520183638, + "clock": 963203.518953561, + "name": "dependencies", + "toad": "/home/ts/wt/toad-viewport-demand-20260929/.artifacts/cold-validation-bootstrap-20261008/baseline-runtime/lib/python3.14/site-packages/toad/__init__.py", + "textual": "/home/ts/wt/toad-viewport-demand-20260929/.artifacts/cold-validation-bootstrap-20261008/baseline-runtime/lib/python3.14/site-packages/textual/__init__.py", + "thread": "agent-comms-ux", + "pid": 477574 + }, + { + "t": 3.2851142670260742, + "clock": 963203.534852585, + "name": "app.open" + }, + { + "t": 4.125517523032613, + "clock": 963204.37525499, + "name": "shell.ready", + "categories": [ + "agent", + "outbound", + "tool", + "user", + "thinking", + "inbound", + "other" + ] + }, + { + "t": 4.280137780006044, + "clock": 963204.529875308, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 4.287821428035386, + "clock": 963204.537559186, + "name": "RenderProcessPool.capture.begin", + "argument_type": "PatchRenderTask" + }, + { + "t": 4.387753566959873, + "clock": 963204.637491175, + "name": "AgentProcess.start.begin", + "argument_type": "Agent" + }, + { + "t": 4.4568902279715985, + "clock": 963204.706627826, + "name": "AgentProcess.start.end" + }, + { + "t": 4.456949981977232, + "clock": 963204.706687409, + "name": "AgentProcess.communicate.begin", + "argument_type": null + }, + { + "t": 4.502029309980571, + "clock": 963204.751766817, + "name": "AgentSession.initialize.begin", + "argument_type": null + }, + { + "t": 4.514698346029036, + "clock": 963204.764435974, + "name": "rpc.send", + "method": "initialize" + }, + { + "t": 6.308393971063197, + "clock": 963206.558131769, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.865146163967438, + "clock": 963207.114883691, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 7.088225887040608, + "clock": 963207.337963435, + "name": "rpc.receive", + "method": null, + "id": 1, + "bytes": 872 + }, + { + "t": 7.088582594064064, + "clock": 963207.338320051, + "name": "AgentSession.initialize.end" + }, + { + "t": 7.088608253048733, + "clock": 963207.33834566, + "name": "AgentSession.load.begin", + "argument_type": null + }, + { + "t": 7.096911536063999, + "clock": 963207.346649114, + "name": "rpc.send", + "method": "session/load" + }, + { + "t": 7.15868048905395, + "clock": 963207.408418006, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 3297 + }, + { + "t": 7.15894328802824, + "clock": 963207.408680725, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 7.1589830530574545, + "clock": 963207.40872047, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 7.159099344047718, + "clock": 963207.408836741, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 7.159114783047698, + "clock": 963207.40885218, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 7.701691981987096, + "clock": 963207.951429589, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 7.701953046955168, + "clock": 963207.951690494, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 7.702404543058947, + "clock": 963207.952141981, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 7.702710594050586, + "clock": 963207.952448021, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 7.702919800998643, + "clock": 963207.952657248, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 42570 + }, + { + "t": 7.703131483052857, + "clock": 963207.95286891, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 7.7031588749960065, + "clock": 963207.952896272, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 7.703807204961777, + "clock": 963207.953544662, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 7.703826440963894, + "clock": 963207.953563858, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 8.019054625998251, + "clock": 963208.268792143, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.019313025986776, + "clock": 963208.269050463, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.039997981046326, + "clock": 963208.289735449, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.158384553040378, + "clock": 963208.408122121, + "name": "CommsUpdateConsumer.consume_metadata.begin", + "argument_type": "dict" + }, + { + "t": 8.158429007977247, + "clock": 963208.408166405, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 8.15849329996854, + "clock": 963208.408230717, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.158514940994792, + "clock": 963208.408252358, + "name": "RenderProcessPool.capture.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 8.165407216991298, + "clock": 963208.415144765, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.223430854035541, + "clock": 963208.473168402, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.225088389008306, + "clock": 963208.474825986, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.225290972972289, + "clock": 963208.47502842, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 8.225381394964643, + "clock": 963208.475118892, + "name": "CommsUpdateConsumer.consume_metadata.end" + }, + { + "t": 8.226289568003267, + "clock": 963208.476027005, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.22800385998562, + "clock": 963208.477741398, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 8.228103950037621, + "clock": 963208.477841367, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 8.2281455489574, + "clock": 963208.477882966, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 316 + }, + { + "t": 8.228239697986282, + "clock": 963208.477977115, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 8.228270977037027, + "clock": 963208.478008404, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 8.228334137005731, + "clock": 963208.478071524, + "name": "AgentController.publish_transcript_snapshot.begin", + "argument_type": "TranscriptSnapshotUpdate" + }, + { + "t": 8.228628225042485, + "clock": 963208.478365712, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.22864903404843, + "clock": 963208.478386452, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 8.230867743957788, + "clock": 963208.480605241, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.23107879399322, + "clock": 963208.480816242, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.231517056003213, + "clock": 963208.481254503, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 8.231584905064665, + "clock": 963208.481322342, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 8.231616604956798, + "clock": 963208.481354002, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 264 + }, + { + "t": 8.231676217983477, + "clock": 963208.481413675, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 8.231700703967363, + "clock": 963208.481438152, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 8.231761640054174, + "clock": 963208.481499057, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.231773372041062, + "clock": 963208.481510769, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 8.233221009024419, + "clock": 963208.482958446, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.233460854040459, + "clock": 963208.483198291, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.233684348058887, + "clock": 963208.483421795, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 8.23379379499238, + "clock": 963208.483531363, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 8.234211647999473, + "clock": 963208.483949116, + "name": "rpc.receive", + "method": null, + "id": 2, + "bytes": 43783 + }, + { + "t": 8.235968001070432, + "clock": 963208.485705558, + "name": "CommsUpdateConsumer.consume_metadata.begin", + "argument_type": "dict" + }, + { + "t": 8.236006082966924, + "clock": 963208.48574352, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 8.236231310060248, + "clock": 963208.485968767, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.236252399976365, + "clock": 963208.485989827, + "name": "RenderProcessPool.capture.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 8.238363404991105, + "clock": 963208.488100933, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.238837525015697, + "clock": 963208.488575012, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.23945490596816, + "clock": 963208.489192393, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 8.239986925967969, + "clock": 963208.489724443, + "name": "CommsUpdateConsumer.consume_metadata.end" + }, + { + "t": 8.241079148021527, + "clock": 963208.490816665, + "name": "AgentSession.load.end" + }, + { + "t": 8.28937533905264, + "clock": 963208.539112876, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.292636265978217, + "clock": 963208.542373903, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.415131162037142, + "clock": 963208.66486869, + "name": "CommsUpdateConsumer.consume_metadata.begin", + "argument_type": "dict" + }, + { + "t": 8.41518586606253, + "clock": 963208.664923303, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 8.415256810956635, + "clock": 963208.664994458, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.415287779993378, + "clock": 963208.665025197, + "name": "RenderProcessPool.capture.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 8.419374512974173, + "clock": 963208.669112021, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.419863060000353, + "clock": 963208.669600487, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.420137139968574, + "clock": 963208.669874567, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 8.420203055022284, + "clock": 963208.669940482, + "name": "CommsUpdateConsumer.consume_metadata.end" + }, + { + "t": 8.463771956972778, + "clock": 963208.713509505, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.491469918051735, + "clock": 963208.741207375, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.491954728029668, + "clock": 963208.741692205, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.492069215048105, + "clock": 963208.741806692, + "name": "SnapshotPublication.publish_page.begin", + "argument_type": null + }, + { + "t": 8.507385313976556, + "clock": 963208.757122902, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.507431462057866, + "clock": 963208.757168959, + "name": "RenderProcessPool.capture.begin", + "argument_type": "TranscriptRenderTask" + }, + { + "t": 8.523483586963266, + "clock": 963208.773221204, + "name": "AgentController.publish_transcript_snapshot.end" + }, + { + "t": 8.537580573000014, + "clock": 963208.78731811, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.537828903994523, + "clock": 963208.787566331, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.53882406197954, + "clock": 963208.78856167, + "name": "TranscriptHistory.prepare_body.begin", + "argument_type": "partial" + }, + { + "t": 8.539559387019835, + "clock": 963208.789296834, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.539582862053066, + "clock": 963208.789320269, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 8.539654216961935, + "clock": 963208.789391664, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.539669326040894, + "clock": 963208.789406763, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 8.54055109899491, + "clock": 963208.790288546, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.540741028962657, + "clock": 963208.790478476, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.557692961068824, + "clock": 963208.807430449, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.557894172961824, + "clock": 963208.80763159, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.557948697009124, + "clock": 963208.807686104, + "name": "TranscriptHistory.prepare_body.end" + }, + { + "t": 8.58944551507011, + "clock": 963208.839183092, + "name": "SnapshotPublication.publish_page.end" + }, + { + "t": 8.589546145987697, + "clock": 963208.839283583, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.590153067023493, + "clock": 963208.839890484, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.590571361011826, + "clock": 963208.840308808, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.590887009981088, + "clock": 963208.840624477, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.591221895068884, + "clock": 963208.840959322, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.616342455963604, + "clock": 963208.866080133, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.618081895983778, + "clock": 963208.867819403, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.619701338000596, + "clock": 963208.869438806, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 512 + }, + { + "t": 8.619885999010876, + "clock": 963208.869623496, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 8.619923850987107, + "clock": 963208.869661338, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 8.620304682990536, + "clock": 963208.870042171, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.620327236014418, + "clock": 963208.870064683, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 8.620512607973069, + "clock": 963208.870250125, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.620532435015775, + "clock": 963208.870269903, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 8.621245588059537, + "clock": 963208.870983036, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.65730803902261, + "clock": 963208.907045656, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.673354884027503, + "clock": 963208.923092401, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.673613333958201, + "clock": 963208.923350762, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.683925839955918, + "clock": 963208.933663277, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.685013312962838, + "clock": 963208.934750781, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.685033882036805, + "clock": 963208.934771259, + "name": "RenderProcessPool.capture.begin", + "argument_type": "RichRenderTask" + }, + { + "t": 8.686043508001603, + "clock": 963208.935780925, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 8.686156742973253, + "clock": 963208.93589415, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 8.686180057004094, + "clock": 963208.935917464, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.686653034063056, + "clock": 963208.936390552, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.686670377035625, + "clock": 963208.936407774, + "name": "RenderProcessPool.capture.begin", + "argument_type": "RichRenderTask" + }, + { + "t": 8.697982670040801, + "clock": 963208.947720237, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.698322053998709, + "clock": 963208.948059561, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.711657745065168, + "clock": 963208.961395262, + "name": "history.visible", + "cursor": 147260275, + "ready": true, + "loading": 0, + "bodies": 4 + }, + { + "t": 8.717647199053317, + "clock": 963208.967384636, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.73390134703368, + "clock": 963208.983638855, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.737347556045279, + "clock": 963208.987085003, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.73762249702122, + "clock": 963208.987359925, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.772838662029244, + "clock": 963209.022576169, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.772869811044075, + "clock": 963209.022607198, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 8.789441502070986, + "clock": 963209.039179, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.789569705957547, + "clock": 963209.039307113, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.7895844130544, + "clock": 963209.039321821, + "name": "RenderProcessPool.capture.begin", + "argument_type": "RichRenderTask" + }, + { + "t": 8.78999823902268, + "clock": 963209.039735666, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.80830242705997, + "clock": 963209.058039964, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.808361188042909, + "clock": 963209.058098605, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 8.814701698021963, + "clock": 963209.064439155, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 8.81498703896068, + "clock": 963209.064724476, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 8.833189224009402, + "clock": 963209.082926731, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.834637121064588, + "clock": 963209.084374538, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 8.868460603058338, + "clock": 963209.118198131, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.868889507022686, + "clock": 963209.118626924, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 8.986162606044672, + "clock": 963209.235900084, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 8.98825393395964, + "clock": 963209.237991432, + "name": "AgentProcess.communicate.end" + }, + { + "t": 9.132144393981434, + "clock": 963209.381881811, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 9.167009031982161, + "clock": 963209.416746559, + "name": "PreparationRuntime._execute.end" + } + ], + "app_error": null, + "provider_inputs": 0 +} \ No newline at end of file diff --git a/evidence/cold-validation-bootstrap-20261008/before-consumers.txt b/evidence/cold-validation-bootstrap-20261008/before-consumers.txt new file mode 100644 index 000000000..fac704cc8 --- /dev/null +++ b/evidence/cold-validation-bootstrap-20261008/before-consumers.txt @@ -0,0 +1,32 @@ +Parsed 862; omissions [] +src/toad/render_protocol.py:85 Name RenderService +src/toad/render_zmq.py:95 Name RenderService +src/toad/render_choices.py:26 Name RenderProcessPool +src/toad/render_processes.py:26 FunctionDef _initialize_worker +src/toad/render_processes.py:32 ClassDef RenderProcessPool +src/toad/render_processes.py:92 Name _initialize_worker +src/toad/render_service.py:64 ClassDef RenderService +src/toad/render_service.py:48 Name _initialize_worker +src/toad/work_preparation.py:414 AsyncFunctionDef warm_up +src/toad/work_preparation.py:415 Attribute warm_up +src/toad/agent_surface.py:22 Name ApplicationValidationOwner +src/toad/app.py:443 AsyncFunctionDef _warm_renderer +src/toad/app.py:284 Attribute _renderer_warmup_started +src/toad/app.py:279 Attribute prepare_spawn +src/toad/app.py:439 Attribute _renderer_warmup_started +src/toad/app.py:437 Attribute _renderer_warmup_started +src/toad/app.py:440 Attribute _warm_renderer +src/toad/app.py:444 Attribute warm_up +src/toad/render_backend.py:79 ClassDef RendererSpawn +src/toad/render_backend.py:81 FunctionDef prepare_spawn +src/toad/render_backend.py:96 Name RendererSpawn +src/toad/render_backend.py:145 AsyncFunctionDef warm_up +src/toad/widgets/transcript_fragments.py:51 Name RenderProcessPool +src/toad/acp/agent_controller.py:54 ClassDef ApplicationValidationOwner +src/toad/acp/agent_controller.py:108 Name ValidateSessionUpdateTask +src/toad/acp/session_updates.py:140 Name ValidateSessionUpdateTask +src/toad/acp/comms_updates.py:55 Name DecodeCommsMetadataTask +src/toad/acp/sdk_boundary.py:34 FunctionDef decode_session_update +src/toad/acp/sdk_boundary.py:65 ClassDef ValidateSessionUpdateTask +src/toad/acp/sdk_boundary.py:87 ClassDef DecodeCommsMetadataTask +src/toad/acp/sdk_boundary.py:74 Name decode_session_update diff --git a/evidence/cold-validation-bootstrap-20261008/installed-timings.json b/evidence/cold-validation-bootstrap-20261008/installed-timings.json new file mode 100644 index 000000000..611bd15f2 --- /dev/null +++ b/evidence/cold-validation-bootstrap-20261008/installed-timings.json @@ -0,0 +1,851 @@ +{ + "rows": [ + { + "t": 2.630406050942838, + "clock": 963384.806793165, + "name": "dependencies", + "toad": "/home/ts/wt/toad-viewport-demand-20260929/.artifacts/cold-validation-bootstrap-20261008/runtime/lib/python3.14/site-packages/toad/__init__.py", + "textual": "/home/ts/wt/toad-viewport-demand-20260929/.artifacts/cold-validation-bootstrap-20261008/runtime/lib/python3.14/site-packages/textual/__init__.py", + "thread": "agent-comms-ux", + "pid": 477574 + }, + { + "t": 2.6439276749733835, + "clock": 963384.820314439, + "name": "app.open" + }, + { + "t": 3.4581510089337826, + "clock": 963385.634537593, + "name": "shell.ready", + "categories": [ + "user", + "inbound", + "outbound", + "tool", + "agent", + "thinking", + "other" + ] + }, + { + "t": 3.7256523659452796, + "clock": 963385.902038999, + "name": "AgentProcess.start.begin", + "argument_type": "Agent" + }, + { + "t": 3.8000317739788443, + "clock": 963385.976418408, + "name": "AgentProcess.start.end" + }, + { + "t": 3.800141582963988, + "clock": 963385.976528086, + "name": "AgentProcess.communicate.begin", + "argument_type": null + }, + { + "t": 3.841852910933085, + "clock": 963386.018239485, + "name": "AgentSession.initialize.begin", + "argument_type": null + }, + { + "t": 3.8431846579769626, + "clock": 963386.019571321, + "name": "rpc.send", + "method": "initialize" + }, + { + "t": 5.051612150040455, + "clock": 963387.227998863, + "name": "rpc.receive", + "method": null, + "id": 1, + "bytes": 872 + }, + { + "t": 5.0519488180289045, + "clock": 963387.228335302, + "name": "AgentSession.initialize.end" + }, + { + "t": 5.051974997972138, + "clock": 963387.228361461, + "name": "AgentSession.load.begin", + "argument_type": null + }, + { + "t": 5.065763538936153, + "clock": 963387.242150263, + "name": "rpc.send", + "method": "session/load" + }, + { + "t": 5.13452842598781, + "clock": 963387.310915269, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 3297 + }, + { + "t": 5.134856187039986, + "clock": 963387.311242691, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 5.134904679027386, + "clock": 963387.311291133, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.1350562969455495, + "clock": 963387.31144275, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.135074281017296, + "clock": 963387.311460744, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.154876871965826, + "clock": 963387.331263466, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.155115645029582, + "clock": 963387.331502149, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.156311133992858, + "clock": 963387.332697647, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 5.156723927007988, + "clock": 963387.33311045, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 5.505017980001867, + "clock": 963387.681404573, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 42570 + }, + { + "t": 5.505254428950138, + "clock": 963387.681640912, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 5.5052884930046275, + "clock": 963387.681674956, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.505410394980572, + "clock": 963387.681796868, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.505426525021903, + "clock": 963387.681812988, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.53938108694274, + "clock": 963387.71576766, + "name": "CommsUpdateConsumer.consume_metadata.begin", + "argument_type": "dict" + }, + { + "t": 5.5394487149314955, + "clock": 963387.715835228, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 5.539534267038107, + "clock": 963387.71592075, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.539554044953547, + "clock": 963387.715940518, + "name": "RenderProcessPool.capture.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 5.544668167945929, + "clock": 963387.721054781, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.545530333998613, + "clock": 963387.721916947, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.545941833988763, + "clock": 963387.722328448, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 5.546142203966156, + "clock": 963387.722528838, + "name": "CommsUpdateConsumer.consume_metadata.end" + }, + { + "t": 5.561858642962761, + "clock": 963387.738245477, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.562361547024921, + "clock": 963387.73874808, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.563445313018747, + "clock": 963387.739831827, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 5.5636056070216, + "clock": 963387.739992121, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 5.563698995043524, + "clock": 963387.740085548, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 316 + }, + { + "t": 5.563895486993715, + "clock": 963387.740282021, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 5.563935923972167, + "clock": 963387.740322407, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.56401068600826, + "clock": 963387.740397169, + "name": "AgentController.publish_transcript_snapshot.begin", + "argument_type": "TranscriptSnapshotUpdate" + }, + { + "t": 5.57346249895636, + "clock": 963387.749849142, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.573490681941621, + "clock": 963387.749877115, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.57357388001401, + "clock": 963387.749960323, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.575971449026838, + "clock": 963387.752357932, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.5762823389377445, + "clock": 963387.752668842, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.576885913964361, + "clock": 963387.753272407, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 5.576967237982899, + "clock": 963387.753353701, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 5.577004379010759, + "clock": 963387.753390832, + "name": "rpc.receive", + "method": "session/update", + "id": null, + "bytes": 264 + }, + { + "t": 5.5770580909447744, + "clock": 963387.753444554, + "name": "SessionNotificationOwner.receive.begin", + "argument_type": null + }, + { + "t": 5.577080392977223, + "clock": 963387.753466836, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.57713424495887, + "clock": 963387.753520698, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.577145505929366, + "clock": 963387.75353194, + "name": "RenderProcessPool.capture.begin", + "argument_type": "ValidateSessionUpdateTask" + }, + { + "t": 5.57826059195213, + "clock": 963387.754647105, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.57847899699118, + "clock": 963387.75486555, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.578759207972325, + "clock": 963387.755145752, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 5.578873023972847, + "clock": 963387.755259618, + "name": "SessionNotificationOwner.receive.end" + }, + { + "t": 5.579198241000995, + "clock": 963387.755584784, + "name": "rpc.receive", + "method": null, + "id": 2, + "bytes": 43783 + }, + { + "t": 5.580449384986423, + "clock": 963387.756835868, + "name": "CommsUpdateConsumer.consume_metadata.begin", + "argument_type": "dict" + }, + { + "t": 5.580473740934394, + "clock": 963387.756860184, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 5.580761716933921, + "clock": 963387.757148211, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.580809297971427, + "clock": 963387.757195801, + "name": "RenderProcessPool.capture.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 5.587649466004223, + "clock": 963387.764036029, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.590027577010915, + "clock": 963387.766414151, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.591094000963494, + "clock": 963387.767480494, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 5.595948350965045, + "clock": 963387.772334954, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 5.596951965009794, + "clock": 963387.773338458, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 5.5972514329478145, + "clock": 963387.773637916, + "name": "CommsUpdateConsumer.consume_metadata.end" + }, + { + "t": 5.597982008941472, + "clock": 963387.774368533, + "name": "AgentSession.load.end" + }, + { + "t": 5.638236423023045, + "clock": 963387.814623157, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 5.645453225937672, + "clock": 963387.821839819, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 5.7209258989896625, + "clock": 963387.897312482, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.757728212978691, + "clock": 963387.934114767, + "name": "CommsUpdateConsumer.consume_metadata.begin", + "argument_type": "dict" + }, + { + "t": 5.757786714006215, + "clock": 963387.934173208, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 5.757874912000261, + "clock": 963387.934261395, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.757888988009654, + "clock": 963387.934275442, + "name": "RenderProcessPool.capture.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 5.762021449045278, + "clock": 963387.938408102, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.7624494809424505, + "clock": 963387.938836064, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.7627930929884315, + "clock": 963387.939179686, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 5.76285185397137, + "clock": 963387.939238308, + "name": "CommsUpdateConsumer.consume_metadata.end" + }, + { + "t": 5.791912710992619, + "clock": 963387.968299254, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 5.79231352196075, + "clock": 963387.968700045, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 5.792427707929164, + "clock": 963387.968814222, + "name": "SnapshotPublication.publish_page.begin", + "argument_type": null + }, + { + "t": 5.793428065953776, + "clock": 963387.9698146, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.793462781934068, + "clock": 963387.969849225, + "name": "RenderProcessPool.capture.begin", + "argument_type": "TranscriptRenderTask" + }, + { + "t": 5.799260281957686, + "clock": 963387.975647015, + "name": "AgentController.publish_transcript_snapshot.end" + }, + { + "t": 5.894501170958392, + "clock": 963388.070887995, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 5.8947845889488235, + "clock": 963388.071171072, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 5.895758486003615, + "clock": 963388.07214504, + "name": "TranscriptHistory.prepare_body.begin", + "argument_type": "partial" + }, + { + "t": 5.896364385960624, + "clock": 963388.072750879, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.896387279033661, + "clock": 963388.072773742, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 5.896459195995703, + "clock": 963388.072845699, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 5.896477269940078, + "clock": 963388.072863753, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 6.422592189977877, + "clock": 963388.598978774, + "name": "CommsUpdateConsumer.consume_metadata.begin", + "argument_type": "dict" + }, + { + "t": 6.422679055016488, + "clock": 963388.599065558, + "name": "ApplicationValidationOwner.validate.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 6.422789184027351, + "clock": 963388.599175637, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.422804723028094, + "clock": 963388.599191197, + "name": "RenderProcessPool.capture.begin", + "argument_type": "DecodeCommsMetadataTask" + }, + { + "t": 6.553510659956373, + "clock": 963388.729897213, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.553592865937389, + "clock": 963388.729979309, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.5538829260040075, + "clock": 963388.730269439, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.553907162044197, + "clock": 963388.730293605, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.554235765943304, + "clock": 963388.730622339, + "name": "ApplicationValidationOwner.validate.end" + }, + { + "t": 6.554330134997144, + "clock": 963388.730716668, + "name": "CommsUpdateConsumer.consume_metadata.end" + }, + { + "t": 6.619878979981877, + "clock": 963388.796265703, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.620158078963868, + "clock": 963388.796544622, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.620255082962103, + "clock": 963388.796641636, + "name": "TranscriptHistory.prepare_body.end" + }, + { + "t": 6.663908696034923, + "clock": 963388.84029527, + "name": "SnapshotPublication.publish_page.end" + }, + { + "t": 6.664006763021462, + "clock": 963388.840393236, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 6.664580240962096, + "clock": 963388.840966734, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 6.665033931029029, + "clock": 963388.841420405, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 6.665335573954508, + "clock": 963388.841722047, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 6.665696298005059, + "clock": 963388.842082791, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 6.684258796041831, + "clock": 963388.86064551, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 6.685667137964629, + "clock": 963388.862053752, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 6.687028190935962, + "clock": 963388.863414714, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.6870483190286905, + "clock": 963388.863434782, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 6.704018185962923, + "clock": 963388.880404779, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 6.718099100980908, + "clock": 963388.894485664, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.721835640026256, + "clock": 963388.898222124, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.72435364802368, + "clock": 963388.900740131, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.749189618974924, + "clock": 963388.925576463, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.749224485014565, + "clock": 963388.925610968, + "name": "RenderProcessPool.capture.begin", + "argument_type": "RichRenderTask" + }, + { + "t": 6.749293004977517, + "clock": 963388.925679488, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.749304285971448, + "clock": 963388.925690739, + "name": "RenderProcessPool.capture.begin", + "argument_type": "RichRenderTask" + }, + { + "t": 6.758028849028051, + "clock": 963388.934415553, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.758369024959393, + "clock": 963388.934755518, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.777216524002142, + "clock": 963388.953603147, + "name": "history.visible", + "cursor": 147260275, + "ready": true, + "loading": 0, + "bodies": 4 + }, + { + "t": 6.787417909014039, + "clock": 963388.963804602, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.791941570932977, + "clock": 963388.968328135, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.809307839954272, + "clock": 963388.985694403, + "name": "TranscriptPublication.application_current.begin", + "argument_type": null + }, + { + "t": 6.809596447972581, + "clock": 963388.985982931, + "name": "TranscriptPublication.application_current.end" + }, + { + "t": 6.850310764042661, + "clock": 963389.026697348, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.850343085941859, + "clock": 963389.026729539, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 6.865924648009241, + "clock": 963389.042311372, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.866050287033431, + "clock": 963389.04243675, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.866067148977891, + "clock": 963389.042453602, + "name": "RenderProcessPool.capture.begin", + "argument_type": "RichRenderTask" + }, + { + "t": 6.8666089969919994, + "clock": 963389.04299547, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.8865655900444835, + "clock": 963389.062952164, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.887576848967001, + "clock": 963389.063963362, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 6.887600093032233, + "clock": 963389.063986596, + "name": "RenderProcessPool.capture.begin", + "argument_type": "MarkdownRenderTask" + }, + { + "t": 6.890261071966961, + "clock": 963389.066647625, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 6.960531655000523, + "clock": 963389.136918228, + "name": "RenderProcessPool.capture.end" + }, + { + "t": 6.974686400964856, + "clock": 963389.151073084, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 7.046456197975203, + "clock": 963389.222842762, + "name": "PreparationRuntime._execute.begin", + "argument_type": "WorkKey" + }, + { + "t": 7.067267072037794, + "clock": 963389.243653936, + "name": "AgentProcess.communicate.end" + }, + { + "t": 7.266317307949066, + "clock": 963389.442703801, + "name": "PreparationRuntime._execute.end" + }, + { + "t": 7.298678645980544, + "clock": 963389.4750655, + "name": "PreparationRuntime._execute.end" + } + ], + "app_error": null, + "provider_inputs": 0 +} \ No newline at end of file diff --git a/evidence/cold-validation-bootstrap-20261008/proxy-timings.jsonl b/evidence/cold-validation-bootstrap-20261008/proxy-timings.jsonl new file mode 100644 index 000000000..b81e91c7b --- /dev/null +++ b/evidence/cold-validation-bootstrap-20261008/proxy-timings.jsonl @@ -0,0 +1,21 @@ +{"clock": 963387.179322941, "name": "acp.main.begin", "thread": 140688172222336, "main_thread": 140688172222336} +{"clock": 963387.257481661, "name": "_subscribe_once.begin", "thread": 140688172222336, "main_thread": 140688172222336} +{"clock": 963387.29519307, "name": "update.begin", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["coordination_changed", "goal_changed", "queue_changed", "cursor_advanced"]} +{"clock": 963387.29536174, "name": "present_session.begin", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["coordination_changed", "goal_changed", "queue_changed", "cursor_advanced"]} +{"clock": 963387.310249536, "name": "present_session.end", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["coordination_changed", "goal_changed", "queue_changed", "cursor_advanced"]} +{"clock": 963387.310787397, "name": "update.end", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["coordination_changed", "goal_changed", "queue_changed", "cursor_advanced"]} +{"clock": 963387.636747647, "name": "update.begin", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["transcript_snapshot"]} +{"clock": 963387.636962845, "name": "present_session.begin", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["transcript_snapshot"]} +{"clock": 963387.67725451, "name": "present_session.end", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["transcript_snapshot"]} +{"clock": 963387.677948406, "name": "update.end", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["transcript_snapshot"]} +{"clock": 963387.678040891, "name": "update.begin", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["turn_changed"]} +{"clock": 963387.678151361, "name": "present_session.begin", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["turn_changed"]} +{"clock": 963387.679952418, "name": "present_session.end", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["turn_changed"]} +{"clock": 963387.680244512, "name": "update.end", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["turn_changed"]} +{"clock": 963387.680296601, "name": "update.begin", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["input_delivery_changed"]} +{"clock": 963387.680373166, "name": "present_session.begin", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["input_delivery_changed"]} +{"clock": 963387.680695368, "name": "present_session.end", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["input_delivery_changed"]} +{"clock": 963387.680873856, "name": "update.end", "thread": 140688172222336, "main_thread": 140688172222336, "kinds": ["input_delivery_changed"]} +{"clock": 963387.681324001, "name": "present_session.begin", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["coordination_changed", "goal_changed", "queue_changed", "cursor_advanced"]} +{"clock": 963387.682038807, "name": "present_session.end", "thread": 140688114054848, "main_thread": 140688172222336, "kinds": ["coordination_changed", "goal_changed", "queue_changed", "cursor_advanced"]} +{"clock": 963387.682164876, "name": "_subscribe_once.end", "thread": 140688172222336, "main_thread": 140688172222336} diff --git a/src/toad/app.py b/src/toad/app.py index 7a04ae172..bbf62ee36 100644 --- a/src/toad/app.py +++ b/src/toad/app.py @@ -281,7 +281,6 @@ def __init__( self.settings = ToadSettings.open(self) self.preparation = PreparationRuntime(self.settings.ui.renderer.start() if renderer is None else renderer) self.render_processes: Renderer = PreparedRenderer(self.preparation) - self._renderer_warmup_started = False self.background_render_slots = asyncio.Semaphore(1) self._background_render_tasks: set[asyncio.Task[object]] = set() self.navigation_reader = NavigationReader() @@ -374,6 +373,7 @@ def on_notify(self, event: Notify) -> None: async def on_load(self) -> None: + self.preparation.renderer.start() self._prewarm_conversation_css() db = await self.get_db() await db.create() @@ -431,20 +431,6 @@ def select_session(self, mode: str, *, history_index: int | None = None) -> Awai self.session_navigation.entered(mode, self.selected_mode) return AwaitComplete(self._switch_mode_ready(mode, history_index=history_index)) - def _display(self, screen: Screen, renderable) -> None: - - super()._display(screen, renderable) - if (not self._renderer_warmup_started and renderable is not None - and not self._batch_count and screen is self.screen): - self._renderer_warmup_started = True - self._warm_renderer() - - @work(group="renderer-warmup", exit_on_error=False) - async def _warm_renderer(self) -> None: - await self.render_processes.warm_up( - project=self.project_dir, ansi=self.native_ansi_color, dark=self.current_theme.dark, - ) - def _load_screen_css(self, screen: Screen) -> None: from toad.screens.workspace import WorkspaceScreen diff --git a/src/toad/render_backend.py b/src/toad/render_backend.py index 39403abf7..8c3408534 100644 --- a/src/toad/render_backend.py +++ b/src/toad/render_backend.py @@ -7,7 +7,6 @@ import asyncio from contextvars import Context, copy_context import os -from pathlib import Path from typing import TypeVar, Generic, TYPE_CHECKING from agent_comms.declared_family import DeclaredFamily @@ -77,6 +76,21 @@ def preparation_storage(self) -> type[PreparationWork]: class RendererSpawn(ABC): + @staticmethod + def start_workers(executor) -> None: + """Start the owned pool without occupying admission with a dummy job. + + ProcessPoolExecutor has no public prestart operation. Its original + launch hook starts the configured workers before the manager thread; + submission, worker replacement and shutdown remain executor-owned. + """ + try: + executor._launch_processes() + executor._start_executor_manager_thread() + except BaseException: + executor.shutdown(wait=True, cancel_futures=True) + raise + @staticmethod def prepare_spawn() -> None: """Initialize POSIX spawn bookkeeping before a UI captures stderr. @@ -97,6 +111,10 @@ class Renderer(RendererSpawn): def __init__(self) -> None: self._submissions: set[asyncio.Task] = set() + def start(self) -> None: + """Begin owned startup; remote clients retain on-demand connection.""" + self.prepare_spawn() + @staticmethod def execution_context() -> Context: """Detached work borrows ambient facts, never its waiter's native owner. @@ -142,23 +160,6 @@ async def prepare(self, task: RenderTask[ResultT]) -> None: """ await self.capture(task) - async def warm_up(self, *, project: Path, ansi: bool, dark: bool) -> None: - """Start matching workers and common parser/highlighter imports off-loop. - - These small, data-only tasks use normal admission and cancellation. No - source files are opened, no user history is fetched and nothing is mounted. - """ - from toad.render_tasks import MarkdownRenderTask, PatchRenderTask - - await asyncio.gather( - self.prepare(MarkdownRenderTask( - "```python\npass\n```\n\n```json\n{}\n```\n", ansi, dark, - )), - self.prepare(PatchRenderTask( - "--- warmup.py\n+++ warmup.py\n@@ -1 +1 @@\n-pass\n+value = 1\n", ansi, dark, - )), - ) - async def submit(self, task: RenderTask[ResultT]) -> ResultT: """Deliver one independent result from the worker's captured value.""" context = self.execution_context() diff --git a/src/toad/render_processes.py b/src/toad/render_processes.py index d540fb2c0..c258b85a0 100644 --- a/src/toad/render_processes.py +++ b/src/toad/render_processes.py @@ -24,9 +24,15 @@ def _initialize_worker() -> None: - """CPU workers have no agent identity and do not manage external owners.""" + """Acquire typed ingress declarations without borrowing an agent identity. + + These application workers serve both rendering and ACP validation. Finish + the required SDK imports during their own startup, before the first ordered + notification lends them a task. No notification or rendering job is made. + """ os.environ.pop("PI_AGENT_ID", None) os.environ.pop("AGENT_COMMS_THREAD", None) + from toad.acp import sdk_boundary # noqa: F401 -- declare worker ingress capabilities class RenderProcessPool(Renderer): @@ -77,20 +83,28 @@ def _finished(self, future: asyncio.Future[Any]) -> None: future.exception() self._changed.set() - async def run(self, function: Callable[..., Result], *args: Any) -> Result: - """Execute a data-only function in a child, propagating its result/error.""" - loop = self._bind_loop() - while not self._closed and len(self._pending) >= self._max_pending: - self._changed.clear() - await self._changed.wait() + def start(self) -> None: + """Acquire real workers when the application selects this renderer.""" if self._closed: raise RuntimeError("RenderProcessPool is closed") if self._executor is None: + self.prepare_spawn() self._executor = ProcessPoolExecutor( max_workers=self._max_workers, mp_context=multiprocessing.get_context("spawn"), initializer=_initialize_worker, ) + self.start_workers(self._executor) + + async def run(self, function: Callable[..., Result], *args: Any) -> Result: + """Execute a data-only function in a child, propagating its result/error.""" + loop = self._bind_loop() + while not self._closed and len(self._pending) >= self._max_pending: + self._changed.clear() + await self._changed.wait() + if self._closed: + raise RuntimeError("RenderProcessPool is closed") + self.start() # No await between admission and registration: admission is atomic on # the owning loop. Waiting never propagates caller cancellation to the # underlying future (or logs an abandoned exception via shield). diff --git a/src/toad/render_service.py b/src/toad/render_service.py index 0f6e6195a..4b7fef1e7 100644 --- a/src/toad/render_service.py +++ b/src/toad/render_service.py @@ -10,6 +10,7 @@ from uuid import UUID from toad.render_processes import _initialize_worker +from toad.render_backend import RendererSpawn from toad.render_protocol import ( AcknowledgeRender, CancelRender, @@ -44,7 +45,7 @@ def __post_init__(self) -> None: def _initialize_render_worker(config: RenderServiceConfig, expected_build: str | None) -> None: - """Lazy-spawned workers must still match the service's advertised build.""" + """Started workers must still match the service's advertised build.""" _initialize_worker() if expected_build is not None: from toad.render_identity import RendererBuild @@ -61,7 +62,7 @@ class PendingRender: abandoned: bool = False -class RenderService: +class RenderService(RendererSpawn): """One command-thread owner of admission and result retention. Cancellation never frees running work early. Completed results remain until @@ -75,6 +76,7 @@ def __init__(self, config: RenderServiceConfig, *, expected_build: str | None = max_workers=config.max_workers, mp_context=multiprocessing.get_context("spawn"), initializer=_initialize_render_worker, initargs=(config, expected_build), ) + self.start_workers(self._executor) self._jobs: dict[UUID, PendingRender] = {} self._clients: dict[UUID, float] = {} self._closed = False diff --git a/src/toad/work_preparation.py b/src/toad/work_preparation.py index 04520035a..a9416a607 100644 --- a/src/toad/work_preparation.py +++ b/src/toad/work_preparation.py @@ -10,7 +10,6 @@ from dataclasses import dataclass, fields, is_dataclass from enum import Enum from hashlib import sha256 -from pathlib import Path import pickle from sys import getsizeof from typing import TYPE_CHECKING, Generic, TypeVar, cast @@ -411,9 +410,6 @@ async def capture(self, task: RenderTask[ResultT]) -> PreparedValue[ResultT]: async def prepare(self, task: RenderTask[ResultT]) -> None: await self.runtime.prepare(RenderPreparation(task)) - async def warm_up(self, *, project: Path, ansi: bool, dark: bool) -> None: - await self.runtime.renderer.warm_up(project=project, ansi=ansi, dark=dark) - async def aclose(self) -> None: await self._close_submissions() await self.runtime.aclose() diff --git a/tests/renderer_warmup_pilot.py b/tests/renderer_warmup_pilot.py deleted file mode 100644 index 8e4db2e8e..000000000 --- a/tests/renderer_warmup_pilot.py +++ /dev/null @@ -1,83 +0,0 @@ -"""Renderer warm-up starts after display and never holds typing or navigation.""" - -import asyncio -import os -from pathlib import Path -import tempfile -from typing import TypeVar - -from runtime_fixture import ToadApp -from toad.render_backend import Renderer -from toad.render_backend import RenderTask - -ResultT = TypeVar("ResultT") - - -class GateRenderer(Renderer): - def __init__(self, displayed: asyncio.Event) -> None: - super().__init__() - self.displayed = displayed - self.started = asyncio.Event() - self.release = asyncio.Event() - self.finished = asyncio.Event() - self.calls = 0 - self.closed = False - - async def warm_up(self, *, project: Path, ansi: bool, dark: bool) -> None: - assert self.displayed.is_set(), "Warm-up started before the first completed display" - self.calls += 1 - self.started.set() - try: - await self.release.wait() - finally: - self.finished.set() - - async def capture(self, task: RenderTask[ResultT]): - raise AssertionError("Fixture must not submit user rendering work") - - async def aclose(self) -> None: - await self._close_submissions() - self.closed = True - - -class FrameApp(ToadApp): - def __init__(self, displayed: asyncio.Event, **kwargs): - self.displayed = displayed - super().__init__(**kwargs) - - def _display(self, screen, renderable): - result = super()._display(screen, renderable) - if renderable is not None and not self._batch_count and screen is self.screen: - self.displayed.set() - return result - - -async def main(): - with tempfile.TemporaryDirectory(prefix="renderer-warmup-") as directory: - root = Path(directory) - os.environ.update(AGENT_COMMS_ROOT=str(root / "wire"), XDG_CONFIG_HOME=str(root / "config"), - XDG_STATE_HOME=str(root / "state"), XDG_DATA_HOME=str(root / "data")) - displayed = asyncio.Event() - renderer = GateRenderer(displayed) - app = FrameApp(displayed, project_dir=directory, renderer=renderer) - async with app.run_test(size=(110, 35)) as pilot: - await asyncio.wait_for(renderer.started.wait(), 3) - await pilot.pause() - first = app.selected_mode - prompt = app.selected_session.conversation.prompt - prompt.focus() - await pilot.press("h", "i") - assert prompt.text == "hi" - other = await asyncio.wait_for(app.session_navigation.new(app.session_navigation.default_source), 3) - await asyncio.wait_for(app.switch_mode(first), 3) - await pilot.pause() - assert other.mode_name != first and prompt.text == "hi" - assert renderer.calls == 1 and not renderer.release.is_set() - assert app._exception is None - assert renderer.closed and renderer.finished.is_set() - await asyncio.get_running_loop().shutdown_default_executor() - print("warm-up: after display, once per app; typing/navigation/drafts work while blocked; shutdown drains") - - -if __name__ == "__main__": - asyncio.run(main())