Repository navigation
[agent-v1 15/18] feat(agent): workflow, tab, and lifetime adapter - #16318
CodeJuggernaut wants to merge 16 commits into
Conversation
useAgentLifetime.ts becomes the agent's composition root, one export per lifetime scope. registerAgentLifetimes (app scope) absorbs the workflow tab-activity tracker's watchers and adds a user-identity watcher that purges user-scoped agent state on account switch and logout: transcript, composer draft, stored thread id, tab bindings, and the draft binding. The boot-time null-to-user resolution keeps the stored thread id so the last session still resumes. useAgentLifetime (panel scope) owns session start/stop across panel mount, unmount, and user change, clears tab activity on unmount, and hands the follower its doc ref, so session.stop() registers and runs before the follower's own teardown and a late ack cannot rebind a destroyed doc. The doc binding deliberately survives unmount, closing the bound tab detaches nothing, and no page-teardown listener is added; the spec pins each recorded no-op alongside both scopes' behavior.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1888 passed, 0 failed · 1 flaky📊 Browser Reports
📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-09-01T12:35:28.359Z",
"gitSha": "249cc644603a37f95404a1412d0701e9c0772ec6",
"branch": "nathaniel/agent-v1/15-lifetime-adapter",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 1991.7810000000031,
"styleRecalcs": 10,
"styleRecalcDurationMs": 9.328,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 447.6910000000001,
"heapDeltaBytes": -9625088,
"heapUsedBytes": 60200804,
"domNodes": -281,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 11.585,
"eventListeners": -155,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-idle",
"durationMs": 2006.3020000000051,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.067,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 387.382,
"heapDeltaBytes": 12630900,
"heapUsedBytes": 82367128,
"domNodes": -282,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 9.952,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1742.4110000000042,
"styleRecalcs": 74,
"styleRecalcDurationMs": 36.721,
"layouts": 14,
"layoutDurationMs": 5.19,
"taskDurationMs": 723.071,
"heapDeltaBytes": 1711308,
"heapUsedBytes": 71117312,
"domNodes": -279,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 120.927,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1714.2860000000155,
"styleRecalcs": 73,
"styleRecalcDurationMs": 30.059,
"layouts": 14,
"layoutDurationMs": 4.47,
"taskDurationMs": 654.311,
"heapDeltaBytes": 6754820,
"heapUsedBytes": 75107560,
"domNodes": -281,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 107.73,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1687.1620000000007,
"styleRecalcs": 32,
"styleRecalcDurationMs": 16.795,
"layouts": 6,
"layoutDurationMs": 1.2420000000000002,
"taskDurationMs": 310.64300000000003,
"heapDeltaBytes": 4352728,
"heapUsedBytes": 74524608,
"domNodes": 79,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 13.58,
"eventListeners": 21,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1657.5249999999642,
"styleRecalcs": 31,
"styleRecalcDurationMs": 15.406999999999998,
"layouts": 6,
"layoutDurationMs": 1.1940000000000002,
"taskDurationMs": 292.89300000000003,
"heapDeltaBytes": 4347264,
"heapUsedBytes": 74697364,
"domNodes": 77,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 12.574000000000002,
"eventListeners": 21,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 521.2260000000128,
"styleRecalcs": 12,
"styleRecalcDurationMs": 7.562999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 327.523,
"heapDeltaBytes": 17745708,
"heapUsedBytes": 87981252,
"domNodes": 20,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 107.304,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "dom-widget-clipping",
"durationMs": 515.3930000000173,
"styleRecalcs": 12,
"styleRecalcDurationMs": 7.611,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 308.436,
"heapDeltaBytes": 18498756,
"heapUsedBytes": 87840116,
"domNodes": 20,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 102.795,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "large-graph-idle",
"durationMs": 2011.7449999999621,
"styleRecalcs": 5,
"styleRecalcDurationMs": 3.952000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 464.97799999999995,
"heapDeltaBytes": 22088692,
"heapUsedBytes": 86591120,
"domNodes": -270,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 33.032000000000004,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2029.455999999982,
"styleRecalcs": 7,
"styleRecalcDurationMs": 5.388000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 441.7869999999999,
"heapDeltaBytes": 11032292,
"heapUsedBytes": 86798124,
"domNodes": -268,
"jsHeapTotalBytes": -3219456,
"scriptDurationMs": 26.75500000000001,
"eventListeners": -181,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2820.344000000034,
"styleRecalcs": 69,
"styleRecalcDurationMs": 16.009999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1289.786,
"heapDeltaBytes": 15353452,
"heapUsedBytes": 91266056,
"domNodes": -268,
"jsHeapTotalBytes": -110592,
"scriptDurationMs": 586.665,
"eventListeners": -181,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2692.3920000000408,
"styleRecalcs": 68,
"styleRecalcDurationMs": 14.855999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1233.4809999999998,
"heapDeltaBytes": 23582732,
"heapUsedBytes": 88941376,
"domNodes": -266,
"jsHeapTotalBytes": 749568,
"scriptDurationMs": 574.595,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3781.0719999999947,
"styleRecalcs": 62,
"styleRecalcDurationMs": 13.315000000000001,
"layouts": 60,
"layoutDurationMs": 15.222,
"taskDurationMs": 1331.834,
"heapDeltaBytes": 8757316,
"heapUsedBytes": 75862208,
"domNodes": 4,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 564.0609999999999,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3821.766000000025,
"styleRecalcs": 63,
"styleRecalcDurationMs": 14.248000000000001,
"layouts": 60,
"layoutDurationMs": 14.373999999999999,
"taskDurationMs": 1282.553,
"heapDeltaBytes": 10120620,
"heapUsedBytes": 76451036,
"domNodes": 8,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 544.009,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 2925.2970000000005,
"styleRecalcs": 42,
"styleRecalcDurationMs": 7.759000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1532.67,
"heapDeltaBytes": 22233216,
"heapUsedBytes": 89571844,
"domNodes": 4,
"jsHeapTotalBytes": 417792,
"scriptDurationMs": 728.919,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "legacy-node-drag",
"durationMs": 2751.000999999974,
"styleRecalcs": 42,
"styleRecalcDurationMs": 7.434999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1415.0669999999998,
"heapDeltaBytes": 17772580,
"heapUsedBytes": 84673828,
"domNodes": 4,
"jsHeapTotalBytes": 1990656,
"scriptDurationMs": 671.4010000000001,
"eventListeners": 186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2023.9409999999793,
"styleRecalcs": 6,
"styleRecalcDurationMs": 4.837000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 486.15500000000003,
"heapDeltaBytes": 10625212,
"heapUsedBytes": 86466956,
"domNodes": -270,
"jsHeapTotalBytes": -2433024,
"scriptDurationMs": 32.064,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "minimap-idle",
"durationMs": 2021.6609999999946,
"styleRecalcs": 7,
"styleRecalcDurationMs": 6.623999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 561.239,
"heapDeltaBytes": 10568008,
"heapUsedBytes": 86782960,
"domNodes": -267,
"jsHeapTotalBytes": -2695168,
"scriptDurationMs": 33.483000000000004,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 509.28200000004153,
"styleRecalcs": 49,
"styleRecalcDurationMs": 11.608,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 305.495,
"heapDeltaBytes": 14759528,
"heapUsedBytes": 87146652,
"domNodes": 24,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 98.474,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.663333333333338,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 513.121999999953,
"styleRecalcs": 48,
"styleRecalcDurationMs": 11.275,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 302.50300000000004,
"heapDeltaBytes": 14038596,
"heapUsedBytes": 85884772,
"domNodes": 22,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 96.10000000000001,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2022.0270000000369,
"styleRecalcs": 12,
"styleRecalcDurationMs": 9.673,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 424.16400000000004,
"heapDeltaBytes": 812764,
"heapUsedBytes": 72288144,
"domNodes": -294,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 11.204999999999998,
"eventListeners": -229,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2009.559999999965,
"styleRecalcs": 10,
"styleRecalcDurationMs": 7.370000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 374.122,
"heapDeltaBytes": 6312668,
"heapUsedBytes": 71915016,
"domNodes": -296,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 8.992,
"eventListeners": -229,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1694.1619999999489,
"styleRecalcs": 77,
"styleRecalcDurationMs": 33.251999999999995,
"layouts": 18,
"layoutDurationMs": 5.54,
"taskDurationMs": 668.388,
"heapDeltaBytes": 6704508,
"heapUsedBytes": 79017676,
"domNodes": -296,
"jsHeapTotalBytes": 6283264,
"scriptDurationMs": 92.94200000000001,
"eventListeners": -229,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1693.7729999999647,
"styleRecalcs": 77,
"styleRecalcDurationMs": 32.273,
"layouts": 18,
"layoutDurationMs": 5.568999999999999,
"taskDurationMs": 641.591,
"heapDeltaBytes": 3166200,
"heapUsedBytes": 75491404,
"domNodes": -296,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 91.497,
"eventListeners": -229,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 898.757000000046,
"styleRecalcs": 19,
"styleRecalcDurationMs": 24.34399999999999,
"layouts": 15,
"layoutDurationMs": 11.541,
"taskDurationMs": 695.888,
"heapDeltaBytes": 26411440,
"heapUsedBytes": 99920276,
"domNodes": 13671,
"jsHeapTotalBytes": 10485760,
"scriptDurationMs": 22.18,
"eventListeners": 2381,
"totalBlockingTimeMs": 69,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "viewport-pan-sweep",
"durationMs": 9490.920999999958,
"styleRecalcs": 248,
"styleRecalcDurationMs": 45.032000000000004,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4406.932000000001,
"heapDeltaBytes": 17290680,
"heapUsedBytes": 92967096,
"domNodes": -270,
"jsHeapTotalBytes": 675840,
"scriptDurationMs": 1894.428,
"eventListeners": -163,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 9624.091000000022,
"styleRecalcs": 249,
"styleRecalcDurationMs": 46.59199999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4431.334,
"heapDeltaBytes": -9040520,
"heapUsedBytes": 66761760,
"domNodes": -265,
"jsHeapTotalBytes": -598016,
"scriptDurationMs": 1895.9859999999999,
"eventListeners": -163,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 12428.93399999997,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 11876.675,
"heapDeltaBytes": -41791412,
"heapUsedBytes": 176303768,
"domNodes": -6552,
"jsHeapTotalBytes": -4726784,
"scriptDurationMs": 164.629,
"eventListeners": -7477,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-idle",
"durationMs": 12616.378000000055,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12120.999000000002,
"heapDeltaBytes": -29153548,
"heapUsedBytes": 181856380,
"domNodes": -6548,
"jsHeapTotalBytes": 8650752,
"scriptDurationMs": 181.90200000000002,
"eventListeners": -7473,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 14900.601999999992,
"styleRecalcs": 77,
"styleRecalcDurationMs": 16.209,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 14602.965,
"heapDeltaBytes": -29540472,
"heapUsedBytes": 179665724,
"domNodes": -6548,
"jsHeapTotalBytes": -8499200,
"scriptDurationMs": 673.7909999999999,
"eventListeners": -7473,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.779999999999927,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 14864.44599999993,
"styleRecalcs": 71,
"styleRecalcDurationMs": 16.385999999999985,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 14487.796999999999,
"heapDeltaBytes": -40831556,
"heapUsedBytes": 169203804,
"domNodes": -6548,
"jsHeapTotalBytes": -7262208,
"scriptDurationMs": 649.341,
"eventListeners": -7471,
"totalBlockingTimeMs": 3,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-node-resize-workload",
"durationMs": 4611.102000000017,
"styleRecalcs": 20,
"styleRecalcDurationMs": 58.93900000000002,
"layouts": 20,
"layoutDurationMs": 24.046,
"taskDurationMs": 4492.9220000000005,
"heapDeltaBytes": 7251908,
"heapUsedBytes": 195933540,
"domNodes": -6548,
"jsHeapTotalBytes": 19648512,
"scriptDurationMs": 79.434,
"eventListeners": -7473,
"totalBlockingTimeMs": 112,
"frameDurationMs": 17.223333333333297,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-node-resize-workload",
"durationMs": 4522.213000000079,
"styleRecalcs": 20,
"styleRecalcDurationMs": 56.98699999999998,
"layouts": 20,
"layoutDurationMs": 24.587999999999997,
"taskDurationMs": 4459.694,
"heapDeltaBytes": -39660516,
"heapUsedBytes": 170417556,
"domNodes": -6548,
"jsHeapTotalBytes": 7438336,
"scriptDurationMs": 75.78599999999999,
"eventListeners": -7473,
"totalBlockingTimeMs": 63,
"frameDurationMs": 17.220000000000013,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 442.4130000000446,
"styleRecalcs": 16,
"styleRecalcDurationMs": 18.9,
"layouts": 3,
"layoutDurationMs": 1.31,
"taskDurationMs": 94.592,
"heapDeltaBytes": 5361536,
"heapUsedBytes": 73431052,
"domNodes": 153,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 11.325999999999999,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "workflow-execution",
"durationMs": 433.5320000000138,
"styleRecalcs": 11,
"styleRecalcDurationMs": 15.844000000000001,
"layouts": 3,
"layoutDurationMs": 1.3349999999999997,
"taskDurationMs": 80.89899999999999,
"heapDeltaBytes": 5041172,
"heapUsedBytes": 72855656,
"domNodes": 117,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 7.531999999999999,
"eventListeners": 97,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## nathaniel/agent-v1/14-panel-shell #16318 +/- ##
=====================================================================
+ Coverage 83.23% 83.25% +0.02%
=====================================================================
Files 2024 2025 +1
Lines 117423 117465 +42
Branches 33195 32612 -583
=====================================================================
+ Hits 97738 97801 +63
+ Misses 19332 19311 -21
Partials 353 353
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 7 files with indirect coverage changes 🚀 New features to boost your workflow:
|
The purge ran reset() only, which clears the active slot and leaves background turns intact. A switch therefore left the outgoing user's turns live: setting the old thread id and resuming reached user A's transcript from inside user B's session. Abort and drop now run before reset, in that order, because dropping first empties the retained set so reset's preview revocation covers everything. Blob preview urls are revoked before the composer is cleared, after the drop, since composer and background turns share previewUrl strings. The stored thread id and its forget helper move to a leaf module. The unconditional boot slot dynamically imports the lifetime adapter for every cloud user, flag on or off, and reaching useAgentSession's closure dragged the REST client, the event transport and its module-scope schemas along with it. Measured on cloud builds, the adapter chunk drops from 9,234 to 4,610 bytes gzipped. registerLifetimes gains the containment setupFlagGate already has: the slot now carries a cross-account data path, so a silent load failure would be a fully working panel with no purge and no signal. Tests: the panel-scope prev-user guard is pinned against the boot race that reaches it, the purge asserts both settle calls and the end state, the composer fixture grows a blob url so a leak and a no-leak stop looking alike, disposal moves to one afterEach so a single defect stops reporting as three reds, and the path-undefined and post-dispose prune branches are covered. The panel-open half of the CRDT detach is closed by the draft store reset; the panel-closed half stays undecided and is now named as such above the purge.
A turn stashed without recordUser holds its attachment previews only in the background-turn entry, so the purge's drop cleared them while reset's revoker never saw them. That path is ordinary: attach an image, send, switch thread mid-post, then switch account. The drop now revokes the previews it alone owns. The purge order was correct but unpinned. The test named for it only asserted that both calls happened, never that they preceded reset, so inverting the order reinstated the original defect in silence: reset nulls the transport without settling it, the abort then no-ops, and a streaming turn is left live. The test now captures the live message and asserts it stops streaming, and the revoke test carries a stashed turn so a reordering that strands its preview is caught too. The lifetime slot's containment had no regression pin while its sibling did. A throwing lifetime chunk is now asserted to report and to leave the gate settled. The purge comment claimed a completeness it did not have: it said reset revoked every preview it still owns, which was never true of the turns that hold previews nowhere else. It now says what happens, including that a preview held in both places is revoked twice.
…l' into nathaniel/agent-v1/15-lifetime-adapter
|
Superseded — closing per Christian's direction.
Full context for agent readersProgram pivot 2026-08-31: the 17-slice stack targeting the v1 integration branch is superseded by the #16198 v2 merge to main @f954e479. Per program/reorientation-plan.md, all remaining value (tests, QA artifacts, invariant checks, refactors) ports to main-based successor PRs. Pre-close dossier cross-check completed for this PR; unique unsalvaged content (if any) was filed as a salvage row in the program todo before close. This closed PR remains a readable source; review/QA deliverables are posted only on open successor PRs. |
# Conflicts: # src/workbench/extensions/agent/AgentPanelRoot.vue
…edesign
The tracker-chunk-failure variant pinned the pre-lifetime mechanism:
setup() rejecting through Promise.all so the extension service's
per-extension catch owns the failure. The lifetime adapter deliberately
inverted that slot - registerLifetimes() catches its own chunk failure
and reports it (a silent failure there means no cross-account purge),
so setup() resolves and the mocked tracker module is no longer imported
by this path at all, leaving the variant asserting a mechanism that no
longer exists against a module nothing loads.
The contract it guarded - a failing sibling chunk must neither hang the
gate nor brick the panel - is pinned by the surviving variant:
agentPanelGateDependencyFailure.test.ts ('settles fail-closed, reports,
and resolves the setup promise').
…l' into hub-15-step # Conflicts: # src/workbench/extensions/agent/AgentPanelRoot.vue
Slice 15 moved stop and the tab-activity clears into useAgentLifetime but left onBeforeUnmount(exitNodeSelectionMode) registered above that call. Hooks fire in registration order, so the throw-capable exit ran first and a raise in it skipped session.stop(), the flag clears, the active-tab generation bump and the mint-port detach - the last of which is slice 14's guard against a tab being created, and a file written, after close. Register the exit after both, restoring the pre-refactor ordering, and pin the half that was never covered: an in-flight turn must already be aborted when the exit raises.
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @christian-byrne.
Found 10 finding(s).
| Severity | Count |
|---|---|
| 🟠 High | 3 |
| 🟡 Medium | 4 |
| 🟢 Low | 3 |
Panel: 8/8 reviewers contributed findings.
| const { registerAgentLifetimes } = | ||
| await import('@/workbench/extensions/agent/composables/agent/useAgentLifetime') | ||
| registerAgentLifetimes() | ||
| } catch (error) { |
There was a problem hiding this comment.
🟠 High — Catching the lifetime chunk's load failure lets setupFlagGate() enable a fully working panel with no cross-account purge watcher registered, so an account switch leaves the previous user's conversation, thread id, draft, and tab bindings intact and session.start() re-hydrates the previous user's thread under the new user's token. The previous code let the tracker's rejection propagate to the extension service's catch; now that this slot carries a privacy control it should fail closed (leave the panel gated off) or retry rather than log and continue. Raised by 5 of 8 reviewers (gemini-3.1-pro adversarial, gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial, kimi-k3-max adversarial).
| composer.attachments = [] | ||
| forgetAgentSessionMemory() | ||
| useAgentWorkflowTabBindingStore().clear() | ||
| useAgentDraftStore().reset() |
There was a problem hiding this comment.
🟠 High — The purge never clears Comfy.Agent.CrdtDocId from sessionStorage, and the docstring's claim that draftStore.reset() drives the follower's clearPersistedDocId() does not hold: nulling the workflow id also flips isBoundWorkflowActive false in the same tick, so the follower's watch takes its if (!active) early return, which unsubscribes but never clears the persisted id — and with the panel closed there is no follower at all. The next mount's initialBind then reads the outgoing account's doc id and calls adapter.bind()/bridge.subscribe() on it, applying that document's updates to the incoming account's canvas. Raised by 4 of 8 reviewers (claude-opus-5-thinking-max edge-case, gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial, gpt-5.6-sol-max adversarial).
| watch( | ||
| () => resolvedUserInfo.value?.id ?? null, | ||
| (_id, previousId) => { | ||
| if (previousId !== null) purgeUserScopedAgentState() |
There was a problem hiding this comment.
🟠 High — The purge keys on user id alone, but agentChatHistoryStore scopes its storage on ${userId}.${workspaceId}, and Comfy.Agent.ThreadId / Comfy.Agent.WorkflowTabBindings are single global keys with no recorded owner. A same-user workspace switch therefore never purges at all, and the previousId !== null guard additionally skips the boot-time null -> user transition, so signing in as a different account after a reload leaves start() resuming the previous identity's thread via hydrateFromServer(stored) and inheriting its workflow→tab bindings. Scoping those keys by user and workspace the way the history store already does would make both cases distinguishable from a legitimate resume. Raised by 6 of 8 reviewers (gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial, gpt-5.6-sol-max adversarial, claude-opus-5-thinking-max edge-case, kimi-k3-max adversarial, kimi-k3-max edge-case).
| // Each drop revokes the previews it alone owns, and dropping first empties | ||
| // the retained set so reset's dropAttachmentPreviews skips none of its own. | ||
| // A preview held in both places is revoked twice, which is idempotent. | ||
| conversation.abortActiveTurn() |
There was a problem hiding this comment.
🟡 Medium — The purge is synchronous and bumps no generation, so a sendMessage() already awaiting postTurn() is unfenced: with the panel closed and a 'new' destination thread, the late ack passes stillDisplayed and runs setThreadId(ack.thread_id) plus the storage write, re-persisting the thread id this purge just deleted and re-populating the binding store under the incoming user. With the panel open, start()'s generation bump routes it to startBackgroundTurn() instead, re-inserting the outgoing user's prompt text and already-revoked preview URLs after dropBackgroundTurns() has run. Raised by 4 of 8 reviewers (kimi-k3-max edge-case, gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max edge-case, gpt-5.6-sol-max adversarial).
| () => resolvedUserInfo.value?.id ?? null, | ||
| (_id, previousId) => { | ||
| if (previousId !== null) { | ||
| session.stop() |
There was a problem hiding this comment.
🟡 Medium — session.stop() immediately followed by start() cancels stop's own teardown: useAgentSession.stop() defers abortActiveTurn()/dropBackgroundTurns() into a queueMicrotask guarded by stoppedGeneration === sessionGeneration, and start() bumps that generation synchronously, so the queued cleanup always early-returns here. The panel-scope handler therefore depends entirely on the app-scope purge having fired first — registration-order dependent, and a complete no-op in exactly the chunk-load-failure case agentPanel.ts now swallows, leaving the outgoing user's turn streaming into the incoming user's panel. The fakeSession stub in the new test cannot catch this because it has no generation guard. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max edge-case, kimi-k3-max edge-case, gemini-3.1-pro adversarial).
| entry.transport.settle() | ||
| // Turns stashed without recordUser hold their previews only here, so | ||
| // dropAttachmentPreviews never sees them: this is their only revoke. | ||
| for (const { previewUrl } of entry.attachments ?? []) { |
There was a problem hiding this comment.
🟡 Medium — This revoke also fires from dropBackgroundTurns()'s pre-existing callers — useAgentSession.stop() and onStatus(live=false) on every transient socket drop — and for a turn stashed by stashActiveTurn() entry.attachments is the same array object still held in userAttachments and rendered through entries. A reconnect inside start()'s window between stashActiveTurn() and the awaited hydrateFromServer() therefore kills blob URLs that are still on-screen, permanently breaking those previews; note dropAttachmentPreviews() deliberately retains them so resumeBackgroundTurn() can redisplay them. Revoking from the purge path instead of inside the store method would keep the other callers non-destructive. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max edge-case, gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial).
| (_id, previousId) => { | ||
| if (previousId !== null) { | ||
| session.stop() | ||
| session.start() |
There was a problem hiding this comment.
🟡 Medium — Restarting the session does not fence root-scoped async work already in flight for the outgoing identity: an A-authenticated listThreads() from refreshHistory() can resolve after the history store's own identity watcher cleared it and call replaceAll(), putting A's thread titles and previews in B's panel, and applyDraft()/the workflow loaders have the same missing fence. A generation counter checked before each response is applied would close it. Raised by 2 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case).
| watch( | ||
| () => resolvedUserInfo.value?.id ?? null, | ||
| (_id, previousId) => { | ||
| if (previousId !== null) { |
There was a problem hiding this comment.
🟢 Low — The new id is ignored (_id), so a logout ('user-a' -> null) takes the same branch as a switch and immediately restarts the session, re-subscribing the event source and status listener with no authenticated user; this branch should stop() only when the new id is null. Relatedly, the app-scope watcher treats any transient null from the auth rails (token refresh, Firebase re-init) as an account change and irrecoverably discards composer.draft and its attachments — comparing against the last non-null id would cover both. Raised by 2 of 8 reviewers (kimi-k3-max adversarial, claude-opus-5-thinking-max edge-case).
| */ | ||
| export function registerAgentLifetimes(): () => void { | ||
| const scope = effectScope(true) | ||
| scope.run(() => { |
There was a problem hiding this comment.
🟢 Low — scope.run() has no failure handling, so a throw partway through (e.g. useCurrentUser() reaching the auth store with no active pinia) leaves the already-registered markSeen/pruneClosed watchers alive inside a scope whose disposer is never returned, while the purge watcher — registered last — never exists. Since agentPanel.ts catches that throw and continues, the app ends up half-registered with leaked watchers and no purge; wrapping the body so the scope is stopped on failure makes registration all-or-nothing. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).
| // there, so it stays: an in-flight active-tab link sees a stale | ||
| // generation and stops, so no tab is created and no file written after | ||
| // the close. | ||
| activeTabGeneration++ |
There was a problem hiding this comment.
🟢 Low — The generation bump is no longer first in teardown: useAgentLifetime's onBeforeUnmount (which calls session.stop()) and the CRDT follower's teardown now both run ahead of it, so a raise in either skips the bump and mintPortWiring.detach() — exactly the post-close tab creation and file write this comment says the bump exists to prevent — and leaves the follower's listeners attached. Registering the bump before the useAgentLifetime() call would restore the previous ordering guarantee. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max adversarial).
christian-byrne
left a comment
There was a problem hiding this comment.
Exact-head fleet review found three account-isolation blockers and four lifecycle races. The existing automated inline threads already anchor the same sites, so this review records the independently verified batch without creating duplicate threads.
Full context for agent readers
Reviewed 1f9c73057a1129df21d9bbe961a31779e974ec0e against stacked base nathaniel/agent-v1/14-panel-shell (79ba411f5ed3749b432a57f8601c7cd907fee5c7). Findings are static-analysis findings, ordered by severity.
-
High,
src/extensions/core/agentPanel.ts:86:registerLifetimes()catches its own import/registration failure and letsPromise.all()resolve.setupFlagGate()can then settle and enable the panel with no account-switch purge watcher. Because this chunk now owns the privacy boundary, registration failure must leave the panel gated off or otherwise prevent agent startup, not merely report telemetry. -
High,
src/workbench/extensions/agent/composables/agent/useAgentLifetime.ts:57: resetting the draft does not reliably clearComfy.Agent.CrdtDocId. The follower watches[workflowId, isTargetActive]; the reset changes these to[null, false], and its!activebranch returns beforeclearPersistedDocId(). With the panel closed, no follower exists to clear it at all. A later mount can therefore rebind the outgoing account's persisted document under the incoming account. -
High,
src/workbench/extensions/agent/composables/agent/useAgentLifetime.ts:83: the purge watches only user id, while agent history is already scoped by both user and workspace and the new thread/tab-binding keys are global. A same-user workspace switch never purges. ThepreviousId !== nullboot guard also preserves a prior account's global thread id across reload into a different login. Persisted session state needs an owner scope that distinguishes user and workspace before it can be resumed safely. -
Medium,
src/workbench/extensions/agent/composables/agent/useAgentLifetime.ts:45: the purge clears current stores but advances neithersessionGenerationnorloadGeneration. AsendMessage()already awaitingpostTurn()can finish afterward and either persist the outgoing thread again or recreate it as a background turn under the incoming identity. The identity transition needs to fence pending acknowledgements before clearing state. -
Medium,
src/workbench/extensions/agent/composables/agent/useAgentLifetime.ts:103:stop()immediately followed bystart()cancelsstop()'s deferred cleanup.stop()queues abort/drop behind astoppedGeneration === sessionGenerationguard, thenstart()increments that generation synchronously, so the queued callback returns without aborting. The panel-scope switch handler therefore does not independently stop the outgoing turn. -
Medium,
src/workbench/extensions/agent/stores/agent/agentConversationStore.ts:217: moving preview revocation intodropBackgroundTurns()changes every caller, not only account purge.onStatus(false)and normal session stop also call this method. A stashed turn retains the same attachment array used by the rendered user entry, so a transient disconnect can revoke blob URLs that remain on screen and may be resumed. Keep ordinary background-turn cleanup non-destructive and revoke explicitly from the identity-purge path. -
Medium,
src/workbench/extensions/agent/AgentPanelRoot.vue:901:refreshHistory()has no identity/generation fence. A list request authenticated as account A can resolve after the history store synchronously clears on the A-to-B transition, thenreplaceAll()writes A's titles/previews into B's panel. The same switch boundary introduced here should invalidate root-scoped async reads before applying their results.
|
This slice is reference-only. Accepted work is routed to #17324 and #16340. Full context for agent readersPer Christian's main-target close ruling, #16318 (15 — workflow, tab, and lifetime adapter) is no longer a landing vehicle. It remains readable implementation and review provenance. Lifetime/session and panel-target responsibilities are separated. If a genuinely unaccounted delta is found, reopen this source or file a bounded main-based carrier rather than reviving the stacked merge path. |
Slice 15 of the agent-v1 extraction ladder (stacked on #16316).
Adds the workflow/tab/lifetime adapter: one module (useAgentLifetime) with a panel-scope composable and an app-scope registrar giving the agent panel a single owner for every lifetime seam - panel mount/unmount ordering (session stop strictly before follower teardown), workflow tab activation/close tracking (absorbing the tab-activity tracker into the one registrar), user-switch purge (transcript, composer, thread memory, tab bindings, draft binding - with a boot-time guard so first sign-in does not wipe thread resume), and explicit recorded no-ops for the unsettled contracts (tab rename - the path-keyed binding re-binds at next save; bound-tab close, pinned by a named test; page teardown, pinned by a no-listener test). 16 behavioral tests including six negatives: watcher disposal, same-identity re-emission, no doc-binding clear on unmount, no restart on tab switch, no leak after unmount, no window listeners.
Net-new integration per plan row 15; deliberately replaceable in one file. CRDT surfaces untouched - the open subscription-semantics questions are recorded for the CRDT owner rather than decided here.
Review-audit deltas (salvage matrix): items found during the slicing and review audits that did not make it through the integration merge (#16198).
6 artifacts resolved by this slice (2 high severity):