Skip to content

[agent-v1 15/18] feat(agent): workflow, tab, and lifetime adapter - #16318

Closed
CodeJuggernaut wants to merge 16 commits into
nathaniel/agent-v1/14-panel-shellfrom
nathaniel/agent-v1/15-lifetime-adapter
Closed

CodeJuggernaut wants to merge 16 commits into
nathaniel/agent-v1/14-panel-shellfrom
nathaniel/agent-v1/15-lifetime-adapter

Conversation

@CodeJuggernaut

@CodeJuggernaut CodeJuggernaut commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Refs: none (net-new integration row)

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):

ID Severity Kind Artifact
11.0 high fix App-scope user-switch/logout purge of user-scoped agent state (registerAgentLifetimes identity watcher + purge
11.1 high fix Panel-scope session stop/start restart on user change (useAgentLifetime watch on resolvedUserInfo.id with prev
11.2 medium guard Teardown-order contract: session.stop() registers (and runs) before the CRDT follower's own onBeforeUnmount, e
11.3 medium fix Background-turn attachment-preview revocation in dropBackgroundTurns (each dropped entry revokes the blob prev
11.4 medium test useAgentLifetime.test.ts (539 lines at tip): pins the purge order via observable outcomes (live message stops
11.5 low refactor Structural refactor set: agentSessionMemory.ts leaf module (keeps the app-scope purge from dragging the REST c

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.
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 30, 2026
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 5a4bd50d-fcc7-451e-a132-075239f6bd3d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/01/2026, 12:25:45 PM UTC

Links

🎭 Playwright: ✅ 1888 passed, 0 failed · 1 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1867 / ❌ 0 / ⚠️ 1 / ⏭️ 4)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

📦 Bundle Size

⏳ Size data collection in progress…

⚡ Performance Report

canvas-idle: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 68.0 MB heap
canvas-mouse-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 69.7 MB heap
canvas-zoom-sweep: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 71.2 MB heap
dom-widget-clipping: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 83.8 MB heap
large-graph-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 82.7 MB heap
large-graph-pan: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 85.9 MB heap
large-graph-zoom: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 72.6 MB heap
legacy-node-drag: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 83.1 MB heap
minimap-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 82.6 MB heap
subgraph-dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 82.5 MB heap
subgraph-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 68.8 MB heap
subgraph-mouse-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 73.7 MB heap
subgraph-transition-enter: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 69ms TBT · 95.3 MB heap
viewport-pan-sweep: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 76.2 MB heap
vue-large-graph-idle: · 58.1 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 170.8 MB heap
vue-large-graph-pan: · 58.1 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 2ms TBT · 166.4 MB heap
vue-node-resize-workload: · 58.1 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 88ms TBT · 174.7 MB heap
workflow-execution: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 69.8 MB heap

ℹ️ No baseline found — significance unavailable.

Absolute values
Metric Value
canvas-idle: avg frame time 17ms
canvas-idle: p95 frame time 17ms
canvas-idle: layout duration 0ms
canvas-idle: style recalc duration 9ms
canvas-idle: layout count 0
canvas-idle: style recalc count 10
canvas-idle: task duration 418ms
canvas-idle: script duration 11ms
canvas-idle: TBT 0ms
canvas-idle: heap used 68.0 MB
canvas-idle: DOM nodes -282
canvas-idle: event listeners -154
canvas-mouse-sweep: avg frame time 17ms
canvas-mouse-sweep: p95 frame time 17ms
canvas-mouse-sweep: layout duration 5ms
canvas-mouse-sweep: style recalc duration 33ms
canvas-mouse-sweep: layout count 14
canvas-mouse-sweep: style recalc count 74
canvas-mouse-sweep: task duration 689ms
canvas-mouse-sweep: script duration 114ms
canvas-mouse-sweep: TBT 0ms
canvas-mouse-sweep: heap used 69.7 MB
canvas-mouse-sweep: DOM nodes -280
canvas-mouse-sweep: event listeners -184
canvas-zoom-sweep: avg frame time 17ms
canvas-zoom-sweep: p95 frame time 17ms
canvas-zoom-sweep: layout duration 1ms
canvas-zoom-sweep: style recalc duration 16ms
canvas-zoom-sweep: layout count 6
canvas-zoom-sweep: style recalc count 32
canvas-zoom-sweep: task duration 302ms
canvas-zoom-sweep: script duration 13ms
canvas-zoom-sweep: TBT 0ms
canvas-zoom-sweep: heap used 71.2 MB
canvas-zoom-sweep: DOM nodes 78
canvas-zoom-sweep: event listeners 21
dom-widget-clipping: avg frame time 17ms
dom-widget-clipping: p95 frame time 17ms
dom-widget-clipping: layout duration 0ms
dom-widget-clipping: style recalc duration 8ms
dom-widget-clipping: layout count 0
dom-widget-clipping: style recalc count 12
dom-widget-clipping: task duration 318ms
dom-widget-clipping: script duration 105ms
dom-widget-clipping: TBT 0ms
dom-widget-clipping: heap used 83.8 MB
dom-widget-clipping: DOM nodes 20
dom-widget-clipping: event listeners 2
large-graph-idle: avg frame time 17ms
large-graph-idle: p95 frame time 17ms
large-graph-idle: layout duration 0ms
large-graph-idle: style recalc duration 5ms
large-graph-idle: layout count 0
large-graph-idle: style recalc count 6
large-graph-idle: task duration 453ms
large-graph-idle: script duration 30ms
large-graph-idle: TBT 0ms
large-graph-idle: heap used 82.7 MB
large-graph-idle: DOM nodes -269
large-graph-idle: event listeners -167
large-graph-pan: avg frame time 17ms
large-graph-pan: p95 frame time 17ms
large-graph-pan: layout duration 0ms
large-graph-pan: style recalc duration 15ms
large-graph-pan: layout count 0
large-graph-pan: style recalc count 69
large-graph-pan: task duration 1262ms
large-graph-pan: script duration 581ms
large-graph-pan: TBT 0ms
large-graph-pan: heap used 85.9 MB
large-graph-pan: DOM nodes -267
large-graph-pan: event listeners -166
large-graph-zoom: avg frame time 17ms
large-graph-zoom: p95 frame time 17ms
large-graph-zoom: layout duration 15ms
large-graph-zoom: style recalc duration 14ms
large-graph-zoom: layout count 60
large-graph-zoom: style recalc count 63
large-graph-zoom: task duration 1307ms
large-graph-zoom: script duration 554ms
large-graph-zoom: TBT 0ms
large-graph-zoom: heap used 72.6 MB
large-graph-zoom: DOM nodes 6
large-graph-zoom: event listeners 9
legacy-node-drag: avg frame time 17ms
legacy-node-drag: p95 frame time 17ms
legacy-node-drag: layout duration 0ms
legacy-node-drag: style recalc duration 8ms
legacy-node-drag: layout count 0
legacy-node-drag: style recalc count 42
legacy-node-drag: task duration 1474ms
legacy-node-drag: script duration 700ms
legacy-node-drag: TBT 0ms
legacy-node-drag: heap used 83.1 MB
legacy-node-drag: DOM nodes 4
legacy-node-drag: event listeners 187
minimap-idle: avg frame time 17ms
minimap-idle: p95 frame time 17ms
minimap-idle: layout duration 0ms
minimap-idle: style recalc duration 6ms
minimap-idle: layout count 0
minimap-idle: style recalc count 7
minimap-idle: task duration 524ms
minimap-idle: script duration 33ms
minimap-idle: TBT 0ms
minimap-idle: heap used 82.6 MB
minimap-idle: DOM nodes -269
minimap-idle: event listeners -183
subgraph-dom-widget-clipping: avg frame time 17ms
subgraph-dom-widget-clipping: p95 frame time 17ms
subgraph-dom-widget-clipping: layout duration 0ms
subgraph-dom-widget-clipping: style recalc duration 11ms
subgraph-dom-widget-clipping: layout count 0
subgraph-dom-widget-clipping: style recalc count 49
subgraph-dom-widget-clipping: task duration 304ms
subgraph-dom-widget-clipping: script duration 97ms
subgraph-dom-widget-clipping: TBT 0ms
subgraph-dom-widget-clipping: heap used 82.5 MB
subgraph-dom-widget-clipping: DOM nodes 23
subgraph-dom-widget-clipping: event listeners 7
subgraph-idle: avg frame time 17ms
subgraph-idle: p95 frame time 17ms
subgraph-idle: layout duration 0ms
subgraph-idle: style recalc duration 9ms
subgraph-idle: layout count 0
subgraph-idle: style recalc count 11
subgraph-idle: task duration 399ms
subgraph-idle: script duration 10ms
subgraph-idle: TBT 0ms
subgraph-idle: heap used 68.8 MB
subgraph-idle: DOM nodes -295
subgraph-idle: event listeners -229
subgraph-mouse-sweep: avg frame time 17ms
subgraph-mouse-sweep: p95 frame time 17ms
subgraph-mouse-sweep: layout duration 6ms
subgraph-mouse-sweep: style recalc duration 33ms
subgraph-mouse-sweep: layout count 18
subgraph-mouse-sweep: style recalc count 77
subgraph-mouse-sweep: task duration 655ms
subgraph-mouse-sweep: script duration 92ms
subgraph-mouse-sweep: TBT 0ms
subgraph-mouse-sweep: heap used 73.7 MB
subgraph-mouse-sweep: DOM nodes -296
subgraph-mouse-sweep: event listeners -229
subgraph-transition-enter: avg frame time 17ms
subgraph-transition-enter: p95 frame time 17ms
subgraph-transition-enter: layout duration 12ms
subgraph-transition-enter: style recalc duration 24ms
subgraph-transition-enter: layout count 15
subgraph-transition-enter: style recalc count 19
subgraph-transition-enter: task duration 696ms
subgraph-transition-enter: script duration 22ms
subgraph-transition-enter: TBT 69ms
subgraph-transition-enter: heap used 95.3 MB
subgraph-transition-enter: DOM nodes 13671
subgraph-transition-enter: event listeners 2381
viewport-pan-sweep: avg frame time 17ms
viewport-pan-sweep: p95 frame time 17ms
viewport-pan-sweep: layout duration 0ms
viewport-pan-sweep: style recalc duration 46ms
viewport-pan-sweep: layout count 0
viewport-pan-sweep: style recalc count 249
viewport-pan-sweep: task duration 4419ms
viewport-pan-sweep: script duration 1895ms
viewport-pan-sweep: TBT 0ms
viewport-pan-sweep: heap used 76.2 MB
viewport-pan-sweep: DOM nodes -268
viewport-pan-sweep: event listeners -163
vue-large-graph-idle: avg frame time 17ms
vue-large-graph-idle: p95 frame time 17ms
vue-large-graph-idle: layout duration 0ms
vue-large-graph-idle: style recalc duration 0ms
vue-large-graph-idle: layout count 0
vue-large-graph-idle: style recalc count 0
vue-large-graph-idle: task duration 11999ms
vue-large-graph-idle: script duration 173ms
vue-large-graph-idle: TBT 0ms
vue-large-graph-idle: heap used 170.8 MB
vue-large-graph-idle: DOM nodes -6550
vue-large-graph-idle: event listeners -7475
vue-large-graph-pan: avg frame time 17ms
vue-large-graph-pan: p95 frame time 17ms
vue-large-graph-pan: layout duration 0ms
vue-large-graph-pan: style recalc duration 16ms
vue-large-graph-pan: layout count 0
vue-large-graph-pan: style recalc count 74
vue-large-graph-pan: task duration 14545ms
vue-large-graph-pan: script duration 662ms
vue-large-graph-pan: TBT 2ms
vue-large-graph-pan: heap used 166.4 MB
vue-large-graph-pan: DOM nodes -6548
vue-large-graph-pan: event listeners -7472
vue-node-resize-workload: avg frame time 17ms
vue-node-resize-workload: p95 frame time 17ms
vue-node-resize-workload: layout duration 24ms
vue-node-resize-workload: style recalc duration 58ms
vue-node-resize-workload: layout count 20
vue-node-resize-workload: style recalc count 20
vue-node-resize-workload: task duration 4476ms
vue-node-resize-workload: script duration 78ms
vue-node-resize-workload: TBT 88ms
vue-node-resize-workload: heap used 174.7 MB
vue-node-resize-workload: DOM nodes -6548
vue-node-resize-workload: event listeners -7473
workflow-execution: avg frame time 17ms
workflow-execution: p95 frame time 17ms
workflow-execution: layout duration 1ms
workflow-execution: style recalc duration 17ms
workflow-execution: layout count 3
workflow-execution: style recalc count 14
workflow-execution: task duration 88ms
workflow-execution: script duration 9ms
workflow-execution: TBT 0ms
workflow-execution: heap used 69.8 MB
workflow-execution: DOM nodes 135
workflow-execution: event listeners 98
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

Metric Covered Total Pct
Lines 48054 70486 68.2% 🟡
Functions 0 0 — —
Branches 0 0 — —
Top 10 files by uncovered lines
File Coverage Missed
src/LGraphCanvas.ts 67.1% 1188
src/LGraphNode.ts 69.7% 391
src/extensions/core/cameraInfo/CameraInfoViewport.ts 2.0% 343
src/platform/workspace/stores/billingOperationStore.ts 8.3% 300
src/platform/workspace/stores/workspaceAuthStore.ts 36.0% 288
src/platform/workspace/stores/teamWorkspaceStore.ts 37.7% 261
src/LGraph.ts 78.4% 258
src/scripts/app.ts 71.6% 250
src/scripts/pnginfo.ts 21.4% 221
src/stores/assetsStore.ts 44.7% 204

@github-actions github-actions Bot added the risk:R2 PR risk grade (advisory shadow check; grader-owned) label Aug 30, 2026
@codecov

codecov Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.68421% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ions/agent/composables/agent/agentSessionMemory.ts 80.00% 1 Missing ⚠️
@@                          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              
Flag Coverage Δ
e2e 66.66% <ø> (+0.02%) ⬆️
unit 76.52% <98.68%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/extensions/core/agentPanel.ts 60.86% <100.00%> (+3.05%) ⬆️
src/workbench/extensions/agent/AgentPanelRoot.vue 84.48% <100.00%> (-0.10%) ⬇️
...nsions/agent/composables/agent/useAgentLifetime.ts 100.00% <100.00%> (ø)
...ensions/agent/composables/agent/useAgentSession.ts 95.83% <100.00%> (+0.27%) ⬆️
...sions/agent/stores/agent/agentConversationStore.ts 94.66% <100.00%> (+2.82%) ⬆️
...agent/stores/agent/agentWorkflowTabBindingStore.ts 100.00% <100.00%> (ø)
...ions/agent/composables/agent/agentSessionMemory.ts 80.00% <80.00%> (ø)

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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
@christian-byrne

Copy link
Copy Markdown
Contributor

Superseded — closing per Christian's direction.

Full context for agent readers

Program 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').
@CodeJuggernaut
CodeJuggernaut marked this pull request as draft August 31, 2026 17:04
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.
@huang47 huang47 added the risk:high PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026 — with ChatGPT Codex Connector
@huang47 huang47 removed the risk:R2 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026
@christian-byrne christian-byrne added the cursor-review Trigger multi-model Cursor agent review on this PR label Sep 2, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 ?? []) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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++

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 christian-byrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  1. High, src/extensions/core/agentPanel.ts:86: registerLifetimes() catches its own import/registration failure and lets Promise.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.

  2. High, src/workbench/extensions/agent/composables/agent/useAgentLifetime.ts:57: resetting the draft does not reliably clear Comfy.Agent.CrdtDocId. The follower watches [workflowId, isTargetActive]; the reset changes these to [null, false], and its !active branch returns before clearPersistedDocId(). 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.

  3. 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. The previousId !== null boot 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.

  4. Medium, src/workbench/extensions/agent/composables/agent/useAgentLifetime.ts:45: the purge clears current stores but advances neither sessionGeneration nor loadGeneration. A sendMessage() already awaiting postTurn() 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.

  5. Medium, src/workbench/extensions/agent/composables/agent/useAgentLifetime.ts:103: stop() immediately followed by start() cancels stop()'s deferred cleanup. stop() queues abort/drop behind a stoppedGeneration === sessionGeneration guard, then start() increments that generation synchronously, so the queued callback returns without aborting. The panel-scope switch handler therefore does not independently stop the outgoing turn.

  6. Medium, src/workbench/extensions/agent/stores/agent/agentConversationStore.ts:217: moving preview revocation into dropBackgroundTurns() 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.

  7. 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, then replaceAll() 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.

@christian-byrne

Copy link
Copy Markdown
Contributor

This slice is reference-only. Accepted work is routed to #17324 and #16340.

Full context for agent readers

Per 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.

Decision record.

@DrJKL DrJKL added agent Comfy Agent product, integration, tests or product documentation agent-session Agent sessions, history, turn lifecycle or workflow binding agent-test-playwright Touches Agent-related Playwright tests, fixtures or configuration agent-test-unit Touches Agent-related unit/component tests or their support agent-ui Agent panel, composer, transcript or other user-interface components labels Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Comfy Agent product, integration, tests or product documentation agent-session Agent sessions, history, turn lifecycle or workflow binding agent-test-playwright Touches Agent-related Playwright tests, fixtures or configuration agent-test-unit Touches Agent-related unit/component tests or their support agent-ui Agent panel, composer, transcript or other user-interface components cursor-review Trigger multi-model Cursor agent review on this PR risk:high PR risk grade (advisory shadow check; grader-owned) size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants