Skip to content

fix(web-ui): SwarmAgent context preview canvas ownership - #3901

Closed
YodonTan wants to merge 1 commit into
openBitFun:mainfrom
YodonTan:fix/swarm-context-preview-canvas-scope
Closed

YodonTan wants to merge 1 commit into
openBitFun:mainfrom
YodonTan:fix/swarm-context-preview-canvas-scope

Conversation

@YodonTan

@YodonTan YodonTan commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review: the author has confirmed that the fix works after installing the unsigned Windows installer. AI-assisted work; focused test results and historical limitations are documented below.

Root cause

Retained output belongs to the session that produced it, but a child conversation (btw, subagent, swarm worker, review) is presented inside its parent canvas. openSessionContextPreview committed its tab under params.sessionId. When a reusable swarm worker owned the composer while the parent scene kept its canvas live, the tab landed in a canvas scope that never becomes live: the request looked ignored and nothing expanded.

Change

  • canvasStore.ts: add presentedAgentCanvasScopeKey(sessionId, parentSessionId). It keeps the session own scope when that scope is live, uses the parent scope when the child is presented in the parent live canvas, and otherwise keeps the own scope so retained output is not leaked onto an unrelated canvas.
  • openSessionContextPreview.ts: resolve the canvas scope through presentedAgentCanvasScopeKey (parent resolved via resolveSessionRelationship), commit the tab to that scope, and gate the expand-right-panel reveal on the same resolved scope.
  • Tab metadata still carries the child sessionId, and the usage/report request still targets the child session; only the presenting canvas scope changes.

Files changed

  • src/web-ui/src/app/components/panels/content-canvas/stores/canvasStore.ts
  • src/web-ui/src/flow_chat/services/openSessionContextPreview.ts
  • src/web-ui/src/flow_chat/services/openSessionContextPreview.test.ts

Verification

  • Focused: openSessionContextPreview.test.ts 21/21 passed, including 3 new cases (child preview joins the live parent canvas; child preview stays with the child when the parent is not on screen; child preview keeps its own canvas when that canvas is live).
  • Related Web UI tests: about 250 passed.
  • Independent review of the change: passed.
  • Historical local verification limitations (retained for context):
    • The full check:web run was blocked by missing generated API artifacts and by pre-existing Dialog style issues unrelated to this change.
    • The Windows desktop build failed while downloading sherpa-onnx because of a local proxy certificate error (UnknownIssuer), so that local attempt produced no installer package. A later successful CI installer build and author-confirmed installation test are documented below.
  • Manual Windows installation verification: the author explicitly confirmed on a real Windows machine that the system-prompt/context preview now opens correctly after installing the unsigned OpenBitFun_1.0.11_x64-setup.exe. This is author-reported manual verification, not an automated test or reviewer approval. Screenshots or a recording have not been supplied here.
  • Successful installer build run: https://github.com/YodonTan/BitFun/actions/runs/43830633519 (completed, success). Actual application build SHA confirmed by the author: c2f25d205ea5f34e539ea5bba6bf27f245983acb. The Actions run API reports workflow head SHA bcdd0eeb31520e5b1450fef25e4f33fd43d3236a; it is distinct from the reported application build SHA.

Remote scenarios

Not exercised live for any of the four scenarios (remote workspace, remote control, peer device mode, detached dispatch). The change is Web UI canvas scope resolution only and adds no host or transport dependency, so no remote path is expected to be affected.

Testing level

Focused and related Web UI unit tests passed, plus author-confirmed real-machine Windows installation and manual GUI verification. Not a full test-matrix pass: historical local check:web/build limitations remain documented above, and remote scenarios were not exercised. AI-assisted work.

…ession

Retained output belongs to the session that produced it, but a child
conversation (btw, subagent, review) is presented inside its parent's
canvas. openSessionContextPreview committed its tab under params.sessionId,
so when a reusable swarm worker owned the composer while the parent scene
kept its canvas live, the tab landed in a scope that never becomes live:
the request looked ignored and nothing expanded.

Resolve the canvas scope with presentedAgentCanvasScopeKey, which keeps the
session's own scope when it is live, uses the parent scope when the child is
presented in the parent's live canvas, and otherwise keeps the own scope so
retained output is not leaked onto an unrelated canvas. Gate the reveal on
that same resolved scope.

Focused verification: openSessionContextPreview.test.ts 21/21 passed.
@YodonTan
YodonTan force-pushed the fix/swarm-context-preview-canvas-scope branch from abead1d to c2f25d2 Compare November 16, 2026 08:21
@YodonTan YodonTan changed the title WIP: fix(web-ui): SwarmAgent context preview canvas ownership fix(web-ui): SwarmAgent context preview canvas ownership Nov 17, 2026
@YodonTan
YodonTan marked this pull request as ready for review November 17, 2026 01:42
@YodonTan

YodonTan commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

@wsp1911 This PR is ready for review and is no longer a draft. Could you please review it?

The author has manually installed the unsigned Windows installer OpenBitFun_1.0.11_x64-setup.exe on a real Windows machine and confirmed that the system-prompt preview in the SwarmAgent context panel opens correctly in Extreme mode. The author-confirmed application build commit is c2f25d205ea5f34e539ea5bba6bf27f245983acb.

Successful installer build: https://github.com/YodonTan/BitFun/actions/runs/43830633519. The workflow head SHA differs from the application build commit, as documented in the PR description. This is author-reported manual verification, not an automated test or reviewer approval. Focused test results, historical verification limitations, and untested remote scenarios remain documented in the PR description. Thank you!

@wsp1911 wsp1911 self-assigned this Nov 17, 2026
@wsp1911

wsp1911 commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

#3993 修复上下文构成面板相关问题时一并修复了这个问题

@wsp1911 wsp1911 closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants